summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/adkprepare.sh67
-rwxr-xr-xscripts/bulk-qemu.sh33
-rwxr-xr-xscripts/bulk-toolchain.sh30
-rwxr-xr-xscripts/create-menu1
-rw-r--r--scripts/gcc-bisect.sh206
-rwxr-xr-xscripts/make9
-rwxr-xr-xscripts/prereq.sh643
-rwxr-xr-xscripts/reloc.sh18
-rw-r--r--scripts/scan-pkgs.sh91
-rwxr-xr-xscripts/sha256sum14
10 files changed, 643 insertions, 469 deletions
diff --git a/scripts/adkprepare.sh b/scripts/adkprepare.sh
deleted file mode 100755
index 5b18d30e3..000000000
--- a/scripts/adkprepare.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-os=$(uname)
-ver=$(uname -r)
-arch=$(uname -m)
-
-linux() {
- echo "Preparing Linux for OpenADK is not implemented, yet"
- exit 1
-}
-
-darwin() {
- echo "Preparing MacOS X for OpenADK, is not implemented, yet"
- exit 1
-}
-
-openbsd() {
- echo "Preparing OpenBSD for OpenADK"
- PKG_PATH="ftp://ftp.openbsd.org/pub/OpenBSD/${ver}/packages/${arch}/"
- export PKG_PATH
- pkg_add -v gmake
- pkg_add -v bash
- pkg_add -v wget
- pkg_add -v gtar--
- pkg_add -v gawk
- pkg_add -v gsed
-}
-
-netbsd() {
- echo "Preparing NetBSD for OpenADK"
- PKG_PATH="ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/${arch}/${ver}/All/"
- export PKG_PATH
- pkg_add -vu gmake
- pkg_add -vu bash
- pkg_add -vu wget
- pkg_add -vu gtar
- pkg_add -vu gsed
- pkg_add -vu gawk
-}
-
-freebsd() {
- echo "Preparing FreeBSD for OpenADK"
- pkg_add -r gmake bash wget gtar gsed gawk
-}
-
-case $os in
- Linux)
- linux
- ;;
- FreeBSD)
- freebsd
- ;;
- OpenBSD)
- openbsd
- ;;
- NetBSD)
- netbsd
- ;;
- Darwin)
- darwin
- ;;
- *)
- echo "OS not supported"
- ;;
-esac
diff --git a/scripts/bulk-qemu.sh b/scripts/bulk-qemu.sh
deleted file mode 100755
index 4bd153f83..000000000
--- a/scripts/bulk-qemu.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-if [ ! -z $1 ];then
- c=$1
-else
- c="uclibc-ng glibc musl uclibc"
-fi
-
-for libc in $c; do
- for arch in $(cat toolchain/$libc/arch.lst);do
- echo "Cleaning old stuff"
- make cleandir
- echo "Building $libc for $arch"
- DEFAULT="ADK_VERBOSE=1 ADK_APPLIANCE=new ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=qemu-$arch ADK_TARGET_LIBC=$libc ADK_TARGET_FS=initramfspiggyback"
- case $arch in
- mips|microblaze)
- for endian in little big;do
- make $DEFAULT ADK_TARGET_ENDIAN=$endian defconfig all
- cp -a firmware firmware.$arch.$endian
- done
- ;;
- *)
- make $DEFAULT defconfig all
- cp -a firmware firmware.$arch
- ;;
- esac
- if [ $? -ne 0 ];then
- echo "build failed"
- exit 1
- fi
- make cleandir
- done
-done
diff --git a/scripts/bulk-toolchain.sh b/scripts/bulk-toolchain.sh
deleted file mode 100755
index ba087c24f..000000000
--- a/scripts/bulk-toolchain.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-if [ ! -z $1 ];then
- c=$1
-else
- c="uclibc-ng glibc musl uclibc"
-fi
-
-for libc in $c; do
- for arch in $(cat toolchain/$libc/arch.lst);do
- echo "Cleaning old stuff"
- make cleandir
- echo "Building $libc for $arch"
- DEFAULT="VERBOSE=1 ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=toolchain-$arch ADK_TARGET_LIBC=$libc"
- case $arch in
- mips|microblaze|sh)
- for endian in little big;do
- make $DEFAULT ADK_TARGET_ENDIAN=$endian defconfig all
- done
- ;;
- *)
- make $DEFAULT defconfig all
- ;;
- esac
- if [ $? -ne 0 ];then
- echo "build failed"
- exit 1
- fi
- done
-done
diff --git a/scripts/create-menu b/scripts/create-menu
index 67176ccdf..3624776e7 100755
--- a/scripts/create-menu
+++ b/scripts/create-menu
@@ -1,4 +1,3 @@
-#!/usr/bin/env bash
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.
diff --git a/scripts/gcc-bisect.sh b/scripts/gcc-bisect.sh
deleted file mode 100644
index 1da4dd5d6..000000000
--- a/scripts/gcc-bisect.sh
+++ /dev/null
@@ -1,206 +0,0 @@
-#!/bin/sh
-rm -rf host_x86_64-linux-gnu target_sparc_glibc
-rm -rf gcc-*
-mkdir host_x86_64-linux-gnu
-mkdir target_sparc_glibc
-
-tar xvf binutils-2.24.tar.bz2
-cd binutils-2.24
-./configure \
- --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
- --target=sparc-openadk-linux-gnu \
- --with-sysroot=/home/wbx/smoke/target_sparc_glibc \
- --disable-dependency-tracking \
- --disable-libtool-lock \
- --disable-nls \
- --disable-werror \
- --disable-plugins \
- --disable-libssp --disable-multilib
-make -j4 all
-make install
-cd ..
-
-tar xvf gmp-5.1.3.tar.xz
-cd gmp-5.1.3
-cp configfsf.guess config.guess
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/usr/bin:$PATH" \
- ./configure \
- --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
- --with-pic \
- --disable-shared \
- --enable-static
-make -j4 all
-make install
-cd ..
-
-tar xvf mpfr-3.1.2.tar.xz
-cd mpfr-3.1.2
-./configure \
- --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
- --with-gmp-build=/home/wbx/smoke/gmp-5.1.3 \
- --disable-shared \
- --enable-static
-make -j4 all
-make install
-cd ..
-
-tar xvf mpc-0.8.2.tar.gz
-cd mpc-0.8.2
-./configure \
- --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
- --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu \
- --disable-shared \
- --enable-static
-make -j4 all
-make install
-make install
-cd ..
-
-tar xvf libelf-0.8.13.tar.gz
-cd libelf-0.8.13
-./configure \
- --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
- --disable-nls \
- --disable-shared \
- --enable-static
-make -j4 all
-make install
-cd ..
-
-rm -rf host_x86_64-linux-gnu/sparc-openadk-linux-gnu/{lib,sys-include}
-cd host_x86_64-linux-gnu/sparc-openadk-linux-gnu/
-ln -sf ../../target_sparc_glibc/usr/include sys-include
-ln -sf ../../target_sparc_glibc/lib lib
-cd -
-
-mkdir gcc-minimal
-cd gcc-minimal
-CFLAGS="-O0 -g0" \
-CXXFLAGS="-O0 -g0" \
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" \
-../gcc/configure \
- --prefix=/home/wbx/smoke/host_x86_64-linux-gnu --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-openadk-linux-gnu --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu --with-mpfr=/home/wbx/smoke/host_x86_64-linux-gnu --with-libelf=/home/wbx/smoke/host_x86_64-linux-gnu --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --enable-tls --disable-libsanitizer --disable-libitm --disable-libmudflap --disable-libgomp --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-system-zlib --without-ppl --without-cloog --without-isl --disable-nls --enable-target-optspace \
- --enable-languages=c \
- --disable-multilib \
- --disable-lto \
- --disable-libssp \
- --disable-shared \
- --without-headers
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make -j4 all-gcc
-if [ $? -ne 0 ];then
- echo failed
- exit
-fi
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make install-gcc
-if [ $? -ne 0 ];then
- echo failed
- exit
-fi
-cd ..
-
-cd linux-3.13.6
-make V=1 ARCH=sparc CROSS_COMPILE="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" HOSTCC="cc" CONFIG_SHELL='/bin/bash' HOSTCFLAGS='-O2 -Wall' INSTALL_HDR_PATH=/home/wbx/smoke/target_sparc_glibc/usr headers_install
-cd ..
-
-cd glibc-2.19-header
-libc_cv_forced_unwind=yes \
-libc_cv_cc_with_libunwind=yes \
-libc_cv_c_cleanup=yes \
-libc_cv_gnu99_inline=yes \
-libc_cv_initfini_array=yes \
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" ../glibc-2.19/configure \
- --prefix=/home/wbx/smoke/target_sparc_glibc/usr \
- --with-sysroot=/home/wbx/smoke/target_sparc_glibc \
- --build=x86_64-linux-gnu --host=sparc-openadk-linux-gnu --with-headers=/home/wbx/smoke/target_sparc_glibc/usr/include --disable-sanity-checks --disable-nls --without-cvs --disable-profile --disable-debug --without-gd --disable-nscd --with-__thread --with-tls --enable-kernel="2.6.32" --enable-add-ons
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make cross-compiling=yes PARALLELMFLAGS="-j1" install-headers
-if [ $? -ne 0 ];then
- echo failed
- exit
-fi
-cd ..
-touch target_sparc_glibc/usr/include/gnu/stubs.h
-
-mkdir gcc-initial
-cd gcc-initial
-CFLAGS="-O0 -g0" \
-CXXFLAGS="-O0 -g0" \
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" ../gcc/configure \
- --prefix=/home/wbx/smoke/host_x86_64-linux-gnu --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-openadk-linux-gnu --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu --with-mpfr=/home/wbx/smoke/host_x86_64-linux-gnu --with-libelf=/home/wbx/smoke/host_x86_64-linux-gnu --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --enable-tls --disable-libsanitizer --disable-libitm --disable-libmudflap --disable-libgomp --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-system-zlib --without-ppl --without-cloog --without-isl --disable-nls --enable-target-optspace \
- --disable-biarch --disable-multilib --enable-libssp --enable-lto \
- --enable-languages=c \
- --disable-shared \
- --disable-threads \
- --with-sysroot=/home/wbx/smoke/target_sparc_glibc
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make all-gcc
-if [ $? -ne 0 ];then
- echo failed
- exit
-fi
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make all-target-libgcc
-if [ $? -ne 0 ];then
- echo failed
- exit
-fi
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make install-gcc install-target-libgcc
-if [ $? -ne 0 ];then
- echo failed
- exit
-fi
-cd ..
-
-cd glibc-2.19-final
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" SHELL='/bin/bash' BUILD_CC=cc CFLAGS="-mcpu=v8 -fwrapv -fno-ident -fomit-frame-pointer -O2 -pipe -fno-unwind-tables -fno-asynchronous-unwind-tables -g3" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" CXX="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-g++" AR="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-ar" RANLIB="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-ranlib" libc_cv_forced_unwind=yes libc_cv_cc_with_libunwind=yes libc_cv_c_cleanup=yes libc_cv_gnu99_inline=yes libc_cv_initfini_array=yes \
-../glibc-2.19/configure \
- --prefix=/usr \
- --enable-shared \
- --enable-stackguard-randomization \
- --build=x86_64-linux-gnu --host=sparc-openadk-linux-gnu --with-headers=/home/wbx/smoke/target_sparc_glibc/usr/include --disable-sanity-checks --disable-nls --without-cvs --disable-profile --disable-debug --without-gd --disable-nscd --with-__thread --with-tls --enable-kernel="2.6.32" --enable-add-ons
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make all
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make install_root=/home/wbx/smoke/target_sparc_glibc install
-if [ $? -ne 0 ];then
- echo failed
- exit
-fi
-cd ..
-
-mkdir gcc-final
-cd gcc-final
-../gcc/configure \
- --prefix=/home/wbx/smoke/host_x86_64-linux-gnu --with-bugurl="http://www.openadk.org/" --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-openadk-linux-gnu --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu --with-mpfr=/home/wbx/smoke/host_x86_64-linux-gnu --with-libelf=/home/wbx/smoke/host_x86_64-linux-gnu --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --enable-tls --disable-libsanitizer --disable-libitm --disable-libmudflap --disable-libgomp --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-system-zlib --without-ppl --without-cloog --without-isl --disable-nls --enable-target-optspace \
- --disable-biarch --disable-multilib --enable-libssp --enable-lto \
- --enable-languages=c,c++ \
- --with-build-sysroot='${prefix}/../target_sparc_glibc' \
- --with-sysroot='${prefix}/../target_sparc_glibc' \
- --enable-shared
-make -j4 all
-if [ $? -ne 0 ];then
- echo failed
- exit
-fi
-make install
-if [ $? -ne 0 ];then
- echo failed
- exit
-fi
-cd ..
-
-cd linux-3.13.6/
-cat > mini.config <<EOF
-CONFIG_SPARC=y
-CONFIG_SPARC32=y
-CONFIG_SBUS=y
-CONFIG_SBUSCHAR=y
-CONFIG_PCI=y
-CONFIG_PCI_SYSCALL=y
-CONFIG_PCIC_PCI=y
-CONFIG_OF=y
-CONFIG_NET_VENDOR_AMD=y
-CONFIG_SUNLANCE=y
-CONFIG_SERIAL_CONSOLE=y
-CONFIG_SERIAL_SUNCORE=y
-CONFIG_SERIAL_SUNZILOG=y
-CONFIG_SERIAL_SUNZILOG_CONSOLE=y
-EOF
-
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make V=1 ARCH=sparc CROSS_COMPILE="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" HOSTCC="cc" CONFIG_SHELL='/bin/bash' HOSTCFLAGS='-O2 -Wall' KCONFIG_ALLCONFIG=mini.config allnoconfig
-PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make V=1 ARCH=sparc CROSS_COMPILE="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" HOSTCC="cc" CONFIG_SHELL='/bin/bash' HOSTCFLAGS='-O2 -Wall' -j4 zImage
diff --git a/scripts/make b/scripts/make
deleted file mode 100755
index e8e518653..000000000
--- a/scripts/make
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-if [ -z "$(which gmake 2>/dev/null)" ];then
- /usr/bin/make "$@"
-else
- gmake "$@"
-fi
diff --git a/scripts/prereq.sh b/scripts/prereq.sh
new file mode 100755
index 000000000..44aef4ef9
--- /dev/null
+++ b/scripts/prereq.sh
@@ -0,0 +1,643 @@
+#!/bin/sh
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+# resolve prerequisites for OpenADK build
+
+topdir=$(pwd)
+target="$@"
+flags="$MAKEFLAGS"
+out=0
+
+mirror=http://distfiles.openadk.org
+makever=4.1
+bashver=4.3.30
+
+# detect operating system
+os=$(env uname)
+osver=$(env uname -r)
+printf " ---> $os $osver for build detected.\n"
+
+# check if the filesystem is case sensitive
+rm -f foo
+echo >FOO
+if [ -e foo ]; then
+ printf "ERROR: OpenADK cannot be built in a case-insensitive file system."
+ case $os in
+ CYG*)
+ printf "Building OpenADK on $os needs a small registry change."
+ printf "http://cygwin.com/cygwin-ug-net/using-specialnames.html"
+ ;;
+ Darwin*)
+ printf "Building OpenADK on $os needs a case-sensitive disk partition."
+ printf "For Snow Leopard and above you can use diskutil to resize your existing disk."
+ printf "Example: sudo diskutil resizeVolume disk0s2 90G 1 jhfsx adk 30G"
+ printf "For older versions you might consider to use a disk image:"
+ printf "hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 30g ~/openadk.dmg"
+ ;;
+ esac
+ rm -f FOO
+ exit 1
+fi
+rm -f FOO
+
+# do we have a download tool?
+tools="curl wget"
+for tool in $tools; do
+ printf " ---> checking if $tool is installed.. "
+ if which $tool >/dev/null; then
+ printf "found\n"
+ case $tool in
+ curl)
+ FETCHCMD="$(which $tool) -k -f -s -o "
+ ;;
+ wget)
+ FETCHCMD="$(which $tool) --no-check-certificate -q -O "
+ ;;
+ esac
+ break
+ else
+ printf "not found\n"
+ continue
+ fi
+done
+if [ -z "$FETCHCMD" ]; then
+ printf "ERROR: no download tool found. Fatal error.\n"
+ exit 1
+fi
+
+# do we have a checksum tool?
+tools="sha256sum sha256 cksum shasum"
+for tool in $tools; do
+ printf " ---> checking if $tool is installed.. "
+ if which $tool >/dev/null 2>/dev/null; then
+ printf "found\n"
+ # check if cksum is usable
+ case $tool in
+ sha256sum)
+ SHA256=$(which $tool)
+ ;;
+ sha256)
+ SHA256="$(which $tool) -q"
+ ;;
+ cksum)
+ if cksum -q >/dev/null 2>/dev/null; then
+ SHA256="$(which $tool) -q -a sha256"
+ else
+ continue
+ fi
+ ;;
+ shasum)
+ SHA256="$(which $tool) -a 256"
+ ;;
+ esac
+ break
+ else
+ printf "not found\n"
+ continue
+ fi
+done
+if [ -z "$SHA256" ]; then
+ printf "ERROR: no checksum tool found. Fatal error.\n"
+ exit 1
+fi
+
+# create download dir
+if [ ! -d $topdir/dl ]; then
+ mkdir -p $topdir/dl
+fi
+
+# check for c compiler
+compilerbins="cc gcc clang"
+for compilerbin in $compilerbins; do
+ printf " ---> checking if $compilerbin is installed.. "
+ if which $compilerbin >/dev/null; then
+ printf "found\n"
+ CC=$compilerbin
+ break
+ fi
+done
+
+# check for c++ compiler
+compilerbins="c++ g++ clang++"
+for compilerbin in $compilerbins; do
+ printf " ---> checking if $compilerbin is installed.. "
+ if which $compilerbin >/dev/null; then
+ printf "found\n"
+ CXX=$compilerbin
+ break
+ fi
+done
+
+gnu_host_name=$(${CC} -dumpmachine)
+
+# relocation of topdir?
+olddir=$(grep "^ADK_TOPDIR" prereq.mk 2>/dev/null |cut -d '=' -f 2)
+newdir=$(pwd)
+
+if [ ! -z "$olddir" ]; then
+ if [ "$olddir" != "$newdir" ]; then
+ printf " ---> adk directory was relocated, fixing .."
+ sed -i -e "s#$olddir#$newdir#g" $(find target_* -name \*.pc|xargs) 2>/dev/null
+ sed -i -e "s#$olddir#$newdir#g" $(find host_${gnu_host_name} -type f|xargs) 2>/dev/null
+ sed -i -e "s#$olddir#$newdir#g" $(find target_*/scripts -type f|xargs) 2>/dev/null
+ sed -i -e "s#$olddir#$newdir#" target_*/etc/ipkg.conf 2>/dev/null
+ sleep 2
+ printf "done\n"
+ fi
+fi
+
+
+case :$PATH: in
+ (*:$topdir/host_${gnu_host_name}/bin:*) ;;
+ (*) export PATH=$topdir/host_${gnu_host_name}/bin:$PATH ;;
+esac
+
+# check for GNU make
+makebins="gmake make"
+for makebin in $makebins; do
+ printf " ---> checking if $makebin is installed.. "
+ if which $makebin >/dev/null 2>/dev/null; then
+ printf "found\n"
+ printf " ---> checking if it is GNU make.. "
+ $makebin --version 2>/dev/null| grep GNU >/dev/null
+ if [ $? -eq 0 ]; then
+ printf "yes\n"
+ MAKE=$(which $makebin)
+ break
+ else
+ # we need to build GNU make
+ printf "no\n"
+ printf " ---> compiling missing GNU make.. "
+ cd dl
+ $FETCHCMD make-${makever}.tar.gz $mirror/make-${makever}.tar.gz
+ if [ $? -ne 0 ]; then
+ printf "ERROR: failed to download make from $mirror\n"
+ exit 1
+ fi
+ cd ..
+ mkdir tmp
+ cd tmp
+ tar xzf ../dl/make-${makever}.tar.gz
+ cd make-$makever
+ ./configure --prefix=$topdir/host_$gnu_host_name/
+ make
+ make install
+ cd ..
+ cd ..
+ rm -rf tmp
+ MAKE=$topdir/host_$gnu_host_name/bin/make
+ makebin=$topdir/host_$gnu_host_name/bin/make
+ printf " done\n"
+ fi
+ else
+ printf "not found\n"
+ continue
+ fi
+done
+
+# check for bash
+printf " ---> checking if bash is installed.. "
+if which bash >/dev/null; then
+ printf "found\n"
+else
+ # we need to build GNU bash
+ printf "not found\n"
+ printf " ---> compiling missing GNU bash.. "
+ cd dl
+ $FETCHCMD bash-${bashver}.tar.gz $mirror/bash-${bashver}.tar.gz
+ if [ $? -ne 0 ]; then
+ printf "ERROR: failed to download make from $mirror\n"
+ exit 1
+ fi
+ cd ..
+ mkdir tmp
+ cd tmp
+ tar xzf ../dl/bash-${bashver}.tar.gz
+ cd bash-${bashver}
+ ./configure --prefix=$topdir/host_$gnu_host_name/
+ make
+ make install
+ cd ..
+ cd ..
+ rm -rf tmp
+ printf " done\n"
+fi
+
+# skip the script if distclean / cleandir
+if [ "$target" = "distclean" -o "$target" = "cleandir" ]; then
+ touch prereq.mk
+ $makebin ADK_TOPDIR=$topdir -s -f Makefile.adk $flags $target
+ exit 0
+fi
+
+printf " ---> checking if perl is installed.. "
+if ! which perl >/dev/null 2>&1; then
+ echo You must install perl to continue.
+ echo
+ out=1
+ printf "not found\n"
+fi
+printf "found\n"
+
+# creating prereq.mk
+echo "ADK_TOPDIR:=$(readlink -nf . 2>/dev/null || pwd -P)" > $topdir/prereq.mk
+echo "BASH:=$(which bash)" >> $topdir/prereq.mk
+echo "SHELL:=$(which bash)" >> $topdir/prereq.mk
+echo "GMAKE:=$MAKE" >> $topdir/prereq.mk
+echo "MAKE:=$MAKE" >> $topdir/prereq.mk
+echo "FETCHCMD:=$FETCHCMD" >> $topdir/prereq.mk
+echo "SHA256:=$SHA256" >> $topdir/prereq.mk
+echo "GNU_HOST_NAME:=${gnu_host_name}" >> $topdir/prereq.mk
+echo "OS_FOR_BUILD:=${os}" >> $topdir/prereq.mk
+echo "ARCH_FOR_BUILD:=$(${CC} -dumpmachine | sed \
+ -e 's/x86_64-linux-gnux32/x32/' \
+ -e s'/-.*//' \
+ -e 's/sparc.*/sparc/' \
+ -e 's/armeb.*/armeb/g' \
+ -e 's/arm.*/arm/g' \
+ -e 's/m68k.*/m68k/' \
+ -e 's/sh[234]/sh/' \
+ -e 's/mips-.*/mips/' \
+ -e 's/mipsel-.*/mipsel/' \
+ -e 's/i[3-9]86/x86/' \
+ )" >>prereq.mk
+
+if [ "$CC" = "clang" ]; then
+ echo "HOST_CC:=${CC} -fbracket-depth=1024" >> $topdir/prereq.mk
+else
+ echo "HOST_CC:=${CC}" >> $topdir/prereq.mk
+fi
+if [ "$CXX" = "clang++" ]; then
+ echo "HOST_CXX:=${CXX} -fbracket-depth=1024" >> $topdir/prereq.mk
+else
+ echo "HOST_CXX:=${CXX}" >> $topdir/prereq.mk
+fi
+
+echo 'LANGUAGE:=C' >> $topdir/prereq.mk
+echo 'LC_ALL:=C' >> $topdir/prereq.mk
+echo "_PATH:=$PATH" >> $topdir/prereq.mk
+echo "PATH:=${topdir}/scripts:/usr/sbin:$PATH" >> $topdir/prereq.mk
+echo "GIT:=$(which git 2>/dev/null)" >> $topdir/prereq.mk
+echo "export ADK_TOPDIR GIT SHA256 BASH SHELL" >> $topdir/prereq.mk
+
+# check if compiler works
+cat >Makefile.tmp <<'EOF'
+include ${ADK_TOPDIR}/prereq.mk
+all: test
+
+test: test.c
+ @${HOST_CC} ${HOST_CFLAGS} -o $@ $^ ${LDADD}
+EOF
+cat >test.c <<-'EOF'
+ #include <stdio.h>
+ int
+ main()
+ {
+ printf("YES");
+ return (0);
+ }
+EOF
+
+$MAKE --no-print-directory ADK_TOPDIR=$topdir -f Makefile.tmp 2>&1
+X=$(./test)
+if [ $X != YES ]; then
+ echo "$X" | sed 's/^/| /'
+ echo Cannot compile a simple test programme.
+ echo You must install a host make and C compiler.
+ echo
+ out=1
+fi
+rm test.c test Makefile.tmp 2>/dev/null
+
+# error out on any required prerequisite
+if [ $out -ne 0 ]; then
+ exit $out
+fi
+
+host_build_bc=0
+if which bc >/dev/null 2>&1; then
+ if ! echo quit|bc -q 2>/dev/null >/dev/null; then
+ host_build_bc=1
+ else
+ if bc -v 2>&1| grep -q BSD >/dev/null 2>&1; then
+ host_build_bc=1
+ fi
+ fi
+else
+ host_build_bc=1
+fi
+
+host_build_bison=0
+if ! which bison >/dev/null 2>&1; then
+ host_build_bison=1
+fi
+
+host_build_bzip2=0
+if ! which bzip2 >/dev/null 2>&1; then
+ host_build_bzip2=1
+fi
+
+host_build_file=0
+if ! which file >/dev/null 2>&1; then
+ host_build_file=1
+fi
+
+host_build_flex=0
+if ! which flex >/dev/null 2>&1; then
+ host_build_flex=1
+fi
+
+host_build_m4=0
+if ! which m4 >/dev/null 2>&1; then
+ host_build_m4=1
+fi
+
+host_build_mksh=0
+if ! which mksh >/dev/null 2>&1; then
+ host_build_mksh=1
+fi
+
+host_build_patch=0
+if ! which patch >/dev/null 2>&1; then
+ host_build_patch=1
+fi
+
+host_build_pkgconf=0
+if ! which pkgconf >/dev/null 2>&1; then
+ host_build_pkgconf=1
+fi
+
+host_build_tar=0
+if which tar >/dev/null 2>&1; then
+ if ! tar --version 2>/dev/null|grep GNU >/dev/null;then
+ host_build_tar=1
+ fi
+else
+ host_build_tar=1
+fi
+
+host_build_findutils=0
+if which xargs >/dev/null 2>&1; then
+ if ! xargs --version 2>/dev/null|grep GNU >/dev/null;then
+ host_build_findutils=1
+ fi
+fi
+
+if which find >/dev/null 2>&1; then
+ if ! find --version 2>/dev/null|grep GNU >/dev/null;then
+ host_build_findutils=1
+ fi
+fi
+
+host_build_grep=0
+if which grep >/dev/null 2>&1; then
+ if ! grep --version 2>/dev/null|grep GNU >/dev/null;then
+ host_build_grep=1
+ fi
+fi
+
+host_build_gawk=0
+if ! which gawk >/dev/null 2>&1; then
+ host_build_gawk=1
+fi
+
+host_build_sed=0
+if which sed >/dev/null 2>&1; then
+ if ! sed --version 2>/dev/null|grep GNU >/dev/null;then
+ host_build_sed=1
+ fi
+fi
+
+host_build_xz=0
+if ! which xz >/dev/null 2>&1; then
+ host_build_xz=1
+fi
+
+# optional
+host_build_cdrtools=0
+if ! which mkisofs >/dev/null 2>&1; then
+ host_build_cdrtools=1
+fi
+
+host_build_ccache=0
+if ! which ccache >/dev/null 2>&1; then
+ host_build_ccache=1
+fi
+
+host_build_genext2fs=0
+if ! which genext2fs >/dev/null 2>&1; then
+ host_build_genext2fs=1
+fi
+
+host_build_lzma=0
+if ! which lzma >/dev/null 2>&1; then
+ host_build_lzma=1
+fi
+
+host_build_lz4=0
+if ! which lz4c >/dev/null 2>&1; then
+ host_build_lz4=1
+fi
+
+host_build_lzop=0
+if ! which lzop >/dev/null 2>&1; then
+ host_build_lzop=1
+fi
+
+host_build_qemu=0
+if ! which qemu-img >/dev/null 2>&1; then
+ host_build_qemu=1
+fi
+
+echo "config ADK_HOST_BUILD_TOOLS" > $topdir/target/config/Config.in.prereq
+printf "\t%s\n" "bool" >> $topdir/target/config/Config.in.prereq
+printf "\t%s\n" "default y" >> $topdir/target/config/Config.in.prereq
+# always required
+if [ $host_build_bc -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_BC" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_bison -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_BISON" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_bzip2 -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_BZIP2" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_file -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_FILE" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_flex -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_FLEX" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_gawk -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_GAWK" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_grep -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_GREP" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_m4 -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_M4" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_mksh -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_MKSH" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_patch -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_PATCH" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_pkgconf -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_PKGCONF" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_findutils -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_FINDUTILS" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_sed -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_SED" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_tar -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_TAR" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_xz -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_XZ" >> $topdir/target/config/Config.in.prereq
+fi
+# optional
+if [ $host_build_ccache -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_CCACHE if ADK_HOST_NEED_CCACHE" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_cdrtools -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_CDRTOOLS if ADK_HOST_NEED_CDRTOOLS" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_genext2fs -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_GENEXT2FS if ADK_HOST_NEED_GENEXT2FS" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_lzma -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_LZMA if ADK_HOST_NEED_LZMA" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_lz4 -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_LZ4 if ADK_HOST_NEED_LZ4" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_lzop -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_LZOP if ADK_HOST_NEED_LZOP" >> $topdir/target/config/Config.in.prereq
+fi
+if [ $host_build_qemu -eq 1 ]; then
+ printf "\t%s\n" "select ADK_HOST_BUILD_QEMU if ADK_HOST_NEED_QEMU" >> $topdir/target/config/Config.in.prereq
+fi
+
+# create Host OS symbols
+case $os in
+ Linux)
+ printf "\nconfig ADK_HOST_LINUX\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+ ;;
+ Darwin)
+ printf "\nconfig ADK_HOST_DARWIN\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+ ;;
+ OpenBSD)
+ printf "\nconfig ADK_HOST_OPENBSD\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+ ;;
+ FreeBSD)
+ printf "\nconfig ADK_HOST_FREEBSD\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+ ;;
+ NetBSD)
+ printf "\nconfig ADK_HOST_NETBSD\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+ ;;
+ MirBSD)
+ printf "\nconfig ADK_HOST_MIRBSD\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+ ;;
+ Cygwin*)
+ printf "\nconfig ADK_HOST_CYGWIN\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+ printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+ ;;
+esac
+
+if [ ! -f $topdir/.config ]; then
+ # create a config if no exist
+ touch .firstrun
+ $makebin ADK_TOPDIR=$topdir --no-print-directory -f Makefile.adk menuconfig
+else
+ # scan host-tool prerequisites of certain packages before building.
+ . $topdir/.config
+ if [ -n "$ADK_PACKAGE_KODI" ]; then
+ NEED_JAVA="$NEED_JAVA kodi"
+ fi
+
+ if [ -n "$ADK_PACKAGE_ICU4C" ]; then
+ NEED_STATIC_LIBSTDCXX="$NEED_STATIC_LIBSTDCXX icu4c"
+ fi
+
+ if [ -n "$ADK_PACKAGE_XKEYBOARD_CONFIG" ]; then
+ NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
+ fi
+
+ if [ -n "$ADK_PACKAGE_FONT_BITSTREAM_100DPI" ]; then
+ NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
+ fi
+
+ if [ -n "$ADK_PACKAGE_FONT_BITSTREAM_75DPI" ]; then
+ NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
+ fi
+
+ if [ -n "$ADK_PACKAGE_FONT_ADOBE_100DPI" ]; then
+ NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
+ fi
+
+ if [ -n "$ADK_PACKAGE_FONT_ADOBE_75DPI" ]; then
+ NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
+ fi
+
+ if [ -n "$NEED_MKFONTDIR" ]; then
+ if ! which mkfontdir >/dev/null 2>&1; then
+ printf "You need mkfontdir to build $NEED_MKFONTDIR"
+ out=1
+ fi
+ fi
+
+ if [ -n "$NEED_XKBCOMP" ]; then
+ if ! which xkbcomp >/dev/null 2>&1; then
+ printf "You need xkbcomp to build $NEED_XKBCOMP"
+ out=1
+ fi
+ fi
+
+ if [ -n "$NEED_JAVA" ]; then
+ if ! which java >/dev/null 2>&1; then
+ printf "You need java to build $NEED_JAVA"
+ out=1
+ fi
+ fi
+
+ if [ -n "$NEED_STATIC_LIBSTDCXX" ]; then
+cat >test.c <<-'EOF'
+ #include <stdio.h>
+ int
+ main()
+ {
+ return (0);
+ }
+EOF
+ if ! $CXX -static-libstdc++ -o test test.c 2>/dev/null ; then
+ printf "You need static version of libstdc++ installed to build $NEED_STATIC_LIBSTDCXX"
+ out=1
+ rm test test.c 2>/dev/null
+ fi
+ fi
+
+ # error out
+ if [ $out -ne 0 ]; then
+ exit $out
+ fi
+
+ # start build
+ $makebin ADK_TOPDIR=$topdir --no-print-directory -f Makefile.adk $flags $target
+fi
diff --git a/scripts/reloc.sh b/scripts/reloc.sh
deleted file mode 100755
index b0b2ca94c..000000000
--- a/scripts/reloc.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-# execute this after relocation of adk directory
-
-olddir=$(grep "^ADK_TOPDIR" prereq.mk 2>/dev/null |cut -d '=' -f 2)
-newdir=$(pwd)
-
-if [ ! -z "$olddir" ];then
- if [ "$olddir" != "$newdir" ];then
- echo "adk directory relocated!"
- echo "old directory: $olddir"
- echo "new directory: $newdir"
- sed -i -e "s#$olddir#$newdir#g" $(find target_* -name \*.pc|xargs)
- sed -i -e "s#$olddir#$newdir#g" $(find target_* -name \*.la|xargs)
- sed -i -e "s#$olddir#$newdir#g" $(find target_*/scripts -type f|xargs)
- sed -i -e "s#$olddir#$newdir#" target_*/etc/ipkg.conf
- sed -i -e "s#$olddir#$newdir#" prereq.mk
- fi
-fi
diff --git a/scripts/scan-pkgs.sh b/scripts/scan-pkgs.sh
deleted file mode 100644
index 416d3a4d4..000000000
--- a/scripts/scan-pkgs.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-#
-# Scan host-tool prerequisites of certain packages before building.
-
-if test -z "$BASH_VERSION"; then
- foo=`$BASH -c 'echo "$BASH_VERSION"'`
-else
- foo=$BASH_VERSION
-fi
-
-if test -z "$foo"; then
- echo OpenADK requires GNU bash to be installed.
- exit 1
-fi
-
-test -z "$BASH_VERSION$KSH_VERSION" && exec $BASH $0 "$@"
-
-[[ -n $BASH_VERSION ]] && shopt -s extglob
-topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
-OStype=$(uname)
-out=0
-
-. $topdir/.config
-
-if [[ -n $ADK_PACKAGE_KODI ]]; then
- NEED_JAVA="$NEED_JAVA kodi"
-fi
-
-if [[ -n $ADK_PACKAGE_ICU4C ]]; then
- NEED_STATIC_LIBSTDCXX="$NEED_STATIC_LIBSTDCXX icu4c"
-fi
-
-if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
- NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
-fi
-
-if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
- NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
-fi
-
-if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
- NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
-fi
-
-if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
- NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
-fi
-
-if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
- NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
-fi
-
-if [[ -n $NEED_MKFONTDIR ]]; then
- if ! which mkfontdir >/dev/null 2>&1; then
- echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
- out=1
- fi
-fi
-
-if [[ -n $NEED_XKBCOMP ]]; then
- if ! which xkbcomp >/dev/null 2>&1; then
- echo >&2 You need xkbcomp to build $NEED_XKBCOMP
- out=1
- fi
-fi
-
-if [[ -n $NEED_JAVA ]]; then
- if ! which java >/dev/null 2>&1; then
- echo >&2 You need java to build $NEED_JAVA
- out=1
- fi
-fi
-
-if [[ -n $NEED_STATIC_LIBSTDCXX ]]; then
-cat >test.c <<-'EOF'
- #include <stdio.h>
- int
- main()
- {
- return (0);
- }
-EOF
- if ! g++ -static-libstdc++ -o test test.c ; then
- echo >&2 You need static version of libstdc++ installed to build $NEED_STATIC_LIBSTDCXX
- out=1
- rm test 2>/dev/null
- fi
-fi
-
-exit $out
diff --git a/scripts/sha256sum b/scripts/sha256sum
deleted file mode 100755
index e70973364..000000000
--- a/scripts/sha256sum
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-if [ -x /usr/bin/sha256sum ]; then
- /usr/bin/sha256sum "$@"
-elif [ -x /bin/cksum ] && [ $(echo | cksum -a sha256) = 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b ]; then
- # we assume the arguments are exactly "-c" or "-c -"
- x=$(sed 's/^\([0-9a-fA-F]*\) *\([^ ].*\)$/SHA256 (\2) = \1/' | cksum -c -a sha256)
- [[ $x = *FAILED* ]] && exit 1
- exit 0
-else
- shasum -a 256 "$@"
-fi