iglunix/lazypkg.sh

104 lines
1.9 KiB
Bash
Raw Normal View History

#!/bin/sh
2021-02-02 14:43:56 +00:00
export JOBS="16"
2021-01-31 14:39:32 +00:00
export RUSTFLAGS="-C target-feature=-crt-static"
2020-12-28 13:54:13 +00:00
export CC=clang
export CXX=clang++
2020-12-27 16:34:08 +00:00
2021-02-02 14:43:56 +00:00
stat /etc/lazypkg.conf > /dev/null 2> /dev/null && . /etc/lazypkg.conf
export SAMUFLAGS=-j$JOBS
export MAKEFLAGS=-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
2020-12-27 16:34:08 +00:00
cd $srcdir
build
cd $srcdir
echo "
. $dir/build.sh
mkdir -p $dir/out/$pkgname
pkgdir=$dir/out/$pkgname package
mkdir -p $dir/out/$pkgname/usr/share/lazypkg
2020-12-27 16:34:08 +00:00
cat > $dir/out/$pkgname/usr/share/lazypkg/$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
chmod 644 $dir/out/$pkgname/usr/share/lazypkg/$pkgname
2020-12-27 16:34:08 +00:00
cd $srcdir
license >> $dir/out/$pkgname/usr/share/lazypkg/$pkgname
2020-12-27 16:34:08 +00:00
echo >> $dir/out/$pkgname/usr/share/lazypkg/$pkgname
echo [fs] >> $dir/out/$pkgname/usr/share/lazypkg/$pkgname
2020-12-27 16:34:08 +00:00
cd $dir/out/$pkgname/
find * >> $dir/out/$pkgname/usr/share/lazypkg/$pkgname
2020-12-27 16:34:08 +00:00
cd $dir/out/$pkgname
tar -cf ../$pkgname.$pkgver.tar.xz *
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
mkdir -p $dir/out/$pkgname-\$e/usr/share/lazypkg
2020-12-27 16:34:08 +00:00
cat > $dir/out/$pkgname-\$e/usr/share/lazypkg/$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
chmod 644 $dir/out/$pkgname-\$e/usr/share/lazypkg/$pkgname-\$e
2020-12-27 16:34:08 +00:00
cd $srcdir
license >> $dir/out/$pkgname-\$e/usr/share/lazypkg/$pkgname-\$e
2020-12-27 16:34:08 +00:00
echo >> $dir/out/$pkgname-\$e/usr/share/lazypkg/$pkgname-\$e
echo [fs] >> $dir/out/$pkgname-\$e/usr/share/lazypkg/$pkgname-\$e
2020-12-27 16:34:08 +00:00
cd $dir/out/$pkgname-\$e
find * >> $dir/out/$pkgname-\$e/usr/share/lazypkg/$pkgname-\$e
2020-12-27 16:34:08 +00:00
cd $dir/out/$pkgname-\$e
tar -cf ../$pkgname-\$e.$pkgver.tar.xz *
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