Fixed links

This commit is contained in:
bauen1 2017-07-05 21:13:35 +02:00
parent ddf7d8031f
commit c3dffc8c41
2 changed files with 19 additions and 37 deletions

View File

@ -2,10 +2,7 @@
SRC_DIR=$(pwd) SRC_DIR=$(pwd)
# Find the main source directory . ../../common.sh
cd ../../..
MAIN_SRC_DIR=$(pwd)
cd $SRC_DIR
# Grab everything after the '=' character. # Grab everything after the '=' character.
DOWNLOAD_URL=$(grep -i LINKS_SOURCE_URL $MAIN_SRC_DIR/.config | cut -f2 -d'=') DOWNLOAD_URL=$(grep -i LINKS_SOURCE_URL $MAIN_SRC_DIR/.config | cut -f2 -d'=')
@ -33,12 +30,12 @@ fi
# Delete folder with previously extracted Links. # Delete folder with previously extracted Links.
echo "Removing Links work area. This may take a while..." echo "Removing Links work area. This may take a while..."
rm -rf ../../work/overlay/links rm -rf $WORK_DIR/overlay/links
mkdir ../../work/overlay/links mkdir $WORK_DIR/overlay/links
# Extract Links to folder 'work/overlay/links'. # Extract Links to folder 'work/overlay/links'.
# Full path will be something like 'work/overlay/links/links-2.12'. # Full path will be something like 'work/overlay/links/links-2.12'.
tar -xvf $ARCHIVE_FILE -C ../../work/overlay/links tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/links
cd $SRC_DIR cd $SRC_DIR

View File

@ -2,57 +2,42 @@
SRC_DIR=$(pwd) SRC_DIR=$(pwd)
# Find the main source directory . ../../common.sh
cd ../../..
MAIN_SRC_DIR=$(pwd)
cd $SRC_DIR
# Read the 'JOB_FACTOR' property from '.config' cd $WORK_DIR/overlay/links
JOB_FACTOR="$(grep -i ^JOB_FACTOR $MAIN_SRC_DIR/.config | cut -f2 -d'=')"
# Read the 'CFLAGS' property from '.config' DESTDIR="$PWD/links_installed"
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/links
# Change to the Links source directory which ls finds, e.g. 'links-2.12'. # Change to the Links source directory which ls finds, e.g. 'links-2.12'.
cd $(ls -d links-*) cd $(ls -d links-*)
echo "Preparing Links work area. This may take a while..." echo "Preparing Links work area. This may take a while..."
make clean -j $NUM_JOBS 2>/dev/null # distclean to also clear configure files
make -j $NUM_JOBS distclean
rm -rf ../links_installed rm -rf $DESTDIR
echo "Configuring Links..." echo "Configuring Links..."
./configure \ CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" ./configure \
--prefix=../links_installed \ --prefix=/usr \
--disable-graphics \ --disable-graphics \
--disable-utf8 \ --disable-utf8 \
--without-ipv6 \ --without-ipv6 \
--without-ssl \ --without-ssl
--without-zlib \
--without-x
# Set CFLAGS directly in Makefile.
sed -i "s/^CFLAGS = .*/CFLAGS = $CFLAGS/" Makefile
echo "Building Links..." echo "Building Links..."
make -j $NUM_JOBS make -j $NUM_JOBS
echo "Installing Links..." echo "Installing Links..."
make install -j $NUM_JOBS make -j $NUM_JOBS install DESTDIR=$DESTDIR
echo "Reducing Links size..." echo "Reducing Links size..."
strip -g ../links_installed/bin/* 2>/dev/null strip -g $DESTDIR/usr/bin/*
cp -r ../links_installed/bin \ ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs"
$MAIN_SRC_DIR/work/src/minimal_overlay/rootfs
mkdir -p "$ROOTFS/usr/bin"
cp -r $DESTDIR/usr/bin/* $ROOTFS/usr/bin/
echo "Links has been installed." echo "Links has been installed."