iglunix/scripts/iglupkg.sh

113 lines
2.3 KiB
Bash
Raw Normal View History

#!/bin/sh
export JOBS="$(nproc)"
2021-02-02 14:43:56 +00:00
#export RUSTFLAGS="-C target-cpu=native"
2020-12-28 13:54:13 +00:00
export CC=clang
export CXX=clang++
2021-06-12 08:55:17 +00:00
export ARCH=$(uname -m)
export KERN=linux
export ABI=musl
export TRIPLE=$ARCH-unknown-$KERN-$ABI
2020-12-27 16:34:08 +00:00
#export CFLAGS="-march=native"
#export CXXFLAGS="-march=native"
2021-02-10 19:04:00 +00:00
2021-02-09 20:50:19 +00:00
stat /etc/iglupkg.conf > /dev/null 2> /dev/null && . /etc/iglupkg.conf
2021-02-02 14:43:56 +00:00
export SAMUFLAGS=-j$JOBS
2020-12-27 16:34:08 +00:00
. ./build.sh
dir=$(pwd)
stat out > /dev/null && rm -rf out
2021-01-13 08:34:27 +00:00
mkdir out
function do_fetch() {
mkdir -p src
cd src
srcdir=$(pwd) fetch
}
srcdir=$(pwd)/src
2021-01-31 01:49:02 +00:00
stat src > /dev/null 2>/dev/null || do_fetch
stat src > /dev/null 2>/dev/null && echo '=========================================='
stat src > /dev/null 2>/dev/null && echo 'Warning: `./src/` found: not running fetch'
stat src > /dev/null 2>/dev/null && echo '=========================================='
2020-12-27 16:34:08 +00:00
cd $srcdir
MAKEFLAGS=-j$JOBS build
2020-12-27 16:34:08 +00:00
cd $srcdir
echo "
. $dir/build.sh
mkdir -p $dir/out/$pkgname
pkgdir=$dir/out/$pkgname package
2021-02-10 19:00:20 +00:00
mkdir -p $dir/out/$pkgname/usr/share/iglupkg
2020-12-27 16:34:08 +00:00
2021-02-10 19:00:20 +00:00
cat > $dir/out/$pkgname/usr/share/iglupkg/$pkgname << EOF
2020-12-27 16:34:08 +00:00
[pkg]
name=$pkgname
ver=$pkgver
2021-01-31 01:49:02 +00:00
deps=$deps
2020-12-27 16:34:08 +00:00
[license]
EOF
2021-02-10 19:00:20 +00:00
chmod 644 $dir/out/$pkgname/usr/share/iglupkg/$pkgname
2020-12-27 16:34:08 +00:00
cd $srcdir
2021-02-10 19:00:20 +00:00
license >> $dir/out/$pkgname/usr/share/iglupkg/$pkgname
2020-12-27 16:34:08 +00:00
2021-02-10 19:00:20 +00:00
echo >> $dir/out/$pkgname/usr/share/iglupkg/$pkgname
echo [fs] >> $dir/out/$pkgname/usr/share/iglupkg/$pkgname
2020-12-27 16:34:08 +00:00
cd $dir/out/$pkgname/
2021-02-10 19:00:20 +00:00
find * >> $dir/out/$pkgname/usr/share/iglupkg/$pkgname
2020-12-27 16:34:08 +00:00
cd $dir/out/$pkgname
tar -I zstd -cf ../$pkgname.$pkgver.tar.zst *
2021-02-02 14:43:56 +00:00
if [ $ext ]; then
2020-12-27 16:34:08 +00:00
echo $ext | tr ':' '\n' | while read e; do
echo \$e
cd $srcdir
mkdir -p $dir/out/$pkgname-\$e
pkgdir=$dir/out/$pkgname-\$e
2020-12-28 13:54:13 +00:00
package_\$(echo \$e | tr '-' '_')
2020-12-27 16:34:08 +00:00
2021-02-10 19:00:20 +00:00
mkdir -p $dir/out/$pkgname-\$e/usr/share/iglupkg
2020-12-27 16:34:08 +00:00
2021-02-10 19:00:20 +00:00
cat > $dir/out/$pkgname-\$e/usr/share/iglupkg/$pkgname-\$e << EOF
2020-12-27 16:34:08 +00:00
[pkg]
name=$pkgname-\$e
ver=$pkgver
2021-01-31 01:49:02 +00:00
deps=$pkgname
2020-12-27 16:34:08 +00:00
[license]
EOF
2021-02-10 19:00:20 +00:00
chmod 644 $dir/out/$pkgname-\$e/usr/share/iglupkg/$pkgname-\$e
2020-12-27 16:34:08 +00:00
cd $srcdir
2021-02-10 19:00:20 +00:00
license >> $dir/out/$pkgname-\$e/usr/share/iglupkg/$pkgname-\$e
2020-12-27 16:34:08 +00:00
2021-02-10 19:00:20 +00:00
echo >> $dir/out/$pkgname-\$e/usr/share/iglupkg/$pkgname-\$e
echo [fs] >> $dir/out/$pkgname-\$e/usr/share/iglupkg/$pkgname-\$e
2020-12-27 16:34:08 +00:00
cd $dir/out/$pkgname-\$e
2021-02-10 19:00:20 +00:00
find * >> $dir/out/$pkgname-\$e/usr/share/iglupkg/$pkgname-\$e
2020-12-27 16:34:08 +00:00
cd $dir/out/$pkgname-\$e
tar -I zstd -cf ../$pkgname-\$e.$pkgver.tar.zst *
2020-12-27 16:34:08 +00:00
done
2021-02-02 14:43:56 +00:00
fi
2020-12-27 16:34:08 +00:00
" | sh
2020-12-27 16:34:08 +00:00
cd $dir