Skip to content
Snippets Groups Projects
Commit 7417c8c9 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Generalize reconfigure script to work on more platforms.

* Hello *BSD.
parent 30db5fd9
No related branches found
No related tags found
No related merge requests found
#! /bin/bash
#! /usr/bin/env bash
#
# This script contains all the necessary steps to recreate the
# autotools files to build PPM/YAXT.
......@@ -38,25 +38,40 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
set -e
case $(uname -s) in
Darwin)
libtoolize=glibtoolize
if which gsed >/dev/null 2>&1; then
sedi='gsed -i'
else
sedi="sed -i ''"
fi ;;
if [[ -z "${SED+set}" ]] && command -v gsed >/dev/null 2>&1; then
SED=gsed
fi
;;
*)
libtoolize=libtoolize
sedi='sed -i' ;;
;;
esac
SED=${SED-sed}
if sed_version=$($SED --version) && [[ $sed_version = *GNU\ sed* ]]; then
sed_inplace_options=('-i')
elif $SED -E </dev/null 2>/dev/null >/dev/null ; then
# assume modern FreeBSD sed
sed_inplace_options=('-i' '')
else
printf '%s\n' 'Cannot find sed able to operate in place.' \
'Please provide full path to GNU or FreeBSD sed in SED environment variable.' \
>&2
exit 1
fi
$libtoolize --force --copy
#todo: escape / in $libtoolize
libtoolversion=$($libtoolize --version \
| sed -e 's/^'$libtoolize' \(([^)]*) \)\{0,1\}\([0-9.]*\)/\2/;q')
| ${SED} -e 's/^'"$libtoolize"' \(([^)]*) \)\{0,1\}\([0-9.]*\)/\2/;q')
declare -a patches
case "$libtoolversion" in
2.4.6)
(2.4.6)
patches=(contrib/00nagfor-libtool-patch/nagfor-libtool-2.4.6.patch \
contrib/01aix-deplib-rpath-patch/aix-deplib-libtool.patch \
contrib/03ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.6.patch \
......@@ -65,7 +80,7 @@ case "$libtoolversion" in
contrib/06ltmain_nag_pthread-patch/ltmain_nag_pthread.patch \
contrib/07ltmain-early-xcompile-patch/ltmain-early-xcompile-libtool-2.4.6.patch)
;;
2.4.2)
(2.4.2)
patches=(contrib/00nagfor-libtool-patch/nagfor-libtool.patch \
contrib/01aix-deplib-rpath-patch/aix-deplib-libtool.patch \
contrib/02nagfor53-shared-patch/nagfor53-shared.patch \
......@@ -80,7 +95,8 @@ for patch in "${patches[@]}"; do
patch -p1 <$patch
done
autoreconf -i
eval "find . -name Makefile.in -print0 | xargs -0 $sedi -e 's/[ ][ ]*\$//'"
find . -name Makefile.in -exec $SED "${sed_inplace_options[@]}" \
-e 's/[ ][ ]*$//' \{\} +
\rm -f config/ltmain.sh.orig m4/libtool.m4.orig
wget -o /dev/null -O config/config.guess \
'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment