From f8cfd22965fa48be40ad7387ea6f2482c23dcce5 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Sun, 26 Nov 2017 19:43:50 +0100 Subject: [PATCH] Added make bundle --- src/.config | 6 +++ src/minimal_overlay/bundles/make/01_get.sh | 41 ++++++++++++++++++++ src/minimal_overlay/bundles/make/02_build.sh | 38 ++++++++++++++++++ src/minimal_overlay/bundles/make/bundle.sh | 8 ++++ 4 files changed, 93 insertions(+) create mode 100755 src/minimal_overlay/bundles/make/01_get.sh create mode 100755 src/minimal_overlay/bundles/make/02_build.sh create mode 100755 src/minimal_overlay/bundles/make/bundle.sh diff --git a/src/.config b/src/.config index 1b2837fb6..9322121e7 100644 --- a/src/.config +++ b/src/.config @@ -109,6 +109,12 @@ LINKS_SOURCE_URL=http://links.twibright.com/download/links-2.14.tar.bz2 # LUA_SOURCE_URL=https://www.lua.org/ftp/lua-5.3.4.tar.gz +# You can find the latest make source bundles here: +# +# http://www.gnu.org/software/make +# +MAKE_SOURCE_URL=ftp://ftp.gnu.org/gnu/make/make-4.2.1.tar.bz2 + # You can find the latest nano source bundles here: # # https://nano-editor.org/download.php diff --git a/src/minimal_overlay/bundles/make/01_get.sh b/src/minimal_overlay/bundles/make/01_get.sh new file mode 100755 index 000000000..dda550e40 --- /dev/null +++ b/src/minimal_overlay/bundles/make/01_get.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +# Grab everything after the '=' character. +DOWNLOAD_URL=$(grep -i MAKE_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 make source bundle file. The '-c' option allows the download to resume. + echo "Downloading make source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local make source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted make. +echo "Removing make work area. This may take a while..." +rm -rf $WORK_DIR/overlay/make +mkdir $WORK_DIR/overlay/make + +# Extract make to folder 'work/overlay/make'. +# Full path will be something like 'work/overlay/make/make-8.28'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/make + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/make/02_build.sh b/src/minimal_overlay/bundles/make/02_build.sh new file mode 100755 index 000000000..2ac78f257 --- /dev/null +++ b/src/minimal_overlay/bundles/make/02_build.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +cd $WORK_DIR/overlay/make + +DESTDIR="$PWD/make_installed" + +# Change to the make source directory which ls finds, e.g. 'make-8.28'. +cd $(ls -d make-*) + +echo "Preparing make work area. This may take a while..." +make -j $NUM_JOBS clean + +rm -rf $DESTDIR + +echo "Configuring make..." +CFLAGS="$CFLAGS" ./configure \ + --prefix=/usr + +echo "Building make..." +make -j $NUM_JOBS + +echo "Installing make..." +make -j $NUM_JOBS install DESTDIR=$DESTDIR + +echo "Reducing make size..." +strip -g $DESTDIR/usr/bin/* + +ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" + +cp -r $DESTDIR/* $ROOTFS + +echo "make has been installed." + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/make/bundle.sh b/src/minimal_overlay/bundles/make/bundle.sh new file mode 100755 index 000000000..cbf2c5338 --- /dev/null +++ b/src/minimal_overlay/bundles/make/bundle.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +./01_get.sh +./02_build.sh + +cd $SRC_DIR