From ddf7d8031fd48324eb24643fdee8dcb99475f5ac Mon Sep 17 00:00:00 2001 From: bauen1 Date: Wed, 5 Jul 2017 20:53:25 +0200 Subject: [PATCH] Fixed lua and nweb bundle --- src/05_prepare_sysroot.sh | 1 + src/minimal_overlay/bundles/lua/01_get.sh | 11 +++---- src/minimal_overlay/bundles/lua/02_build.sh | 36 ++++++++------------- src/minimal_overlay/bundles/nweb/bundle.sh | 15 +++------ 4 files changed, 23 insertions(+), 40 deletions(-) diff --git a/src/05_prepare_sysroot.sh b/src/05_prepare_sysroot.sh index e1fa1e973..501f1e7ea 100755 --- a/src/05_prepare_sysroot.sh +++ b/src/05_prepare_sysroot.sh @@ -8,6 +8,7 @@ cd work echo "Cleaning existing sysroot. This may take a while..." rm -rf sysroot +rm -rf sysroot.specs echo "Preparing glibc. This may take a while..." cp -r glibc/glibc_installed sysroot diff --git a/src/minimal_overlay/bundles/lua/01_get.sh b/src/minimal_overlay/bundles/lua/01_get.sh index 1891f4c2f..b9182c5d3 100755 --- a/src/minimal_overlay/bundles/lua/01_get.sh +++ b/src/minimal_overlay/bundles/lua/01_get.sh @@ -2,10 +2,7 @@ SRC_DIR=$(pwd) -# Find the main source directory -cd ../../.. -MAIN_SRC_DIR=$(pwd) -cd $SRC_DIR +. ../../common.sh # Grab everything after the '=' character. DOWNLOAD_URL=$(grep -i LUA_SOURCE_URL $MAIN_SRC_DIR/.config | cut -f2 -d'=') @@ -33,11 +30,11 @@ fi # Delete folder with previously extracted Lua. echo "Removing Lua work area. This may take a while..." -rm -rf ../../work/overlay/lua -mkdir ../../work/overlay/lua +rm -rf $WORK_DIR/overlay/lua +mkdir $WORK_DIR/overlay/lua # Extract lua to folder 'work/overlay/lua'. # Full path will be something like 'work/overlay/lua/lua-5.3.4'. -tar -xvf $ARCHIVE_FILE -C ../../work/overlay/lua +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/lua cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/lua/02_build.sh b/src/minimal_overlay/bundles/lua/02_build.sh index 9169d6a43..088c1b141 100755 --- a/src/minimal_overlay/bundles/lua/02_build.sh +++ b/src/minimal_overlay/bundles/lua/02_build.sh @@ -4,42 +4,32 @@ SRC_DIR=$(pwd) -# Find the main source directory -cd ../../.. -MAIN_SRC_DIR=$(pwd) -cd $SRC_DIR +. ../../common.sh -# Read the 'JOB_FACTOR' property from '.config' -JOB_FACTOR="$(grep -i ^JOB_FACTOR $MAIN_SRC_DIR/.config | cut -f2 -d'=')" +cd $WORK_DIR/overlay/lua -# Read the 'CFLAGS' property from '.config' -CFLAGS="$(grep -i ^CFLAGS $MAIN_SRC_DIR/.config | cut -f2 -d'=')" - -# Find the number of available CPU cores. -NUM_CORES=$(grep ^processor /proc/cpuinfo | wc -l) - -# Calculate the number of 'make' jobs to be used later. -NUM_JOBS=$((NUM_CORES * JOB_FACTOR)) - -cd $MAIN_SRC_DIR/work/overlay/lua +DESTDIR="$PWD/lua_installed" # Change to the Lua source directory which ls finds, e.g. 'lua-5.3.4'. cd $(ls -d lua-*) echo "Preparing Lua work area. This may take a while..." -make clean -j $NUM_JOBS 2>/dev/null -rm -rf ../lua_installed +# we install lua to /usr and not to /usr/local so we need to fix luaconf.h so lua can find modules, etc ... +sed -i 's/#define LUA_ROOT.*/#define LUA_ROOT \"\/usr\/\"/' src/luaconf.h +make -j $NUM_JOBS clean +rm -rf $DESTDIR echo "Building Lua..." -make posix -j $NUM_JOBS CFLAGS="$CFLAGS --sysroot=$MAIN_SRC_DIR/work/glibc/glibc_prepared/" +make -j $NUM_JOBS posix CC="$CC" CFLAGS="$CFLAGS" -make install -j $NUM_JOBS INSTALL_TOP=../../lua_installed/usr +make -j $NUM_JOBS install INSTALL_TOP="$DESTDIR/usr" echo "Reducing Lua size..." -strip -g ../lua_installed/bin/* 2>/dev/null +strip -g $DESTDIR/usr/bin/* 2>/dev/null -mkdir -p $MAIN_SRC_DIR/work/src/minimal_overlay/rootfs/usr/ -cp -r ../lua_installed/usr/* $MAIN_SRC_DIR/work/src/minimal_overlay/rootfs/usr +ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" +mkdir -p $ROOTFS/usr/ +cp -r $DESTDIR/usr/* $ROOTFS/usr/ echo "Lua has been installed." diff --git a/src/minimal_overlay/bundles/nweb/bundle.sh b/src/minimal_overlay/bundles/nweb/bundle.sh index 41e54f975..af909b8c6 100755 --- a/src/minimal_overlay/bundles/nweb/bundle.sh +++ b/src/minimal_overlay/bundles/nweb/bundle.sh @@ -4,21 +4,16 @@ SRC_DIR=$(pwd) . ../../common.sh -# Find the main source directory -cd ../../.. -MAIN_SRC_DIR=$(pwd) -cd $SRC_DIR - echo "removing previous work area" -rm -rf $MAIN_SRC_DIR/work/overlay/nweb -mkdir -p $MAIN_SRC_DIR/work/overlay/nweb -cd $MAIN_SRC_DIR/work/overlay/nweb +rm -rf $WORK_DIR/overlay/nweb +mkdir -p $WORK_DIR/overlay/nweb +cd $WORK_DIR/overlay/nweb # nweb -${CC-gcc} $CFLAGS $SRC_DIR/nweb23.c -o nweb +$CC $CFLAGS $LDFLAGS $SRC_DIR/nweb23.c -o nweb # client -#${CC-gcc} $CFLAGS $SRC_DIR/client.c -o client +#$CC $CFLAGS $LDFLAGS $SRC_DIR/client.c -o client echo "nweb has been build."