Added a lua overlay bundle

This commit is contained in:
bauen1 2017-02-10 16:57:33 +01:00
parent 795a3d3553
commit 8db6dff74a
No known key found for this signature in database
GPG Key ID: FF0AAF5E0812BA9C
4 changed files with 104 additions and 0 deletions

View File

@ -67,6 +67,13 @@ FELIX_SOURCE_URL=http://www-us.apache.org/dist/felix/org.apache.felix.main.distr
#JAVA_ARCHIVE=/absolute/path/to/java.archive.tar.gz
#JAVA_ARCHIVE=/home/ivan/Downloads/jdk-8u111-linux-x64.tar.gz
# You can find the latest Lua source bundes here:
#
# https://www.lua.org/ftp/
#
LUA_SOURCE_URL=https://www.lua.org/ftp/lua-5.3.4.tar.gz
####################################################

View File

@ -0,0 +1,43 @@
#!/bin/sh
SRC_DIR=$(pwd)
# Find the main source directory
cd ../../..
MAIN_SRC_DIR=$(pwd)
cd $SRC_DIR
# Grab everything after the '=' character.
DOWNLOAD_URL=$(grep -i LUA_SOURCE_URL $MAIN_SRC_DIR/.config | cut -f2 -d'=')
# Grab everything after the last '/' character.
ARCHIVE_FILE=${DOWNLOAD_URL##*/}
# Read the 'USE_LOCAL_SOURCE' property from '.config'
USE_LOCAL_SOURCE="$(grep -i USE_LOCAL_SOURCE $MAIN_SRC_DIR/.config | cut -f2 -d'=')"
if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE ] ; then
echo "Source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE is missing and will be downloaded."
USE_LOCAL_SOURCE="false"
fi
cd $MAIN_SRC_DIR/source/overlay
if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then
# Downloading the Lua bundle file. The '-c' option allows the download to resume.
echo "Downloading the Lua source bundle from $DOWNLOAD_URL"
wget -c $DOWNLOAD_URL
else
echo "Using local Lua source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE"
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
# 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
cd $SRC_DIR

View File

@ -0,0 +1,46 @@
#!/bin/sh
# TODO: compile the gnu readline library for line editing support
SRC_DIR=$(pwd)
# Find the main source directory
cd ../../..
MAIN_SRC_DIR=$(pwd)
cd $SRC_DIR
# Read the 'JOB_FACTOR' property from '.config'
JOB_FACTOR="$(grep -i ^JOB_FACTOR $MAIN_SRC_DIR/.config | cut -f2 -d'=')"
# 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
# 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
echo "Building Lua..."
make generic -j $NUM_JOBS CFLAGS="$CFLAGS --sysroot=$MAIN_SRC_DIR/work/glibc/glibc_prepared/"
make install -j $NUM_JOBS INSTALL_TOP=../../lua_installed/usr/local
echo "Reducing Lua size..."
strip -g ../lua_installed/usr/local/bin/* 2>/dev/null
mkdir -p $MAIN_SRC_DIR/work/src/minimal_overlay/rootfs/usr/local
cp -r ../lua_installed/usr/local/* $MAIN_SRC_DIR/work/src/minimal_overlay/rootfs/usr/local
echo "Lua has been installed."
cd $SRC_DIR

View File

@ -0,0 +1,8 @@
#!/bin/sh
SRC_DIR=$(pwd)
time sh 01_get.sh
time sh 02_build.sh
cd $SRC_DIR