Merge pull request #89 from TechnologyClassroom/ncurses

ncurses overlay
This commit is contained in:
Ivan Davidov 2017-11-13 20:58:33 +02:00 committed by GitHub
commit dd4ef8e4c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 122 additions and 2 deletions

View File

@ -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

View File

@ -52,7 +52,7 @@ Currently available overlay bundles:
to the "JAVA_ARCHIVE" property in the ".config" file for more
detailed information.
This overlay bundle requires GLIBC.
This overlay bundle requires GLIBC. JDK 9 requires ZLIB.
* Open JDK - The open source JDK. No need for manual steps.
@ -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, it is run automatically on port 80
to portforward port 80 from the guest (minimal) to port 8080 on the host add
'-net nic,model=e1000 -net user,hostfwd=tcp::8080-:80' to 'cmd' in qemu.sh
@ -81,6 +83,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.
### ### ###
I only provide the build scripts. It's entirely up to you to configure and

View File

@ -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

View File

@ -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

View File

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