1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-12-23 23:50:51 +01:00

Merge management of regular and toolchain packages

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-02-15 23:47:54 +01:00
parent 7b1d236e16
commit 1636fc8aac
51 changed files with 76 additions and 98 deletions

38
mk.sh
View file

@ -47,57 +47,29 @@ source "$SCRIPTDIR/util/toolchain.sh"
source "$SCRIPTDIR/util/cmake.sh"
source "$SCRIPTDIR/util/misc.sh"
############################## build toolchain ###############################
echo "--- resolving toolchain dependencies ---"
include_pkg "tcpkg" "toolchain"
dependencies | tsort | tac > "$PACKAGELIST"
cat "$PACKAGELIST"
echo "--- downloading toolchain files ---"
while read pkg; do
include_pkg "tcpkg" "$pkg"
fetch_package
done < "$PACKAGELIST"
echo "--- building toolchain ---"
gen_cmake_toolchain_file
while read pkg; do
include_pkg "tcpkg" "$pkg"
run_pkg_command "build" "toolchain"
run_pkg_command "deploy" "toolchain"
done < "$PACKAGELIST"
echo "--- backing up toolchain sysroot ---"
save_toolchain
############################### build packages ###############################
echo "--- resolving package dependencies ---"
include_pkg "pkg" "release-${BOARD}"
include_pkg "release-${BOARD}"
dependencies | tsort | tac > "$PACKAGELIST"
cat "$PACKAGELIST"
echo "--- downloading package files ---"
while read pkg; do
include_pkg "pkg" "$pkg"
include_pkg "$pkg"
fetch_package
done < "$PACKAGELIST"
echo "--- building package ---"
while read pkg; do
include_pkg "pkg" "$pkg"
include_pkg "$pkg"
install_build_deps
run_pkg_command "build" "$PKGNAME"
run_pkg_command "deploy" "$PKGNAME"
run_pkg_command "build"
run_pkg_command "deploy"
restore_toolchain
done < "$PACKAGELIST"

View file

@ -34,7 +34,7 @@ deploy() {
rm -r "$DEPLOY/share"
rm "$DEPLOY/bin/bashbug"
cp -r "$SCRIPTDIR/$PKGDIR/$PKGNAME/etc" "$DEPLOY"
cp -r "$SCRIPTDIR/pkg/$PKGNAME/etc" "$DEPLOY"
split_dev_deploy "$DEPLOY" "$DEVDEPLOY"
}

View file

@ -3,7 +3,7 @@ SRCDIR="busybox-$VERSION"
TARBALL="busybox-$VERSION.tar.bz2"
URL="https://busybox.net/downloads"
SHA256SUM="604553b7dbd59ded9e3ad7c6af49ed2cff599adf3e54d9463e5e0027b362019c"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="db-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="http://download.oracle.com/berkeley-db/"
SHA256SUM="a9c5e2b004a5777aa03510cfe5cd766a4a3b777713406b02809c17c8e0e7a8fb"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="bzip2-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="http://www.bzip.org/1.0.6/"
SHA256SUM="a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="coreutils-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://ftp.gnu.org/gnu/coreutils/"
SHA256SUM="92d0fa1c311cacefa89853bdb53c62f4110cdfda3820346b59cbd098f40f955e"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
apply_patches

View file

@ -3,7 +3,7 @@ SRCDIR="diffutils-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://ftp.gnu.org/gnu/diffutils/"
SHA256SUM="d621e8bdd4b573918c8145f7ae61817d1be9deb4c8d2328a65cea8e11d783bd6"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="dnsmasq-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="http://www.thekelleys.org.uk/dnsmasq"
SHA256SUM="89949f438c74b0c7543f06689c319484bd126cc4b1f8c745c742ab397681252b"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="dosfstools-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://github.com/dosfstools/dosfstools/releases/download/v${VERSION}"
SHA256SUM="e6b2aca70ccc3fe3687365009dd94a2e18e82b688ed4e260e04b7412471cc173"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="ethtool-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://www.kernel.org/pub/software/network/ethtool/"
SHA256SUM="71f7fd32483ffdc7c6c4d882e230714eb101df0a46cbe396dbeb8ac78f1ef91a"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="findutils-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="https://ftp.gnu.org/gnu/findutils/"
SHA256SUM="ded4c9f73731cd48fec3b6bdaccce896473b6d8e337e9612e16cf1431bb1169d"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="gawk-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://ftp.gnu.org/gnu/gawk/"
SHA256SUM="d4f3cd31c001fd0ed52832d4fbfbdfeaa38ad541c182f80ff8fdf87324a6a9f2"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="gmp-$VERSION"
TARBALL="gmp-$VERSION.tar.bz2"
URL="http://ftp.gnu.org/gnu/gmp"
SHA256SUM="5275bb04f4863a13516b2f39392ac5e272f5e1bb8057b18aec1c9b79d73d8fb2"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="grep-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://ftp.gnu.org/gnu/grep/"
SHA256SUM="db625c7ab3bb3ee757b3926a5cfa8d9e1c3991ad24707a83dde8a5ef2bf7a07e"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="gzip-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://ftp.gnu.org/gnu/gzip/"
SHA256SUM="ae506144fc198bd8f81f1f4ad19ce63d5a2d65e42333255977cf1dcf1479089a"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="kbd-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://www.kernel.org/pub/linux/utils/kbd"
SHA256SUM="5fd90af6beb225a9bb9b9fb414c090fba53c9a55793e172f508cd43652e59a88"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="libbsd-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://libbsd.freedesktop.org/releases"
SHA256SUM="f548f10e5af5a08b1e22889ce84315b1ebe41505b015c9596bad03fd13a12b31"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
apply_patches

View file

@ -3,7 +3,7 @@ SRCDIR="libevent-${VERSION}-stable"
TARBALL="${SRCDIR}.tar.gz"
URL="https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/"
SHA256SUM="965cc5a8bb46ce4199a47e9b2c9e1cae3b137e8356ffdad6d94d3b9069b71dc2"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="libiconv-$VERSION"
TARBALL="${SRCDIR}.tar.gz"
URL="https://ftp.gnu.org/gnu/libiconv/"
SHA256SUM="ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="libmnl-${VERSION}"
TARBALL="${SRCDIR}.tar.bz2"
URL="https://www.netfilter.org/projects/libmnl/files/"
SHA256SUM="171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="libseccomp-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="https://github.com/seccomp/libseccomp/releases/download/v${VERSION}"
SHA256SUM="7fc28f4294cc72e61c529bedf97e705c3acf9c479a8f1a3028d4cd2ca9f3b155"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="libtasn1-$VERSION"
TARBALL="libtasn1-$VERSION.tar.gz"
URL="https://ftp.gnu.org/gnu/libtasn1"
SHA256SUM="7e528e8c317ddd156230c4e31d082cd13e7ddeb7a54824be82632209550c8cca"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -1,6 +1,6 @@
# inherit package details from kernel package
source "$SCRIPTDIR/pkg/$LINUXPKG/build"
DEPENDS=""
DEPENDS="toolchain"
build() {
local INPUT="$1"

View file

@ -3,7 +3,7 @@ SRCDIR="lzo-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="http://www.oberhumer.com/opensource/lzo/download"
SHA256SUM="c0f892943208266f9b6543b3ae308fab6284c5c90e627931446fb49b4221a072"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="ncurses-${VERSION}"
TARBALL="${SRCDIR}.tar.gz"
URL="https://ftp.gnu.org/gnu/ncurses/"
SHA256SUM="aa057eeeb4a14d470101eff4597d5833dcef5965331be3528c08d99cebaa0d17"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -50,7 +50,7 @@ deploy() {
mkdir -p ${DEPLOY}/etc/{conf.d,init.d,runlevels,sysctl.d}
mkdir -p ${DEPLOY}/etc/runlevels/{boot,sysinit,shutdown,default}
cp -R "$SCRIPTDIR/$PKGDIR/$PKGNAME/etc" "$DEPLOY"
cp -R "$SCRIPTDIR/pkg/$PKGNAME/etc" "$DEPLOY"
source "$SCRIPTDIR/board/$BOARD/INIT"

View file

@ -21,7 +21,7 @@ build() {
cp "/usr/share/syslinux/mbr.bin" "$BUILD"
for script in install.sh genimage.sh syslinux.cfg; do
cp "$SCRIPTDIR/$PKGDIR/$PKGNAME/$script" "$BUILD"
cp "$SCRIPTDIR/pkg/$PKGNAME/$script" "$BUILD"
sed -i 's#ROOTFSFILE#'$rootfs_image'#g' "$BUILD/$script"
sed -i 's#KERNELFILE#'$linux_image'#g' "$BUILD/$script"
@ -35,6 +35,6 @@ deploy() {
local DEPLOY="$3"
pushd "$PKGBUILDDIR" > /dev/null
tar czf "$DEPLOY/$PKGNAME.tar.gz" "${PKGDIR}-${PKGNAME}"
tar czf "$DEPLOY/$PKGNAME.tar.gz" "$PKGNAME"
popd > /dev/null
}

View file

@ -15,9 +15,9 @@ build() {
done
# copy files from this package
cp "$SCRIPTDIR/$PKGDIR/$PKGNAME/cmdline.txt" "$BUILD/boot"
cp "$SCRIPTDIR/$PKGDIR/$PKGNAME/install.sh" "$BUILD"
cp "$SCRIPTDIR/$PKGDIR/$PKGNAME/genimage.sh" "$BUILD"
cp "$SCRIPTDIR/pkg/$PKGNAME/cmdline.txt" "$BUILD/boot"
cp "$SCRIPTDIR/pkg/$PKGNAME/install.sh" "$BUILD"
cp "$SCRIPTDIR/pkg/$PKGNAME/genimage.sh" "$BUILD"
# substitute file names in scripts
mkdir -p "$BUILD/boot/$OS_RELEASE"
@ -37,6 +37,6 @@ deploy() {
local DEPLOY="$3"
pushd "$PKGBUILDDIR" > /dev/null
tar czf "$DEPLOY/$PKGNAME.tar.gz" "${PKGDIR}-${PKGNAME}"
tar czf "$DEPLOY/$PKGNAME.tar.gz" "$PKGNAME"
popd > /dev/null
}

View file

@ -1,4 +1,5 @@
DEPENDS=$(cat "$SCRIPTDIR/board/$BOARD/ROOTFS")
DEPENDS="$DEPENDS toolchain"
build() {
local SOURCE="$1"
@ -10,17 +11,10 @@ build() {
mkdir -pv ${BUILD}/{boot,usr,srv,mnt,opt}
mkdir -pv ${BUILD}/cfg/{preserve,overlay}
echo "/lib" > "$BUILD/etc/ld-musl-${MUSL_CPU}.path"
if [ -e "$SCRIPTDIR/board/$BOARD/LDPATH" ]; then
cat "$SCRIPTDIR/board/$BOARD/LDPATH" >> "$BUILD/etc/ld-musl-${MUSL_CPU}.path"
fi
cp -r "$SCRIPTDIR/$PKGDIR/$PKGNAME/etc" "$BUILD"
cp -r "$SCRIPTDIR/pkg/$PKGNAME/etc" "$BUILD"
# install packages to rootfs
dependencies | tsort | tac | grep -v "$PKGNAME" > "$BUILD/etc/packages"
echo "toolchain" >> "$BUILD/etc/packages"
while read pkgname; do
if [ ! -e "$PKGDEPLOYDIR/$pkgname" ]; then

View file

@ -3,7 +3,7 @@ SRCDIR="sed-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://ftp.gnu.org/gnu/sed/"
SHA256SUM="cbd6ebc5aaf080ed60d0162d7f6aeae58211a1ee9ba9bb25623daa6cd942683b"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="shadow-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://github.com/shadow-maint/shadow/releases/download/${VERSION}"
SHA256SUM="fc8c858381ad577a5c25ff5beb6ee60a34f8719c73e4e7c61e74188b4e54b741"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
sed -i 's/groups$(EXEEXT) //' src/Makefile.in

View file

@ -3,13 +3,13 @@ SRCDIR="gcc-$VERSION"
TARBALL="gcc-$VERSION.tar.xz"
URL="http://ftp.gnu.org/gnu/gcc/gcc-$VERSION"
SHA256SUM="832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c"
DEPENDS="binutils cloog gmp isl mpc mpfr linux_hdr"
DEPENDS="tc-binutils tc-cloog tc-gmp tc-isl tc-mpc tc-mpfr tc-linux_hdr"
prepare() {
for child in cloog gmp isl mpc mpfr; do
unset -f build deploy prepare
unset -v VERSION TARBALL URL SRCDIR SHA256SUM
source "$SCRIPTDIR/tcpkg/$child/build"
unset -v VERSION TARBALL URL SRCDIR SHA256SUM DEPENDS
source "$SCRIPTDIR/pkg/$child/build"
if [ ! -e "$child" ]; then
echo "installing symlink to $child..."

View file

@ -1,6 +1,6 @@
# inherit package details from first stage GCC
source "$SCRIPTDIR/tcpkg/gcc1/build"
DEPENDS="gcc1 musl"
source "$SCRIPTDIR/pkg/tc-gcc1/build"
DEPENDS="tc-gcc1 tc-musl"
build() {
local INPUT="$1"

View file

@ -3,7 +3,7 @@ SRCDIR="musl-$VERSION"
TARBALL="$SRCDIR.tar.gz"
URL="https://www.musl-libc.org/releases"
SHA256SUM="d017ee5d01aec0c522a1330fdff06b1e428cb409e1db819cc4935d5da4a5a118"
DEPENDS="gcc1"
DEPENDS="tc-gcc1"
prepare() {
return
@ -27,4 +27,10 @@ deploy() {
rm $DEPLOY/lib/*.a $DEPLOY/lib/*.o
mkdir -p "$DEPLOY/etc"
echo "/lib" > "$DEPLOY/etc/ld-musl-${MUSL_CPU}.path"
if [ -e "$SCRIPTDIR/board/$BOARD/LDPATH" ]; then
cat "$SCRIPTDIR/board/$BOARD/LDPATH" >> "$DEPLOY/etc/ld-musl-${MUSL_CPU}.path"
fi
}

View file

@ -1,4 +1,4 @@
DEPENDS="gcc2 musl pkg-config file"
DEPENDS="tc-gcc2 tc-musl tc-pkg-config tc-file"
build() {
return
@ -11,4 +11,7 @@ deploy() {
rsync -aH --files-from="$SCRIPTDIR/board/$BOARD/libgcc_files.txt" \
"$TCDIR/$TARGET" "$DEPLOY"
gen_cmake_toolchain_file
save_toolchain
}

View file

@ -3,7 +3,7 @@ SRCDIR="xz-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="https://tukaani.org/xz/"
SHA256SUM="7876096b053ad598c31f6df35f7de5cd9ff2ba3162e5a5554e4fc198447e0347"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -3,7 +3,7 @@ SRCDIR="zlib-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="http://www.zlib.net/"
SHA256SUM="4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066"
DEPENDS=""
DEPENDS="toolchain"
prepare() {
return

View file

@ -1,10 +1,9 @@
include_pkg() {
PKGDIR="$1" # globally visible package directory
PKGNAME="$2" # globally visible package name
PKGNAME="$1" # globally visible package name
unset -f build deploy prepare
unset -v VERSION TARBALL URL SRCDIR SHA256SUM DEPENDS
source "$SCRIPTDIR/$PKGDIR/$PKGNAME/build"
source "$SCRIPTDIR/pkg/$PKGNAME/build"
}
dependencies() {
@ -16,7 +15,7 @@ dependencies() {
done
for DEP in $depends; do
include_pkg "$PKGDIR" "$DEP"
include_pkg "$DEP"
dependencies
done
fi

View file

@ -24,7 +24,7 @@ fetch_package() {
pushd "$PKGSRCDIR/$SRCDIR" > /dev/null
echo "$PKGNAME - prepare"
prepare "$SCRIPTDIR/$PKGDIR/$PKGNAME" &>> "$LOGFILE" < /dev/null
prepare "$SCRIPTDIR/pkg/$PKGNAME" &>> "$LOGFILE" < /dev/null
popd > /dev/null
fi
}

View file

@ -1,8 +1,10 @@
apply_patches() {
local PATCH
for PATCH in $SCRIPTDIR/$PKGDIR/$PKGNAME/*.patch; do
patch -p1 < $PATCH
for PATCH in $SCRIPTDIR/pkg/$PKGNAME/*.patch; do
if [ -f $PATCH ]; then
patch -p1 < $PATCH
fi
done
}

View file

@ -1,8 +1,8 @@
run_pkg_command() {
local FUNCTION="$1"
local DEPLOYDIR="$PKGDEPLOYDIR/$2"
local OUT="$PKGBUILDDIR/${PKGDIR}-${PKGNAME}"
local CHECKFILE="$PKGLOGDIR/.${PKGDIR}-${PKGNAME}-${FUNCTION}"
local DEPLOYDIR="$PKGDEPLOYDIR/$PKGNAME"
local OUT="$PKGBUILDDIR/${PKGNAME}"
local CHECKFILE="$PKGLOGDIR/.${PKGNAME}-${FUNCTION}"
echo "$PKGNAME - $FUNCTION"
@ -10,7 +10,7 @@ run_pkg_command() {
return
fi
local LOGFILE="$PKGLOGDIR/${PKGDIR}-${PKGNAME}-${FUNCTION}.log"
local LOGFILE="$PKGLOGDIR/${PKGNAME}-${FUNCTION}.log"
local SRC="$PKGSRCDIR/$SRCDIR"
mkdir -p "$DEPLOYDIR" "$OUT" "${DEPLOYDIR}-dev"

View file

@ -7,10 +7,12 @@ save_toolchain() {
}
restore_toolchain() {
pushd "$TCDIR/$TARGET" > /dev/null
rm -r include lib
tar zxf "${TCDIR}/${TARGET}.tar.gz"
popd > /dev/null
if [ -e "${TCDIR}/${TARGET}.tar.gz" ]; then
pushd "$TCDIR/$TARGET" > /dev/null
rm -r include lib
tar zxf "${TCDIR}/${TARGET}.tar.gz"
popd > /dev/null
fi
}
install_build_deps() {