1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-24 12:00:42 +01:00

Fix sysroot directory

Use a seperate sysroot directory (stored in variable SYSROOT)
instead of installing everything into the toolchain directory.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2020-03-13 14:17:50 +01:00
parent 80b107050a
commit 1a697b336f
19 changed files with 39 additions and 63 deletions

10
mk.sh
View file

@ -31,11 +31,11 @@ REPODIR="$BUILDROOT/repo"
DEPENDSLIST="$BUILDROOT/depends" DEPENDSLIST="$BUILDROOT/depends"
PROVIDESLIST="$BUILDROOT/provides" PROVIDESLIST="$BUILDROOT/provides"
PREFERESLIST="$BUILDROOT/preferes" PREFERESLIST="$BUILDROOT/preferes"
SYSROOT="$BUILDROOT/sysroot"
declare -A PREFERED_PROVIDER declare -A PREFERED_PROVIDER
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR" mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR" "$REPODIR" "$SYSROOT"
mkdir -p "$REPODIR"
pushd "$SCRIPTDIR" > /dev/null pushd "$SCRIPTDIR" > /dev/null
OS_NAME="Pygos" OS_NAME="Pygos"
@ -98,9 +98,9 @@ cat "$PACKAGELIST"
echo "--- building packages ---" echo "--- building packages ---"
export PKG_CONFIG_SYSROOT_DIR="$TCDIR/$TARGET" export PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
export PKG_CONFIG_LIBDIR="$TCDIR/$TARGET/lib/pkgconfig" export PKG_CONFIG_LIBDIR="$SYSROOT/lib/pkgconfig"
export PKG_CONFIG_PATH="$TCDIR/$TARGET/lib/pkgconfig" export PKG_CONFIG_PATH="$SYSROOT/lib/pkgconfig"
while read pkg; do while read pkg; do
include_pkg "$pkg" include_pkg "$pkg"

View file

@ -10,8 +10,6 @@ prepare() {
} }
build() { build() {
local SYSROOT="$TCDIR/$TARGET"
cp "$SCRIPTDIR/pkg/$PKGNAME/bbstatic.config" "$PKGBUILDDIR/.config" cp "$SCRIPTDIR/pkg/$PKGNAME/bbstatic.config" "$PKGBUILDDIR/.config"
export KBUILD_OUTPUT="$PKGBUILDDIR" export KBUILD_OUTPUT="$PKGBUILDDIR"

View file

@ -7,7 +7,7 @@ build() {
deploy() { deploy() {
cp $SCRIPTDIR/pkg/initrd/*.{desc,files} "$PKGDEPLOYDIR" cp $SCRIPTDIR/pkg/initrd/*.{desc,files} "$PKGDEPLOYDIR"
pkg install -R "$REPODIR" -r "$TCDIR/$TARGET" -l pkg $DEPENDS \ pkg install -R "$REPODIR" -r "$SYSROOT" -l pkg $DEPENDS \
>> "$PKGDEPLOYDIR/initrd.files" >> "$PKGDEPLOYDIR/initrd.files"
echo "file init 0755 0 0 $SCRIPTDIR/pkg/$PKGNAME/initrd.skel" \ echo "file init 0755 0 0 $SCRIPTDIR/pkg/$PKGNAME/initrd.skel" \

View file

@ -24,14 +24,14 @@ build() {
make CCOPTS="-O2 $cflags" LDFLAGS="$ldflags" \ make CCOPTS="-O2 $cflags" LDFLAGS="$ldflags" \
HOSTCC="gcc" AR="${TARGET}-ar" LD="${TARGET}-ld" \ HOSTCC="gcc" AR="${TARGET}-ar" LD="${TARGET}-ld" \
CC="${TARGET}-gcc" PREFIX="" SBINDIR="/bin" \ CC="${TARGET}-gcc" PREFIX="" SBINDIR="/bin" \
KERNEL_INCLUDE="$TCDIR/$TARGET/include" \ KERNEL_INCLUDE="$SYSROOT/include" \
DBM_INCLUDE="$TCDIR/$TARGET/include" DBM_INCLUDE="$SYSROOT/include"
} }
deploy() { deploy() {
make DESTDIR="$PKGDEPLOYDIR" PREFIX="" SBINDIR="/bin" \ make DESTDIR="$PKGDEPLOYDIR" PREFIX="" SBINDIR="/bin" \
KERNEL_INCLUDE="$TCDIR/$TARGET/include" \ KERNEL_INCLUDE="$SYSROOT/include" \
DBM_INCLUDE="$TCDIR/$TARGET/include" install DBM_INCLUDE="$SYSROOT/include" install
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR" cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
} }

View file

@ -12,7 +12,7 @@ prepare() {
build() { build() {
run_configure "$1" --with-drill --without-pyldns --without-pyldnsx \ run_configure "$1" --with-drill --without-pyldns --without-pyldnsx \
--without-p5-dns-ldns --with-ssl="$TCDIR/$TARGET" --without-p5-dns-ldns --with-ssl="$SYSROOT"
make -j $NUMJOBS make -j $NUMJOBS
} }

View file

@ -12,7 +12,7 @@ prepare() {
build() { build() {
cp -r ${1}/* ${PKGBUILDDIR} cp -r ${1}/* ${PKGBUILDDIR}
sed -i "s#/usr/include/libnl3#$TCDIR/$TARGET/include/libnl3#g" configure sed -i "s#/usr/include/libnl3#$SYSROOT/include/libnl3#g" configure
run_configure "." --with-pcap=linux --enable-ipv6 run_configure "." --with-pcap=linux --enable-ipv6
make -j $NUMJOBS make -j $NUMJOBS

View file

@ -11,8 +11,8 @@ prepare() {
build() { build() {
CFLAGS=-fno-stack-protector \ CFLAGS=-fno-stack-protector \
run_configure "$1" --with-openssl-libdir="$TCDIR/$TARGET/lib" \ run_configure "$1" --with-openssl-libdir="$SYSROOT/lib" \
--with-openssl-incdir="$TCDIR/$TARGET/include" \ --with-openssl-incdir="$SYSROOT/include" \
--with-yielding-select=yes --enable-ipv6 \ --with-yielding-select=yes --enable-ipv6 \
--with-lineeditlibs=readline --without-rpath \ --with-lineeditlibs=readline --without-rpath \
--without-sntp --with-ntpsnmpd --without-sntp --with-ntpsnmpd

View file

@ -4,7 +4,7 @@ SUBPKG="release"
build() { build() {
pkg install -om -r "$PKGBUILDDIR/$OS_RELEASE" linux pkg install -om -r "$PKGBUILDDIR/$OS_RELEASE" linux
pkg dump -l pkg -r "$TCDIR/$TARGET" "$REPODIR/rootfs.pkg" \ pkg dump -l pkg -r "$SYSROOT" "$REPODIR/rootfs.pkg" \
> "$PKGBUILDDIR/files.txt" > "$PKGBUILDDIR/files.txt"
gensquashfs -F "$PKGBUILDDIR/files.txt" "$OS_RELEASE/rootfs.img" gensquashfs -F "$PKGBUILDDIR/files.txt" "$OS_RELEASE/rootfs.img"

View file

@ -4,7 +4,7 @@ SUBPKG="release"
build() { build() {
pkg install -om -r "$PKGBUILDDIR/$OS_RELEASE" linux pkg install -om -r "$PKGBUILDDIR/$OS_RELEASE" linux
pkg dump -l pkg -r "$TCDIR/$TARGET" "$REPODIR/rootfs.pkg" \ pkg dump -l pkg -r "$SYSROOT" "$REPODIR/rootfs.pkg" \
> "$PKGBUILDDIR/files.txt" > "$PKGBUILDDIR/files.txt"
gensquashfs -F "$PKGBUILDDIR/files.txt" "$OS_RELEASE/rootfs.img" gensquashfs -F "$PKGBUILDDIR/files.txt" "$OS_RELEASE/rootfs.img"

View file

@ -5,7 +5,7 @@ build() {
pkg install -om -r "$PKGBUILDDIR/boot" \ pkg install -om -r "$PKGBUILDDIR/boot" \
boot-rpi boot-rpi-dtbo boot-rpi-dtb linux boot-rpi boot-rpi-dtbo boot-rpi-dtb linux
pkg dump -l pkg -r "$TCDIR/$TARGET" "$REPODIR/rootfs.pkg" \ pkg dump -l pkg -r "$SYSROOT" "$REPODIR/rootfs.pkg" \
> "$PKGBUILDDIR/files.txt" > "$PKGBUILDDIR/files.txt"
gensquashfs -F "$PKGBUILDDIR/files.txt" "boot/rootfs.img" gensquashfs -F "$PKGBUILDDIR/files.txt" "boot/rootfs.img"

View file

@ -5,16 +5,16 @@ build() {
local desc="$PKGDEPLOYDIR/$PKGNAME.desc" local desc="$PKGDEPLOYDIR/$PKGNAME.desc"
# generate package description and file listing # generate package description and file listing
pkg install -l pkg -r "$TCDIR/$TARGET" $DEPENDS | sort -u > "$listing" pkg install -l pkg -r "$SYSROOT" $DEPENDS | sort -u > "$listing"
touch "$desc" touch "$desc"
# move configuration to preserve directory # move configuration to preserve directory
mkdir -pv "$TCDIR/$TARGET/cfg/preserve" "$TCDIR/$TARGET/cfg/overlay" mkdir -pv "$SYSROOT/cfg/preserve" "$SYSROOT/cfg/overlay"
mv "$TCDIR/$TARGET/etc" "$TCDIR/$TARGET/cfg/preserve/etc" mv "$SYSROOT/etc" "$SYSROOT/cfg/preserve/etc"
mv "$TCDIR/$TARGET/usr" "$TCDIR/$TARGET/cfg/preserve/usr" mv "$SYSROOT/usr" "$SYSROOT/cfg/preserve/usr"
mv "$TCDIR/$TARGET/var/lib" "$TCDIR/$TARGET/cfg/preserve/var_lib" mv "$SYSROOT/var/lib" "$SYSROOT/cfg/preserve/var_lib"
rm -rf "$TCDIR/$TARGET/var" rm -rf "$SYSROOT/var"
sed -i 's#etc/#cfg/preserve/etc/#g' "$listing" sed -i 's#etc/#cfg/preserve/etc/#g' "$listing"
sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$listing" sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$listing"

View file

@ -13,10 +13,10 @@ build() {
local extra="$BINUTILS_EXTRACFG" local extra="$BINUTILS_EXTRACFG"
$1/configure --prefix="$TCDIR" --target="$TARGET" --disable-nls \ $1/configure --prefix="$TCDIR" --target="$TARGET" --disable-nls \
--with-sysroot="$TCDIR/$TARGET" --disable-multilib \ --with-sysroot="$SYSROOT" --disable-multilib \
--enable-shared --enable-plugins --enable-relro \ --enable-shared --enable-plugins --enable-relro \
--with-pic --enable-deterministic-archives \ --with-pic --enable-deterministic-archives \
--with-lib-path="$TCDIR/$TARGET/lib" $extra --with-lib-path="$SYSROOT/lib" $extra
make configure-host make configure-host
make -j $NUMJOBS make -j $NUMJOBS
@ -24,28 +24,7 @@ build() {
deploy() { deploy() {
make install make install
touch "$PKGDEPLOYDIR/$PKGNAME.desc" "$PKGDEPLOYDIR/$PKGNAME.files"
cat > "$PKGDEPLOYDIR/$PKGNAME.files" <<_EOF
dir bin 0755 0 0
dir lib 0755 0 0
dir lib/ldscripts 0755 0 0
file bin/ar 0755 0 0 $TCDIR/$TARGET/bin/ar
file bin/as 0755 0 0 $TCDIR/$TARGET/bin/as
file bin/ld 0755 0 0 $TCDIR/$TARGET/bin/ld
file bin/ld.bfd 0755 0 0 $TCDIR/$TARGET/bin/ld.bfd
file bin/nm 0755 0 0 $TCDIR/$TARGET/bin/nm
file bin/objcopy 0755 0 0 $TCDIR/$TARGET/bin/objcopy
file bin/objdump 0755 0 0 $TCDIR/$TARGET/bin/objdump
file bin/ranlib 0755 0 0 $TCDIR/$TARGET/bin/ranlib
file bin/readelf 0755 0 0 $TCDIR/$TARGET/bin/readelf
file bin/strip 0755 0 0 $TCDIR/$TARGET/bin/strip
_EOF
find -H "$TCDIR/$TARGET/lib/ldscripts" -type f \
-printf "file lib/ldscripts/%f 0%m 0 0 %p\\n" \
>> "$PKGDEPLOYDIR/$PKGNAME.files"
touch "$PKGDEPLOYDIR/$PKGNAME.desc"
} }
check_update() { check_update() {

View file

@ -33,7 +33,7 @@ build() {
$1/configure --prefix="$TCDIR" --target="$TARGET" \ $1/configure --prefix="$TCDIR" --target="$TARGET" \
--build="$HOSTTUPLE" --host="$HOSTTUPLE" \ --build="$HOSTTUPLE" --host="$HOSTTUPLE" \
--with-sysroot="$TCDIR/$TARGET" \ --with-sysroot="$SYSROOT" \
--disable-nls --disable-shared --without-headers \ --disable-nls --disable-shared --without-headers \
--disable-multilib --disable-decimal-float \ --disable-multilib --disable-decimal-float \
--disable-libgomp --disable-libmudflap \ --disable-libgomp --disable-libmudflap \

View file

@ -13,7 +13,7 @@ build() {
$1/configure --prefix="$TCDIR" --target="$TARGET" \ $1/configure --prefix="$TCDIR" --target="$TARGET" \
--build="$HOSTTUPLE" --host="$HOSTTUPLE" \ --build="$HOSTTUPLE" --host="$HOSTTUPLE" \
--with-sysroot="$TCDIR/$TARGET" \ --with-sysroot="$SYSROOT" \
--disable-nls --enable-languages=c,c++ \ --disable-nls --enable-languages=c,c++ \
--enable-c99 --enable-long-long \ --enable-c99 --enable-long-long \
--enable-libmudflap --disable-multilib \ --enable-libmudflap --disable-multilib \
@ -30,11 +30,11 @@ deploy() {
make install make install
mkdir -p "$PKGDEPLOYDIR/lib" mkdir -p "$PKGDEPLOYDIR/lib"
mv ${TCDIR}/${TARGET}/{include,lib} "$PKGDEPLOYDIR" mv "$TCDIR/$TARGET/lib" "$PKGDEPLOYDIR"
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR" mkdir -p "$TCDIR/$TARGET/lib"
mv "$PKGDEPLOYDIR/lib/ldscripts" "$TCDIR/$TARGET/lib"
pkg_scan_dir "$PKGDEPLOYDIR/include/c++" |\ cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/libstdc++-dev.files"
if [ -f "$PKGDEPLOYDIR/lib/libmpx.a" ]; then if [ -f "$PKGDEPLOYDIR/lib/libmpx.a" ]; then
cat >> "$PKGDEPLOYDIR/libgcc-dev.files" <<_EOF cat >> "$PKGDEPLOYDIR/libgcc-dev.files" <<_EOF

View file

@ -13,7 +13,7 @@ build() {
$1/configure --prefix="$TCDIR" --disable-static \ $1/configure --prefix="$TCDIR" --disable-static \
--build="$HOSTTUPLE" --host="$HOSTTUPLE" \ --build="$HOSTTUPLE" --host="$HOSTTUPLE" \
--with-repo-dir="$REPODIR" \ --with-repo-dir="$REPODIR" \
--with-install-root="$TCDIR/$TARGET" --with-install-root="$SYSROOT"
make -j $NUMJOBS make -j $NUMJOBS
} }

View file

@ -11,7 +11,7 @@ prepare() {
build() { build() {
run_configure "$1" --with-system-libpcap --with-cap-ng \ run_configure "$1" --with-system-libpcap --with-cap-ng \
--with-crypto="$TCDIR/$TARGET" --with-crypto="$SYSROOT"
make -j $NUMJOBS make -j $NUMJOBS
} }

View file

@ -9,7 +9,7 @@ deploy() {
cat > "$CMAKETCFILE" << _EOF cat > "$CMAKETCFILE" << _EOF
set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSROOT ${TCDIR}/${TARGET}) set(CMAKE_SYSROOT ${SYSROOT})
set(CMAKE_C_COMPILER ${TCDIR}/bin/${TARGET}-gcc) set(CMAKE_C_COMPILER ${TCDIR}/bin/${TARGET}-gcc)
set(CMAKE_C_COMPILER_TARGET ${TARGET}) set(CMAKE_C_COMPILER_TARGET ${TARGET})

View file

@ -12,8 +12,7 @@ prepare() {
build() { build() {
run_configure "$1" --with-pidfile=/run/unbound.pid \ run_configure "$1" --with-pidfile=/run/unbound.pid \
--with-libexpat="$TCDIR/$TARGET" \ --with-libexpat="$SYSROOT" --with-ssl="$SYSROOT"
--with-ssl="$TCDIR/$TARGET"
make -j $NUMJOBS make -j $NUMJOBS
} }

View file

@ -18,8 +18,8 @@ build_package() {
fetch_package fetch_package
rm -rf "$TCDIR/$TARGET" "$PKGBUILDDIR" "$PKGDEPLOYDIR" rm -rf "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
mkdir -p "$TCDIR/$TARGET" "$PKGBUILDDIR" "$PKGDEPLOYDIR" mkdir -p "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
if [ ! -z "$DEPENDS" ]; then if [ ! -z "$DEPENDS" ]; then
pkg install -omD $DEPENDS pkg install -omD $DEPENDS
@ -35,5 +35,5 @@ build_package() {
-l "$PKGDEPLOYDIR/${f}.files" -l "$PKGDEPLOYDIR/${f}.files"
done done
rm -rf "$TCDIR/$TARGET" "$PKGBUILDDIR" "$PKGDEPLOYDIR" rm -rf "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
} }