2022-04-22 19:35:02 -04:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2022-04-23 14:14:21 -04:00
|
|
|
# shell script menus for elinks binaries building
|
2022-04-22 19:35:02 -04:00
|
|
|
#
|
|
|
|
|
|
|
|
clear
|
|
|
|
|
2022-04-30 14:49:56 -04:00
|
|
|
echo ' --/ \--'
|
|
|
|
echo ' --[ Welcome to the elinks build helper ]--'
|
|
|
|
echo ' --[ ]--'
|
|
|
|
echo ' --[ [*] use option 1 to change arch ]--'
|
|
|
|
echo ' --[ [*] use option 4 to config and make ]--'
|
|
|
|
echo ' --[ [*] use option 5 for config ]--'
|
|
|
|
echo ' --[ [*] use option 6 for make ]--'
|
|
|
|
echo ' --[ [*] use option 7 for test ]--'
|
|
|
|
echo ' --[ [*] use option 8 for publishing ]--'
|
|
|
|
echo ' --\ /--'
|
2022-04-22 19:35:02 -04:00
|
|
|
echo ' '
|
|
|
|
|
|
|
|
gen_conf() {
|
|
|
|
./autogen.sh
|
|
|
|
}
|
|
|
|
|
|
|
|
configure() {
|
|
|
|
echo "--[ Configure starts in 2 seconds ]--"
|
|
|
|
echo "--[ Compiler: " $1 "]--"
|
|
|
|
echo "--[ Host : " $2 "]--"
|
|
|
|
sleep 2
|
|
|
|
rm -f config.cache
|
2022-04-23 14:14:21 -04:00
|
|
|
# Thanks rkd77 for discovery of jemmaloc needed
|
|
|
|
# to correct openssl functionality
|
|
|
|
# LIBS="-ljemalloc -lpthread -lm" \
|
2022-04-22 19:35:02 -04:00
|
|
|
time \
|
|
|
|
CC=$1 \
|
|
|
|
LD=$2 \
|
|
|
|
LDFLAGS=$4 \
|
2022-05-03 09:07:28 -04:00
|
|
|
CXX=$CXX_CUST \
|
2022-05-09 12:53:36 -04:00
|
|
|
CFLAGS="-O2 -I/usr/local/include $6" \
|
2022-04-25 14:52:03 -04:00
|
|
|
LIBS=$5 \
|
|
|
|
CXXFLAGS=$6 \
|
2022-04-22 19:35:02 -04:00
|
|
|
PKG_CONFIG="./pkg-config.sh" \
|
|
|
|
./configure -C \
|
|
|
|
--host=$3 \
|
|
|
|
--prefix=/usr \
|
|
|
|
--enable-256-colors \
|
|
|
|
--enable-fastmem \
|
|
|
|
--enable-utf-8 \
|
2022-04-23 14:14:21 -04:00
|
|
|
--with-static \
|
2022-04-30 14:49:56 -04:00
|
|
|
--with-openssl \
|
2022-04-22 19:35:02 -04:00
|
|
|
--without-quickjs \
|
|
|
|
--disable-88-colors \
|
|
|
|
--disable-backtrace \
|
|
|
|
--disable-bittorrent \
|
|
|
|
--disable-debug \
|
|
|
|
--disable-cgi \
|
|
|
|
--disable-combining \
|
2022-04-30 14:49:56 -04:00
|
|
|
--disable-gpm \
|
2022-04-22 19:35:02 -04:00
|
|
|
--disable-gopher \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-ipv6 \
|
|
|
|
--disable-sm-scripting \
|
|
|
|
--disable-true-color \
|
|
|
|
--without-bzlib \
|
|
|
|
--without-brotli \
|
|
|
|
--without-gnutls \
|
|
|
|
--without-libev \
|
|
|
|
--without-libevent \
|
|
|
|
--without-lzma \
|
|
|
|
--without-perl \
|
|
|
|
--without-python \
|
|
|
|
--without-ruby \
|
|
|
|
--without-terminfo \
|
|
|
|
--without-zlib \
|
|
|
|
--without-zstd \
|
|
|
|
--without-x
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "--[ Configuration Sucessfull ]--"
|
|
|
|
# turn off warnings
|
2022-05-09 12:53:36 -04:00
|
|
|
#sed -i 's/-Wall/-w/g' Makefile.config
|
2022-04-22 19:35:02 -04:00
|
|
|
#sed -i 's/-lpthread/-pthread/g' Makefile.config
|
2022-04-23 14:14:21 -04:00
|
|
|
#build
|
|
|
|
return 0
|
2022-04-22 19:35:02 -04:00
|
|
|
else
|
2022-04-23 14:14:21 -04:00
|
|
|
echo "--[ Listing errors in config.log ]--"
|
2022-04-24 03:53:42 -04:00
|
|
|
cat config.log | grep error | tail
|
2022-04-22 19:35:02 -04:00
|
|
|
echo "--[ Configuration failed... ]--"
|
2022-04-23 14:14:21 -04:00
|
|
|
return 1
|
2022-04-22 19:35:02 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# BUILD FUNCTION
|
|
|
|
build() {
|
|
|
|
echo "--[ Build starts in 2 seconds ]--"
|
|
|
|
sleep 2
|
|
|
|
time make # --trace
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "--[ ................ ]--"
|
|
|
|
echo "--[ Build Sucessfull ]--"
|
|
|
|
echo "--[ All Done. ]--"
|
|
|
|
echo "--[ ................ ]--"
|
2022-04-23 14:14:21 -04:00
|
|
|
return 0
|
2022-04-22 19:35:02 -04:00
|
|
|
else
|
|
|
|
echo "--[ Build failed... ]--"
|
2022-04-23 14:14:21 -04:00
|
|
|
return 1
|
2022-04-22 19:35:02 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
test() {
|
|
|
|
#
|
|
|
|
# very basic to test binary
|
|
|
|
# won't core dump
|
|
|
|
#
|
|
|
|
# for arm32: qemu-arm-static
|
2022-04-24 13:55:13 -04:00
|
|
|
# for win64: wineconsole
|
2022-04-22 19:35:02 -04:00
|
|
|
#
|
2022-04-23 08:49:51 -04:00
|
|
|
#./src/elinks$1 \
|
|
|
|
#--no-connect \
|
|
|
|
#--dump \
|
|
|
|
#./test/hello.html
|
|
|
|
# more complete testing
|
2022-04-24 03:53:42 -04:00
|
|
|
./test.sh "$BIN_SUFFIX" "$ARCHIT"
|
2022-04-22 19:35:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
pub() {
|
|
|
|
ls -l ./src/elinks$1
|
|
|
|
file ./src/elinks$1
|
|
|
|
if [ ! -d ../bin ]; then
|
|
|
|
mkdir ../bin
|
|
|
|
fi
|
|
|
|
cp ./src/elinks$1 ../bin/elinks_$2$1
|
|
|
|
echo "--[ File Published to ../bin ]--"
|
|
|
|
}
|
|
|
|
|
|
|
|
info() {
|
|
|
|
echo "--[ binary info ]--"
|
2022-04-25 14:52:03 -04:00
|
|
|
if [ ! -f ../src/elinks$1 ]; then
|
|
|
|
file ./src/elinks$1
|
|
|
|
ls -lh ./src/elinks$1
|
|
|
|
ls -l ./src/elinks$1
|
|
|
|
if [ "$ARCHIT" = "win64" ] || [ "$ARCHIT" = "win32" ]; then
|
|
|
|
wineconsole --backend=ncurses ./src/elinks$1 --version
|
|
|
|
else
|
|
|
|
./src/elinks$1 --version
|
|
|
|
fi
|
2022-04-24 03:53:42 -04:00
|
|
|
else
|
2022-04-25 14:52:03 -04:00
|
|
|
echo "--[*] No binary compiled."
|
2022-04-24 03:53:42 -04:00
|
|
|
fi
|
2022-04-22 19:35:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
set_arch() {
|
2022-04-24 03:53:42 -04:00
|
|
|
if [ "$1" = "lin32" ]; then
|
|
|
|
ARCHIT="$1"
|
|
|
|
CC="i686-linux-gnu-gcc"
|
|
|
|
LD="i686-linux-gnu-ld"
|
|
|
|
MAKE_HOST="i686-linux-gnu"
|
|
|
|
BIN_SUFFIX=""
|
2022-04-25 14:52:03 -04:00
|
|
|
CXXFLAGS=""
|
2022-04-24 03:53:42 -04:00
|
|
|
LDFLAGS=""
|
|
|
|
LIBS=""
|
|
|
|
elif [ "$1" = "lin64" ]; then
|
2022-04-22 19:35:02 -04:00
|
|
|
ARCHIT="$1"
|
|
|
|
CC="x86_64-linux-gnu-gcc"
|
|
|
|
LD="x86_64-linux-gnu-ld"
|
|
|
|
MAKE_HOST="x86_64-linux-gnu"
|
|
|
|
BIN_SUFFIX=""
|
2022-04-25 14:52:03 -04:00
|
|
|
CXXFLAGS=""
|
2022-04-22 19:35:02 -04:00
|
|
|
LDFLAGS=""
|
|
|
|
LIBS=""
|
2022-04-24 03:53:42 -04:00
|
|
|
elif [ "$1" = "win32" ]; then
|
|
|
|
ARCHIT="$1"
|
|
|
|
CC="i686-w64-mingw32-gcc"
|
|
|
|
LD="i686-w64-mingw32-ld"
|
|
|
|
MAKE_HOST="x86_64-w32-mingw32"
|
|
|
|
BIN_SUFFIX=".exe"
|
2022-05-03 09:07:28 -04:00
|
|
|
CXXFLAGS="-I/usr/local/include"
|
|
|
|
CXX_CUST="i686-w64-mingw32-g++"
|
|
|
|
LDFLAGS="-L/usr/local/lib"
|
|
|
|
LIBS="-lws2_32"
|
2022-04-22 19:35:02 -04:00
|
|
|
elif [ "$1" = "win64" ]; then
|
|
|
|
ARCHIT="$1"
|
|
|
|
CC="x86_64-w64-mingw32-gcc"
|
|
|
|
LD="x86_64-w64-mingw32-ld"
|
|
|
|
MAKE_HOST="x86_64-w64-mingw32"
|
|
|
|
BIN_SUFFIX=".exe"
|
2022-04-25 14:52:03 -04:00
|
|
|
CXXFLAGS="-I/usr/local/include"
|
2022-04-30 14:49:56 -04:00
|
|
|
LDFLAGS="-L/usr/local/lib"
|
2022-04-25 14:52:03 -04:00
|
|
|
LIBS="-lws2_32"
|
2022-05-09 12:53:36 -04:00
|
|
|
elif [ "$1" = "djgpp" ]; then
|
|
|
|
ARCHIT="$1"
|
|
|
|
CC="i586-pc-msdosdjgpp-gcc"
|
|
|
|
LD="i586-pc-msdosdjgpp-ld --allow-multiple-definition"
|
|
|
|
MAKE_HOST="i586-pc-msdosdjgpp"
|
|
|
|
BIN_SUFFIX=".exe"
|
|
|
|
CXXFLAGS="-I/usr/local/include -I/home/elinks/.dosemu/drive_c/LINKS/watt32/inc"
|
|
|
|
LDFLAGS="-L/usr/local/lib -L/home/elinks/.dosemu/drive_c/LINKS/watt32/lib"
|
|
|
|
LIBS="-lwatt"
|
2022-04-22 19:35:02 -04:00
|
|
|
elif [ "$1" = "arm32" ]; then
|
|
|
|
ARCHIT="$1"
|
|
|
|
CC="arm-linux-gnueabihf-gcc"
|
|
|
|
LD="arm-linux-gnueabihf-ld"
|
|
|
|
MAKE_HOST="arm-linux-gnu"
|
|
|
|
BIN_SUFFIX=""
|
2022-04-25 14:52:03 -04:00
|
|
|
CXXFLAGS=""
|
2022-04-22 19:35:02 -04:00
|
|
|
LDFLAGS=""
|
|
|
|
LIBS="-L../../lib/$ARCHIT"
|
2022-04-23 14:14:21 -04:00
|
|
|
elif [ "$1" = "arm64" ]; then
|
|
|
|
ARCHIT="$1"
|
|
|
|
CC="aarch64-linux-gnu-gcc"
|
|
|
|
LD="aarch64-linux-gnu-ld"
|
|
|
|
MAKE_HOST="aarch64-linux-gnu"
|
|
|
|
BIN_SUFFIX=""
|
2022-04-25 14:52:03 -04:00
|
|
|
CXXFLAGS=""
|
2022-04-23 14:14:21 -04:00
|
|
|
LDFLAGS=""
|
|
|
|
LIBS="-L../../lib/$ARCHIT"
|
2022-04-22 19:35:02 -04:00
|
|
|
elif [ "$1" = "native" ]; then
|
|
|
|
ARCHIT="$1"
|
|
|
|
CC="gcc"
|
|
|
|
LD="ld"
|
|
|
|
MAKE_HOST=""
|
|
|
|
BIN_SUFFIX=""
|
2022-04-25 14:52:03 -04:00
|
|
|
CXXFLAGS=""
|
2022-04-22 19:35:02 -04:00
|
|
|
LDFLAGS=""
|
|
|
|
LIBS=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-04-23 14:14:21 -04:00
|
|
|
# ARCH SELECTION MENU
|
|
|
|
arch_menu() {
|
2022-05-09 12:53:36 -04:00
|
|
|
MENU_ARCHS="$ARCHS null null null return"
|
2022-04-23 14:14:21 -04:00
|
|
|
echo "[=] Build architecture selection menu"
|
|
|
|
select SEL in $MENU_ARCHS; do
|
|
|
|
echo "[=] Build architecture selection menu"
|
2022-04-24 03:53:42 -04:00
|
|
|
if [ "$SEL" = "lin32" ]; then
|
|
|
|
set_arch "$SEL"
|
|
|
|
elif [ "$SEL" = "lin64" ]; then
|
|
|
|
set_arch "$SEL"
|
2022-04-23 14:14:21 -04:00
|
|
|
elif [ "$SEL" = "win64" ]; then
|
2022-04-24 03:53:42 -04:00
|
|
|
set_arch "$SEL"
|
|
|
|
elif [ "$SEL" = "win32" ]; then
|
|
|
|
set_arch "$SEL"
|
2022-04-23 14:14:21 -04:00
|
|
|
elif [ "$SEL" = "arm32" ]; then
|
2022-04-24 03:53:42 -04:00
|
|
|
set_arch "$SEL"
|
2022-04-23 14:14:21 -04:00
|
|
|
elif [ "$SEL" = "arm64" ]; then
|
2022-04-24 03:53:42 -04:00
|
|
|
set_arch "$SEL"
|
2022-05-09 12:53:36 -04:00
|
|
|
elif [ "$SEL" = "djgpp" ]; then
|
|
|
|
set_arch "$SEL"
|
2022-04-23 14:14:21 -04:00
|
|
|
elif [ "$SEL" = "native" ]; then
|
|
|
|
set_arch native
|
|
|
|
elif [ "$SEL" = "make" ]; then
|
|
|
|
build
|
2022-04-24 03:53:42 -04:00
|
|
|
elif [ "$SEL" = "null" ]; then
|
|
|
|
echo "[.] This option is intentially left blank"
|
2022-04-23 14:14:21 -04:00
|
|
|
elif [ "$SEL" = "return" ]; then
|
|
|
|
break
|
|
|
|
fi
|
2022-04-24 03:53:42 -04:00
|
|
|
echo "--[ Architecture : " $ARCHIT " ]--"
|
|
|
|
echo "--[ Compiler : " $CC " ]--"
|
|
|
|
echo "--[ Host : " $MAKE_HOST " ]--"
|
2022-04-23 14:14:21 -04:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-04-22 19:35:02 -04:00
|
|
|
# MAIN LOOP
|
|
|
|
ARCHIT=""
|
|
|
|
BIN_SUFFIX=""
|
2022-05-09 12:53:36 -04:00
|
|
|
ARCHS="lin32 lin64 win32 win64 arm32 arm64 djgpp native"
|
2022-04-24 03:53:42 -04:00
|
|
|
CC_SEL="arch null null build \
|
2022-04-22 19:35:02 -04:00
|
|
|
config make test \
|
|
|
|
pub debug \
|
|
|
|
info \
|
|
|
|
build_all \
|
|
|
|
exit"
|
|
|
|
set_arch native
|
|
|
|
select SEL in $CC_SEL; do
|
2022-04-23 14:14:21 -04:00
|
|
|
if [ "$SEL" = "arch" ]; then
|
|
|
|
arch_menu
|
2022-04-24 03:53:42 -04:00
|
|
|
elif [ "$SEL" = "build" ]; then
|
2022-04-25 14:52:03 -04:00
|
|
|
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS" "$CXXFLAGS"
|
2022-04-24 03:53:42 -04:00
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
build
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
break
|
|
|
|
fi
|
2022-04-22 19:35:02 -04:00
|
|
|
elif [ "$SEL" = "make" ]; then
|
|
|
|
build
|
|
|
|
elif [ "$SEL" = "config" ]; then
|
2022-04-25 14:52:03 -04:00
|
|
|
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS" "$CXXFLAGS"
|
2022-04-22 19:35:02 -04:00
|
|
|
elif [ "$SEL" = "test" ]; then
|
|
|
|
test $BIN_SUFFIX
|
|
|
|
elif [ "$SEL" = "pub" ]; then
|
|
|
|
pub "$BIN_SUFFIX" "$ARCHIT"
|
|
|
|
elif [ "$SEL" = "debug" ]; then
|
|
|
|
gdb ./src/elinks$BIN_SUFFIX
|
|
|
|
elif [ "$SEL" = "info" ]; then
|
|
|
|
info "$BIN_SUFFIX"
|
|
|
|
elif [ "$SEL" = "build_all" ]; then
|
|
|
|
#set -f # avoid globbing (expansion of *).
|
|
|
|
arch_arr=($ARCHS)
|
|
|
|
for arch in "${arch_arr[@]}"; do
|
|
|
|
echo "--[ Building: $arch ]--"
|
|
|
|
set_arch "$arch"
|
2022-04-25 14:52:03 -04:00
|
|
|
configure "$CC" "$LD" "$MAKE_HOST" "$LDFLAGS" "$LIBS" "$CXXFLAGS"
|
2022-04-23 14:14:21 -04:00
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
break
|
|
|
|
fi
|
2022-04-22 19:35:02 -04:00
|
|
|
build
|
2022-04-23 14:14:21 -04:00
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
break
|
|
|
|
fi
|
2022-04-22 19:35:02 -04:00
|
|
|
info "$BIN_SUFFIX"
|
|
|
|
pub "$BIN_SUFFIX" "$ARCHIT"
|
|
|
|
done
|
2022-04-23 14:14:21 -04:00
|
|
|
elif [ "$SEL" = "null" ]; then
|
|
|
|
echo "[.] This option is intentially left blank"
|
2022-04-22 19:35:02 -04:00
|
|
|
elif [ "$SEL" = "exit" ]; then
|
|
|
|
exit
|
|
|
|
fi
|
2022-04-23 14:14:21 -04:00
|
|
|
echo "--[ [=] elinks build system main menu ]--"
|
2022-04-24 03:53:42 -04:00
|
|
|
echo "--[ Architecture : " $ARCHIT " ]--"
|
|
|
|
echo "--[ Compiler : " $CC " ]--"
|
|
|
|
echo "--[ Host : " $MAKE_HOST " ]--"
|
2022-04-22 19:35:02 -04:00
|
|
|
done
|