summaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
committerkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
commit065da3509019b15dd0e678072e6be629e5330bef (patch)
tree69c934c9e786ac048b4fbe8f4c4c5571661521f4 /bootstrap
parentd130fe27fa753be02ed76fd9b277aa3c3d928eb9 (diff)
downloadlibmcpu-0.4.0.tar.xz
Version 0.4.00.4.0
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap128
1 files changed, 128 insertions, 0 deletions
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 0000000..9063c42
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,128 @@
+#!/bin/bash
+
+CWD=`pwd`
+program=`basename $0`
+
+usage() {
+ cat << EOF_USAGE
+
+Usage: $program [options]
+
+Options:
+ -h,--help Display this message.
+ -d,--target-dest-dir=DIR The target ROOTFS directory
+ [default: DIR=/].
+
+The script regenerates files that do not need to be stored in Git:
+ libtool helper files and m4 macros using libtoolize;
+ aclocal.m4 and external/vendor m4 macros using aclocal;
+ config.h.in using autoheader;
+ Makefile.in and helper files using automake;
+ configure using autoconf.
+
+EOF_USAGE
+}
+
+TARGET_DEST_DIR=/
+ACDIR=usr/share/aclocal
+INCDIR=usr/include
+SYSTEM_ACDIR=
+SYSTEM_INCDIR=
+
+while [ 0 ] ; do
+ if [ "$1" = "-h" -o "$1" = "--help" ] ; then
+ usage
+ exit 0
+ elif [ "$1" = "-d" -o "$1" = "--target-dest-dir" ] ; then
+ if [ "$2" = "" ] ; then
+ echo -e "\n${program}: ERROR: --target-dest-dir is not specified.\n"
+ usage
+ exit 1
+ fi
+ TARGET_DEST_DIR="$2"
+ shift 2
+ elif [[ $1 == --target-dest-dir=* ]] ; then
+ TARGET_DEST_DIR="`echo $1 | cut -f2 -d'='`"
+ shift 1
+ else
+ if [ "$1" != "" ] ; then
+ echo -e "\n${program}: ERROR: Unknown argument: $1.\n"
+ usage
+ exit 1
+ fi
+ break
+ fi
+done
+
+if [ ! -d "${TARGET_DEST_DIR}" ] ; then
+ echo -e "\n${program}: ERROR: --target-dest-dir is not a directory.\n"
+ usage
+ exit 1
+fi
+
+# Absolute path:
+if [ "${TARGET_DEST_DIR:0:1}" != "/" ] ; then
+ TARGET_DEST_DIR=${CWD}/${TARGET_DEST_DIR}
+fi
+
+# Remove last '/' char except for the root itself:
+if [ "${TARGET_DEST_DIR}" != "/" -a "${TARGET_DEST_DIR: -1}" = "/" ] ; then
+ len=${#TARGET_DEST_DIR}
+ let "len = len - 1"
+ tmp="${TARGET_DEST_DIR:0:$len}"
+ TARGET_DEST_DIR=${tmp}
+fi
+
+if [ "${TARGET_DEST_DIR}" = "/" ] ; then
+ SYSTEM_ACDIR=/${ACDIR}
+ SYSTEM_INCDIR=/${INCDIR}
+else
+ SYSTEM_ACDIR="${TARGET_DEST_DIR}/${ACDIR}"
+ SYSTEM_INCDIR="${TARGET_DEST_DIR}/${INCDIR}"
+fi
+
+################################################################
+# HOST sysdeps preconfigure fragments:
+#
+for fragment in cpu/sysdeps/*/preconfigure.ac ; do
+ if [ -f "${fragment}" ] ; then
+ dir=`dirname "${fragment}"`
+ ( cd "${dir}" && ./configure-fragment ) || exit 1
+ fi
+done
+#
+# End of HOST sysdeps preconfigure fragments.
+################################################################
+
+################################################################
+# Libtool:
+#
+libtoolize --force --copy || exit 1
+#
+# Используется если в configure.ac вызывается LT_INIT.
+# Patch необходим по тому, что и lib-ld.m4 и libtool.m4
+# используют функцию AC_ARG_WITH([gnu-ld], ...
+# а это приводит к тому, что ./configure --help дважды
+# выдает подсказку --with-gnu-ld :
+#
+patch -p0 < $CWD/config/patches/libtool.m4.patch
+patch -p0 < $CWD/config/patches/libtool.m4-shared.patch
+#
+# End of Libtool.
+################################################################
+
+
+aclocal --install -I m4 --force --system-acdir=${SYSTEM_ACDIR} || exit 1
+autoheader --include=${SYSTEM_INCDIR} || exit 1
+automake --gnu --add-missing --copy --force-missing || exit 1
+autoconf --force || exit 1
+
+
+################################################################
+# Remove cache and backup files:
+#
+rm -rf autom4te.cache *~ cpu/*~ utils/*~ tests/*~ doc/*~
+find cpu/sysdeps -type f -name '*~' -delete 2>/dev/null || true
+#
+# End of Cleanup.
+################################################################