Merge pull request #92 from TechnologyClassroom/nano

nano bundle
This commit is contained in:
Ivan Davidov 2017-11-14 17:11:45 +02:00 committed by GitHub
commit 401eafe17b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 110 additions and 3 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 nano source bundles here:
#
# https://nano-editor.org/download.php
#
NANO_SOURCE_URL=https://nano-editor.org/dist/v2.8/nano-2.8.7.tar.xz
# You can find the latest ncurses archives here:
#
# https://ftp.gnu.org/pub/gnu/ncurses/
@ -199,6 +205,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-*).
# nano - GNU nano is an enhanced clone of the Pico text editor
# ncurses - "GUI-like" API that runs within a terminal emulator
# lua - scripting language
# static_get - portable binaries for Linux (http://s.minos.io)
@ -210,7 +217,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,ncurses,util_linux,nweb,dhcp
#OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix,mll_utils,nano,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

@ -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
* nano - GNU nano is an enhanced clone of the Pico text editor
* 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

View File

@ -0,0 +1,40 @@
#!/bin/bash
SRC_DIR=$(pwd)
. ../../common.sh
# Grab everything after the '=' character.
DOWNLOAD_URL=$(grep -i NANO_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 nano source bundle file. The '-c' option allows the download to resume.
echo "Downloading nano source bundle from $DOWNLOAD_URL"
wget -c $DOWNLOAD_URL
else
echo "Using local nano source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE"
fi
# Delete folder with previously extracted nano.
echo "Removing nano work area. This may take a while..."
rm -rf $WORK_DIR/overlay/nano
mkdir $WORK_DIR/overlay/nano
# Extract nano to folder 'work/overlay/nano'.
# Full path will be something like 'work/overlay/nano/nano-2.8.7'.
tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/nano
cd $SRC_DIR

View File

@ -0,0 +1,40 @@
#!/bin/bash
SRC_DIR=$(pwd)
. ../../common.sh
cd $WORK_DIR/overlay/nano
DESTDIR="$PWD/nano_installed"
# Change to the nano source directory which ls finds, e.g. 'nano-2.8.7'.
cd $(ls -d nano-*)
echo "Preparing nano work area. This may take a while..."
make -j $NUM_JOBS clean
rm -rf $DESTDIR
echo "Configuring nano..."
CFLAGS="$CFLAGS" ./configure \
--prefix=/usr
--disable-utf8 \
CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE"
echo "Building nano..."
make -j $NUM_JOBS
echo "Installing nano..."
make -j $NUM_JOBS install DESTDIR=$DESTDIR
echo "Reducing nano size..."
strip -g $DESTDIR/usr/bin/*
ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs"
cp -r $DESTDIR/* $ROOTFS
echo "nano has been installed."
cd $SRC_DIR

View File

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

View File

@ -25,13 +25,17 @@ 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 \
--enable-widec \
--enable-pc-files \
--with-shared \
CPPFLAGS=-I$PWD/ncurses/widechar \
LDFLAGS=-L$PWD/lib \
CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE" \
CPPFLAGS="-P"
@ -47,6 +51,13 @@ make -j $NUM_JOBS
echo "Installing ncurses..."
make -j $NUM_JOBS install DESTDIR=$DESTDIR
# Symnlink wide character libraries
cd $DESTDIR/usr/lib
ln -s libncursesw.so.5 libncurses.so.5
ln -s libncurses.so.5 libncurses.so
ln -s libtinfow.so.5 libtinfo.so.5
ln -s libtinfo.so.5 libtinfo.so
echo "Reducing ncurses size..."
strip -g $DESTDIR/usr/bin/*
@ -57,4 +68,3 @@ cp -r $DESTDIR/usr/* $ROOTFS
echo "ncurses has been installed."
cd $SRC_DIR