From 766c6a071aa5a539f24498a7392b9043183e44e3 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 13:28:47 -0500 Subject: [PATCH 1/4] Update .config --- src/.config | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/.config b/src/.config index c39c017bb..d3ece837e 100644 --- a/src/.config +++ b/src/.config @@ -73,6 +73,12 @@ FELIX_SOURCE_URL=http://archive.apache.org/dist/felix/org.apache.felix.main.dist # LUA_SOURCE_URL=https://www.lua.org/ftp/lua-5.3.4.tar.gz +# You can find the latest ncurses archives here: +# +# https://ftp.gnu.org/pub/gnu/ncurses/ +# +NCURSES_SOURCE_URL=https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz + # You can find the latest static-get shell script here: # # http://s.minos.io/s @@ -188,6 +194,7 @@ COPY_SOURCE_ISO=true # openjdk - installs Open JDK. All operations are automated. # felix - Apache Felix OSGi framework. # mll_utils - set of executable utilities (mll-*). +# ncurses - "GUI-like" API that runs within a terminal emulator # lua - scripting language # static_get - portable binaries for Linux (http://s.minos.io) # cf_cli - CLoud Foundry CLI (command line interface) @@ -198,7 +205,7 @@ COPY_SOURCE_ISO=true # # Refer to the README file for more information. # -#OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix,mll_utils,lua,static_get,cf_cli,nweb,dhcp +#OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix,mll_utils,lua,static_get,cf_cli,ncurses,util_linux,nweb,dhcp #OVERLAY_BUNDLES=dhcp,glibc_full,zlib,openjdk,felix,links # This property enables the standard penguin boot logo in the upper left corner From 5cbd642f3029f99d87f964fb7f89c75612d4cd52 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 13:30:20 -0500 Subject: [PATCH 2/4] Update README --- src/README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/README b/src/README index a53b54655..4df9039d0 100644 --- a/src/README +++ b/src/README @@ -72,6 +72,8 @@ Currently available overlay bundles: * Lua - The Lua Scripting Language 5.3. Requires ~ 800kb additional space. Use the "lua" command to run an interactive lua interpreter +* ncurses - "GUI-like" API that runs within a terminal emulator + * nweb - nweb is a very small and easy to use webserver run it using 'nweb 80 /srv/www' to portforward port 8080 on the host to port 80 on the guest (minimal) @@ -82,6 +84,8 @@ Currently available overlay bundles: * util_linux - util-linux is a standard package distributed by the Linux Kernel Organization similar to busybox or GNU Core Utils. + + Some packages in this overlay bundle require ncurses. ### ### ### From 926ae93d03854b7ee9de466f11e5174a1c9856f2 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 13:35:00 -0500 Subject: [PATCH 3/4] Add files via upload --- src/minimal_overlay/bundles/ncurses/01_get.sh | 40 +++++++++++++ .../bundles/ncurses/02_build.sh | 60 +++++++++++++++++++ src/minimal_overlay/bundles/ncurses/bundle.sh | 9 +++ 3 files changed, 109 insertions(+) create mode 100644 src/minimal_overlay/bundles/ncurses/01_get.sh create mode 100644 src/minimal_overlay/bundles/ncurses/02_build.sh create mode 100644 src/minimal_overlay/bundles/ncurses/bundle.sh diff --git a/src/minimal_overlay/bundles/ncurses/01_get.sh b/src/minimal_overlay/bundles/ncurses/01_get.sh new file mode 100644 index 000000000..3d0315215 --- /dev/null +++ b/src/minimal_overlay/bundles/ncurses/01_get.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +. ../../common.sh + +# Grab everything after the '=' character. +DOWNLOAD_URL=$(grep -i NCURSES_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 ncurses source bundle file. The '-c' option allows the download to resume. + echo "Downloading ncurses source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local ncurses source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted ncurses. +echo "Removing ncurses work area. This may take a while..." +rm -rf $WORK_DIR/overlay/ncurses +mkdir $WORK_DIR/overlay/ncurses + +# Extract ncurses to folder 'work/overlay/ncurses'. +# Full path will be something like 'work/overlay/ncurses/ncurses-6.0'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/ncurses + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/ncurses/02_build.sh b/src/minimal_overlay/bundles/ncurses/02_build.sh new file mode 100644 index 000000000..f1bfef294 --- /dev/null +++ b/src/minimal_overlay/bundles/ncurses/02_build.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +cd $WORK_DIR/overlay/ncurses + +DESTDIR="$PWD/ncurses_installed" + +# Change to the ncurses source directory which ls finds, e.g. 'ncurses-6.0'. +cd $(ls -d ncurses-*) + +echo "Preparing ncurses work area. This may take a while..." +make -j $NUM_JOBS clean + +rm -rf $DESTDIR + +# Remove static library +sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in +# http://www.linuxfromscratch.org/lfs/view/development/chapter06/ncurses.html + +# Configure Ncurses +echo "Configuring Ncurses..." +./configure \ + --prefix=/usr \ + --with-termlib \ + --with-shared \ + --with-terminfo-dirs=/lib/terminfo \ + --with-default-terminfo-dirs=/lib/terminfo \ + --without-normal \ + --without-debug \ + --without-cxx-binding \ + --with-abi-version=5 \ + CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE" \ + CPPFLAGS="-P" + +# Most configuration switches are from AwlsomeAlex +# https://github.com/AwlsomeAlex/AwlsomeLinux/blob/59d59730703b058081a2371076a807590cacb31e/src/overlay_ncurses.sh + +# CPPFLAGS fixes a bug with Ubuntu 16.04 +# https://trac.sagemath.org/ticket/19762 + +echo "Building ncurses..." +make -j $NUM_JOBS + +echo "Installing ncurses..." +make -j $NUM_JOBS install DESTDIR=$DESTDIR + +echo "Reducing ncurses size..." +strip -g $DESTDIR/usr/bin/* + +ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" + +cp -r $DESTDIR/usr/* $ROOTFS + +echo "ncurses has been installed." + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/ncurses/bundle.sh b/src/minimal_overlay/bundles/ncurses/bundle.sh new file mode 100644 index 000000000..6284178ab --- /dev/null +++ b/src/minimal_overlay/bundles/ncurses/bundle.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +time sh 01_get.sh +time sh 02_build.sh + +cd $SRC_DIR + From 450e321484d503e9cc947b85f3e104f52de8c85a Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 13:58:24 -0500 Subject: [PATCH 4/4] Update README --- src/README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/README b/src/README index af0d9f2fc..5db6a2088 100644 --- a/src/README +++ b/src/README @@ -72,7 +72,7 @@ Currently available overlay bundles: * Lua - The Lua Scripting Language 5.3. Requires ~ 800kb additional space. Use the "lua" command to run an interactive lua interpreter -* ncurses - "GUI-like" API that runs within a terminal emulator +* ncurses - 'GUI-like' API that runs within a terminal emulator * nweb - nweb is a very small and easy to use webserver, it is run automatically on port 80 to portforward port 80 from the guest (minimal) to port 8080 on the host add @@ -82,7 +82,7 @@ Currently available overlay bundles: * util_linux - util-linux is a standard package distributed by the Linux Kernel Organization similar to busybox or GNU Core Utils. - + Some packages in this overlay bundle require ncurses. ### ### ###