1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-13 06:57:11 +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"
PROVIDESLIST="$BUILDROOT/provides"
PREFERESLIST="$BUILDROOT/preferes"
SYSROOT="$BUILDROOT/sysroot"
declare -A PREFERED_PROVIDER
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR"
mkdir -p "$REPODIR"
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR" "$REPODIR" "$SYSROOT"
pushd "$SCRIPTDIR" > /dev/null
OS_NAME="Pygos"
@ -98,9 +98,9 @@ cat "$PACKAGELIST"
echo "--- building packages ---"
export PKG_CONFIG_SYSROOT_DIR="$TCDIR/$TARGET"
export PKG_CONFIG_LIBDIR="$TCDIR/$TARGET/lib/pkgconfig"
export PKG_CONFIG_PATH="$TCDIR/$TARGET/lib/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
export PKG_CONFIG_LIBDIR="$SYSROOT/lib/pkgconfig"
export PKG_CONFIG_PATH="$SYSROOT/lib/pkgconfig"
while read pkg; do
include_pkg "$pkg"

View file

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

View file

@ -7,7 +7,7 @@ build() {
deploy() {
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"
echo "file init 0755 0 0 $SCRIPTDIR/pkg/$PKGNAME/initrd.skel" \

View file

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

View file

@ -12,7 +12,7 @@ prepare() {
build() {
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
}

View file

@ -12,7 +12,7 @@ prepare() {
build() {
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
make -j $NUMJOBS

View file

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

View file

@ -4,7 +4,7 @@ SUBPKG="release"
build() {
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"
gensquashfs -F "$PKGBUILDDIR/files.txt" "$OS_RELEASE/rootfs.img"

View file

@ -4,7 +4,7 @@ SUBPKG="release"
build() {
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"
gensquashfs -F "$PKGBUILDDIR/files.txt" "$OS_RELEASE/rootfs.img"

View file

@ -5,7 +5,7 @@ build() {
pkg install -om -r "$PKGBUILDDIR/boot" \
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"
gensquashfs -F "$PKGBUILDDIR/files.txt" "boot/rootfs.img"

View file

@ -5,16 +5,16 @@ build() {
local desc="$PKGDEPLOYDIR/$PKGNAME.desc"
# 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"
# 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 "$TCDIR/$TARGET/usr" "$TCDIR/$TARGET/cfg/preserve/usr"
mv "$TCDIR/$TARGET/var/lib" "$TCDIR/$TARGET/cfg/preserve/var_lib"
rm -rf "$TCDIR/$TARGET/var"
mv "$SYSROOT/etc" "$SYSROOT/cfg/preserve/etc"
mv "$SYSROOT/usr" "$SYSROOT/cfg/preserve/usr"
mv "$SYSROOT/var/lib" "$SYSROOT/cfg/preserve/var_lib"
rm -rf "$SYSROOT/var"
sed -i 's#etc/#cfg/preserve/etc/#g' "$listing"
sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$listing"

View file

@ -13,10 +13,10 @@ build() {
local extra="$BINUTILS_EXTRACFG"
$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 \
--with-pic --enable-deterministic-archives \
--with-lib-path="$TCDIR/$TARGET/lib" $extra
--with-lib-path="$SYSROOT/lib" $extra
make configure-host
make -j $NUMJOBS
@ -24,28 +24,7 @@ build() {
deploy() {
make install
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"
touch "$PKGDEPLOYDIR/$PKGNAME.desc" "$PKGDEPLOYDIR/$PKGNAME.files"
}
check_update() {

View file

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

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@ deploy() {
cat > "$CMAKETCFILE" << _EOF
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_TARGET ${TARGET})

View file

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

View file

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