aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lh-config.dist6
-rwxr-xr-xmake12
-rwxr-xr-xsub/layout/copylayout11
-rw-r--r--sub/skarnet.org/Makefile2
4 files changed, 22 insertions, 9 deletions
diff --git a/lh-config.dist b/lh-config.dist
index 0905191..1972a88 100644
--- a/lh-config.dist
+++ b/lh-config.dist
@@ -20,6 +20,12 @@ NORMALUSER=nobody
# By default, it will be true for musl toolchains, false for glibc toolchains.
# BUILD_HOST_STATIC=false
+# Whether or not you want to copy the shared libc from the toolchain.
+# By default, the shared libs are copied if the build isn't static.
+# You can also optionally manually specify the sysroot to copy the libs from.
+# LIBC_COPY=
+# LIBC_SYSROOT=
+
# Filesystems size, as understood by libguestfs's virt-make-fs
ROOTFS_SIZE=1024M
RWFS_SIZE=512M
diff --git a/make b/make
index 965caa3..9aef9bb 100755
--- a/make
+++ b/make
@@ -22,7 +22,7 @@ BUILD_HOST_CC="$TRIPLE-${CROSS_CC:-gcc}"
ROOTFS_SIZE=${ROOTFS_SIZE:-1024M}
RWFS_SIZE=${RWFS_SIZE:-512M}
USERFS_SIZE=${USERFS_SIZE:-512M}
-
+LIBC_SYSROOT=${LIBC_SYSROOT:-$(${BUILD_HOST_CC} -print-sysroot)}
if test -z "$BUILD_HOST_STATIC" ; then
case "$TRIPLE" in
@@ -31,6 +31,13 @@ if test -z "$BUILD_HOST_STATIC" ; then
esac
fi
+if test -z "$LIBC_COPY" ; then
+ case "$BUILD_HOST_STATIC" in
+ true) LIBC_COPY=false ;;
+ *) LIBC_COPY=true ;;
+ esac
+fi
+
if test -n "$CROSS_BASE" ; then
crossenv=""
else
@@ -57,7 +64,8 @@ PATH="$WD/bin:$OUTPUT/build-build/command:$OUTPUT/build-build/bin:$OUTPUT/build-
umask 022
exec env -i $crossenv LH_MAKE_MARKER=1 "WD=$WD" "NORMALUSER=$NORMALUSER" "TRIPLE=$TRIPLE" "OUTPUT=$OUTPUT" "PATH=$PATH" \
- "ROOTFS_SIZE=$ROOTFS_SIZE" "RWFS_SIZE=$RWFS_SIZE" "USERFS_SIZE=$USERFS_SIZE" BUILD_HOST_STATIC="$BUILD_HOST_STATIC" \
+ "ROOTFS_SIZE=$ROOTFS_SIZE" "RWFS_SIZE=$RWFS_SIZE" "USERFS_SIZE=$USERFS_SIZE" \
+ "BUILD_HOST_STATIC=$BUILD_HOST_STATIC" "LIBC_SYSROOT=$LIBC_SYSROOT" "LIBC_COPY=$LIBC_COPY" \
"BUILD_HOST_CC=$BUILD_HOST_CC" "BUILD_HOST_CC_FULL=$BUILD_HOST_CC_FULL" "BUILD_HOST_SYSROOT=$BUILD_HOST_SYSROOT" "BUILD_HOST_PREFIX=$BUILD_HOST_PREFIX" \
"KERNEL_ARCH=$KERNEL_ARCH" "KERNEL_GENERIC_ARCH=$KERNEL_GENERIC_ARCH" "QEMU_ARCH=$QEMU_ARCH" "KERNEL_CONFIG=$KERNEL_CONFIG" \
"BUILD_BUILD_CC=$BUILD_BUILD_CC" SHELL=/bin/sh "CONSOLE=$CONSOLE" \
diff --git a/sub/layout/copylayout b/sub/layout/copylayout
index 01e1574..91f901f 100755
--- a/sub/layout/copylayout
+++ b/sub/layout/copylayout
@@ -3,12 +3,12 @@
output="$1"
s6-hiercopy layout/rootfs $output/rootfs
-chown -R 0:0 $output/rootfs $output/rwfs $output/userfs
find "$output/rootfs" -type f -name .empty -size 0c -exec s6-rmrf {} \;
s6-hiercopy layout/rwfs $output/rwfs
find "$output/rwfs" -type f -name .empty -size 0c -exec s6-rmrf {} \;
s6-hiercopy layout/userfs $output/userfs
find "$output/userfs" -type f -name .empty -size 0c -exec s6-rmrf {} \;
+chown -R 0:0 $output/rootfs $output/rwfs $output/userfs
buildtime=$(s6-clock)
@@ -24,13 +24,12 @@ done < sub/layout/permissions
# If dynamic: copy shared libs from the toolchain into the target
-if ! ${BUILD_HOST_STATIC} ; then
- sysroot=`${BUILD_HOST_CC} -print-sysroot`
+if ${LIBC_COPY} ; then
for lib in lib lib32 lib64 ; do
- if s6-test -d "$sysroot/$lib" ; then
+ if s6-test -d "$LIBC_SYSROOT/$lib" ; then
s6-mkdir -p "$output/rootfs/$lib"
- for i in `ls -1 "$sysroot/$lib" | grep -e '\.so$' -e '\.so\.'` ; do
- s6-hiercopy "$sysroot/$lib/$i" "$output/rootfs/$lib/$i"
+ for i in `ls -1 "$LIBC_SYSROOT/$lib" | grep -e '\.so$' -e '\.so\.'` ; do
+ s6-hiercopy "$LIBC_SYSROOT/$lib/$i" "$output/rootfs/$lib/$i"
done
fi
done
diff --git a/sub/skarnet.org/Makefile b/sub/skarnet.org/Makefile
index 1e44fe0..fa67b31 100644
--- a/sub/skarnet.org/Makefile
+++ b/sub/skarnet.org/Makefile
@@ -16,7 +16,7 @@ S6_LINUX_INIT_VERSION := 6a1207350d876659296c6aab7cd1063bbb3d0ed1
MDEVD_VERSION := 7430c9be1d379ae1eb0626ec67968b6edcfbf7d6
BCNM_VERSION := fe28e76256c4ff7d1af53ad3940bf737f6000107
-SKARNET_CONF_STATIC := $(if $(filter true,$(BUILD_HOST_STATIC)),--enable-static-libc,--enable-shared --disable-allstatic)
+SKARNET_CONF_STATIC := $(if $(filter true,$(BUILD_HOST_STATIC)),--disable-shared --enable-static-libc,--enable-shared --disable-allstatic)
SKALIBS_FIND_OPTIONS := --with-sysdeps=$(OUTPUT)/rootfs/package/prog/skalibs/sysdeps --with-include=$(OUTPUT)/rootfs/package/prog/skalibs/include --with-lib=$(OUTPUT)/rootfs/package/prog/skalibs/library --with-dynlib=$(OUTPUT)/rootfs/package/prog/skalibs/library.so
EXECLINE_FIND_OPTIONS := --with-include=$(OUTPUT)/rootfs/package/admin/execline/include --with-lib=$(OUTPUT)/rootfs/package/admin/execline/library --with-dynlib=$(OUTPUT)/rootfs/package/admin/execline/library.so
S6_FIND_OPTIONS := --with-include=$(OUTPUT)/rootfs/package/admin/s6/include --with-lib=$(OUTPUT)/rootfs/package/admin/s6/library --with-dynlib=$(OUTPUT)/rootfs/package/admin/s6/library.so