linux-qubasis
linux oasis port as a qubes template
git clone https://9o.is/git/linux-qubasis.git
commit cf3cb1fb8998a64459127f30f18de9355f72e6a0 parent 49f054d6b76bd894e52e24289eabbe850b32f1b4 Author: Jul <jul@9o.is> Date: Fri, 14 Nov 2025 14:19:51 -0500 refactor ninja shell scripts for packages Diffstat:
| M | .gitignore | | | 4 | ++-- |
| M | gen.sh | | | 70 | ++++++++++++---------------------------------------------------------- |
| A | genfn.sh | | | 221 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | pkg/ag/gen.sh | | | 6 | +++--- |
| M | pkg/awk/gen.sh | | | 39 | +++++++++++++++++++-------------------- |
| M | pkg/b3sum/gen.sh | | | 24 | ++++++++---------------- |
| M | pkg/bestline/gen.sh | | | 2 | +- |
| M | pkg/byacc/gen.sh | | | 12 | ++++++------ |
| M | pkg/bzip2/gen.sh | | | 8 | ++------ |
| M | pkg/e2fsprogs/gen.sh | | | 193 | ++++++++++++++++++++++++++++++++++++++++--------------------------------------- |
| M | pkg/freetype/gen.sh | | | 16 | ++++++++-------- |
| M | pkg/fspec-sync/gen.sh | | | 16 | ++++++++-------- |
| M | pkg/fzy/gen.sh | | | 12 | +++++++----- |
| A | pkg/gen.sh | | | 106 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | pkg/genfn.sh | | | 277 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | pkg/less/gen.sh | | | 8 | ++++---- |
| M | pkg/libpng/gen.sh | | | 36 | ++++++++++++++++++------------------ |
| M | pkg/libtermkey/gen.sh | | | 4 | ++-- |
| M | pkg/linux-headers/gen.sh | | | 62 | +++++++++++++++++++++++++++++++------------------------------- |
| M | pkg/lua/gen.sh | | | 18 | +++++------------- |
| M | pkg/mandoc/gen.sh | | | 12 | ++++++------ |
| M | pkg/netbsd-curses/gen.sh | | | 107 | +++++++++++++++++++++++++++++++++++++++++++------------------------------------ |
| M | pkg/oksh/gen.sh | | | 10 | +++++----- |
| M | pkg/pax/gen.sh | | | 8 | ++++---- |
| M | pkg/pcre/gen.sh | | | 27 | ++++++++++++++++----------- |
| M | pkg/perp/gen.sh | | | 77 | +++++++++++++++++++++++++++++++++++++++++------------------------------------ |
| M | pkg/probe/gen.sh | | | 7 | +++++-- |
| M | pkg/probe/probe-size.sh | | | 5 | +++-- |
| M | pkg/probe/probe.sh | | | 5 | +++-- |
| A | pkg/rsp.awk | | | 35 | +++++++++++++++++++++++++++++++++++ |
| M | pkg/sbase/gen.sh | | | 40 | +++++++++++++++++++++------------------- |
| M | pkg/sinit/gen.sh | | | 8 | ++++---- |
| M | pkg/ubase/gen.sh | | | 26 | ++++++++++++++------------ |
| M | pkg/ubase/mount.swap | | | 4 | ++-- |
| M | pkg/util-linux/gen.sh | | | 157 | +++++++++++++++++++++++++++++++++++++++---------------------------------------- |
| M | pkg/vis/gen.sh | | | 60 | +++++++++++++++++++++++++++++++----------------------------- |
| M | pkg/xz/gen.sh | | | 34 | +++++++++++++++++----------------- |
| M | pkg/zlib/gen.sh | | | 20 | ++++++++------------ |
| M | pkg/zstd/gen.sh | | | 26 | +++++++++++++------------- |
39 files changed, 1201 insertions(+), 601 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -1,3 +1,3 @@ /out -/config.sh -/build.ninja +*.ninja +*.tmp diff --git a/gen.sh b/gen.sh @@ -1,62 +1,16 @@ -setv ninja_required_version 1.8 -setv basedir . -setv builddir $BUILDDIR -setv outdir $builddir -setv ninjadir $builddir/ninja -setv pkgdir $builddir/pkg -setv hostdir $builddir/host -setv dir $basedir +#!/bin/sh +set -eu +. ./genfn.sh -setv ar $TARGET_PLATFORM-ar -setv as $TARGET_PLATFORM-as -setv cc $TARGET_PLATFORM-cc -setv ld $TARGET_PLATFORM-ld -setv objcopy $TARGET_PLATFORM-objcopy -setv cflags $TARGET_CFLAGS -setv ldflags $TARGET_LDFLAGS +var ninja_required_version 1.8 +var builddir out +var dir . +var outdir $builddir -include_ninja $basedir/ninja/rules.ninja +rule gen './gen.sh $dir' +bind description 'GEN $dir' +bind generator 1 -subgen pkg/ag -subgen pkg/awk -subgen pkg/b3sum -subgen pkg/bestline -subgen pkg/byacc -subgen pkg/bzip2 -subgen pkg/e2fsprogs -subgen pkg/fe -subgen pkg/freetype -subgen pkg/fspec-sync -subgen pkg/fzy -subgen pkg/less -subgen pkg/libpng -subgen pkg/libtermkey -subgen pkg/linux-headers -subgen pkg/lpeg -subgen pkg/lua -subgen pkg/luaposix -subgen pkg/mandoc -subgen pkg/netbsd-curses -subgen pkg/oksh -subgen pkg/pax -subgen pkg/pcre -subgen pkg/perp -subgen pkg/probe -subgen pkg/rc -subgen pkg/sbase -subgen pkg/sinit -subgen pkg/st -subgen pkg/ubase -subgen pkg/util-linux -subgen pkg/vis -subgen pkg/xz -subgen pkg/zlib -subgen pkg/zstd +subgen pkg -# subgen pkg/qubes-core-qrexec -# subgen pkg/qubes-core-vchan-xen -# subgen pkg/xen -# subgen pkg/yajl -# subgen tpl/example -# subgen tpl/alpine-template -# subgen tpl/f42 +phony build.ninja $dir/ninja diff --git a/genfn.sh b/genfn.sh @@ -0,0 +1,221 @@ +main() { + DIR=. + GEN_FILES='./gen.sh ./genfn.sh' + NINJA_FILES=./local.ninja + + set_target "$1" + init_file + trap gen_done EXIT +} + +init_file() { + if persist && [ -e $DIR/local.ninja.tmp ]; then + rm -f $DIR/local.ninja.tmp + fi +} + +gen_done() { + gen $dir/local.ninja '|' $GEN_FILES + phony $dir/ninja $NINJA_FILES + + if persist && [ -e $DIR/local.ninja.tmp ]; then + mv $DIR/local.ninja.tmp $DIR/local.ninja + fi + + wait +} + +import() { + GEN_FILES="$GEN_FILES $DIR/$1" + . $DIR/$1 +} + +set_target() { + TARGET= + TARGET_ROUTE= + + case "$1" in + .|./) + TARGET=. + ;; + '') + return + ;; + *) + TARGET=${1%/} + TARGET=./${TARGET#./} + set_target_route $TARGET + ;; + esac +} + +set_target_route() { + TARGET_ROUTE="$TARGET_ROUTE $1" + if [ $1 = . ]; then return; fi + set_target_route $(dirname $1) +} + +in_target_route() { + [ ! "$TARGET" ] || has $DIR/$1 $TARGET_ROUTE +} + +persist() { + [ ! "$TARGET" ] || [ $TARGET = $DIR ] +} + +write() { + if persist; then + printf '%s\n' "$@" >> $DIR/local.ninja.tmp + fi +} + +subgen() { + write "subninja $dir/$1/local.ninja" + NINJA_FILES="$NINJA_FILES $dir/$1/ninja" + + if in_target_route $1; then + ( + DIR=$DIR/$1 + GEN_FILES="$GEN_FILES $DIR/gen.sh" + NINJA_FILES=$DIR/local.ninja + + init_file + + var dir $dir/$1 + var outdir $outdir/$1 + + [ "${2-}" ] && eval "$2 $1" + + . $DIR/gen.sh + + [ "${3-}" ] && eval "$3 $1" + + gen_done + ) & + fi +} + +var() { + _v1=$1 + shift + inline _vs $* + write "$_v1 = $_vs" + eval "$_v1='\$$_v1'" +} + +bind() { + _v1=$1 + shift + inline _vs $* + write " $_v1 = $_vs" +} + +build() { + _v1=$1 + prefix _v2 $outdir $2 + shift 2 + prefix _vs $dir $* + build_parse $_vs + write "build $_v2: $_v1 $_vs $_vd $_vo" +} + +build_parse() { + _vs= + _vd= + _vo= + _mode=vs + + for _v in $*; do + case $_v in + '|') _mode=vd;; + '||') _mode=vo;; + *) + case $_mode in + vs) _vs="$_vs $_v";; + vd) _vd="${_vd:-|} $_v";; + vo) _vo="${_vo:-||} $_v";; + esac + esac + done +} + +rule() { + _rule=$1 + _cmd="$2" + + write "rule $_rule" + bind command "$_cmd" + + _d= + for _v in $_cmd; do + case "$_v" in + *\$*dir/*) _d="${_d:-'|'} \$${_v#*$}";; + esac + done + + eval "$_rule() { _v=\"\$1\"; shift; build $_rule \"\$_v\" \$* $_d; }" +} + +default() { + prefix _v $dir $1 + write "default $_v" +} + +phony() { + prefix _out $dir $1 + shift + write "build $_out: phony $*" +} + +prefix() { + _var=$1 + _pre=$2 + _vs= + shift 2 + + for _v in $*; do + case $_v in + \$* | \|* | /* | .*) ;; + *) _v=$_pre/$_v;; + esac + _vs="$_vs $_v" + done + + eval "$_var='$_vs'" +} + +inline() { + _var=$1 + _vs= + shift + + for _v in $*; do + _vs="$_vs $_v" + done + + eval "$_var='$_vs'" +} + +error() { + printf "Error gen $DIR: %s\n" "$*" + exit 1 +} + +has() { + _val=$1 + shift + for _v in $*; do + if [ $_v = $_val ]; then + return 0 + fi + done + return 1 +} + +foreach() { + while read -r line; do + $2 $line + done <$DIR/$1 +} + +main "${1-}" diff --git a/pkg/ag/gen.sh b/pkg/ag/gen.sh @@ -1,8 +1,8 @@ -fetch git +fetch git 2.2.0 cflags " - -D _GNU_SOURCE - -I $dir + -D_GNU_SOURCE + -I$dir -isystem $pkgdir/pcre/include -isystem $pkgdir/zlib/include -Wno-pedantic diff --git a/pkg/awk/gen.sh b/pkg/awk/gen.sh @@ -1,32 +1,25 @@ -fetch git - -setv yaccdir $outdir/_yacc +fetch git 20250116 cflags " -std=c11 - -I $srcdir - -I $yaccdir - -D _XOPEN_SOURCE=700 + -I$srcdir + -I$outdir + -D_XOPEN_SOURCE=700 -Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-parameter " -rule yacc '$hostdir/yacc $yaccflags $in >/dev/null' -rule maketab '$hostdir/maketab $in >$out' +rule yacc '$hostdir/yacc $yaccflags $in >/dev/null 2>&1' +bind description 'YACC $out' -dep $yaccdir/awkgram.tab.h +rule maketab '$hostdir/maketab $in >$out' +bind description 'MAKETAB $out' -yacc '$yaccdir/awkgram.tab.c $yaccdir/awkgram.tab.h' awkgram.y -bind yaccflags -d -b $yaccdir/awkgram +yacc 'awkgram.tab.c awkgram.tab.h' awkgram.y +bind yaccflags -d -b $outdir/awkgram -maketab $yaccdir/proctab.c $yaccdir/awkgram.tab.h - -host() { - cflags -I $yaccdir - dep $yaccdir/awkgram.tab.h - exe maketab maketab.c -} +maketab proctab.c $outdir/awkgram.tab.h exe awk " b.c @@ -36,8 +29,14 @@ exe awk " parse.c run.c tran.c - $yaccdir/awkgram.tab.c - $yaccdir/proctab.c + $outdir/awkgram.tab.c + $outdir/awkgram.tab.h + $outdir/proctab.c " man awk.1 + +host() { + cflags -I$tgtdir + exe maketab maketab.c $tgtdir/awkgram.tab.h +} diff --git a/pkg/b3sum/gen.sh b/pkg/b3sum/gen.sh @@ -1,8 +1,8 @@ -fetch git +fetch git d995c3d cflags " -std=c99 - -D WITH_ASM + -DWITH_ASM " include blake3.h @@ -13,10 +13,6 @@ libblake3_srcs=" blake3_portable.c " -host() { - lib libblake3.a $libblake3_srcs -} - if [ $TARGET_ARCH = x86_64 ]; then blake3_x86_64=" blake3_cpuid.S @@ -27,14 +23,10 @@ if [ $TARGET_ARCH = x86_64 ]; then " fi -lib libblake3.a " - $libblake3_srcs - ${blake3_x86_64-} -" - -exe b3sum " - b3sum.c - $outdir/libblake3.a -" - +lib libblake3.a "$libblake3_srcs ${blake3_x86_64-}" +exe b3sum b3sum.c $libdir/libblake3.a man b3sum.1 + +host() { + lib libblake3.a $libblake3_srcs +} diff --git a/pkg/bestline/gen.sh b/pkg/bestline/gen.sh @@ -1,4 +1,4 @@ -fetch git +fetch git 5a0bc4b cflags " -std=c99 diff --git a/pkg/byacc/gen.sh b/pkg/byacc/gen.sh @@ -2,9 +2,9 @@ fetch curl https://invisible-mirror.net/archives/byacc/byacc-20241231.tgz \ 192c2fae048d4e7f514ba451627f9c4e612765099f819c19191f9fde3e609673 cflags " - -I $dir - -D HAVE_CONFIG_H - -D YYPATCH=20241231 + -I$dir + -DHAVE_CONFIG_H + -DYYPATCH=20241231 " byacc_srcs=" @@ -24,9 +24,9 @@ byacc_srcs=" yaccpar.c " +exe yacc $byacc_srcs +man yacc.1 + host() { exe yacc $byacc_srcs } - -exe yacc $byacc_srcs -man yacc.1 diff --git a/pkg/bzip2/gen.sh b/pkg/bzip2/gen.sh @@ -1,4 +1,4 @@ -fetch git +fetch git bzip2-1.0.8 cflags " -Wno-unused-parameter @@ -17,9 +17,5 @@ lib libbz2.a " bzlib.c " -exe bzip2 " - bzip2.c - $outdir/libbz2.a -" - +exe bzip2 bzip2.c $libdir/libbz2.a man bzip2.1 diff --git a/pkg/e2fsprogs/gen.sh b/pkg/e2fsprogs/gen.sh @@ -1,14 +1,14 @@ -fetch git +version=1.46.4 -setv version 1.46.4 +fetch git v$version cflags " -std=c99 - -D HAVE_CONFIG_H - -I $outdir/include - -I $outdir/_include - -I $outdir/_include/support - -I $srcdir/lib + -DHAVE_CONFIG_H + -I$hdrdir + -I$outdir + -I$outdir/support + -I$srcdir/lib -isystem $pkgdir/util-linux/include -isystem $pkgdir/linux-headers/include -Wno-variadic-macros @@ -19,62 +19,59 @@ cflags " -Wno-unused-parameter " -cat _include/config.h " - $pkgdir/probe/HAVE__THREAD_LOCAL - $pkgdir/probe/SIZEOF_LONG - $pkgdir/probe/SIZEOF_TIME_T - $dir/config.h +dep " + $outdir/config.h + $outdir/support/prof_err.h + $outdir/crc32c_table.h + $dir/headers + linux-headers/headers + util-linux/headers " -setv subst " - -e s,@E2FSPROGS_VERSION@,\$version, - -e s,@E2FSPROGS_MONTH@,Aug, - -e s,@E2FSPROGS_YEAR@,2021, - -e s,@JDEV@,, +include --prefix ext2fs " + $dir/ext2_types.h + $outdir/ext2_err.h " +rule gen_crc32ctable '$hostdir/gen_crc32ctable >$out' +bind description 'GEN CRC32CTABLE $out' + subst() { sed $1 $2 - bind expr '$subst' -} - -substman() { - out=_man/${1%.in} - subst $out $1 - man $out + bind expr " + -e s,@E2FSPROGS_VERSION@,$version, + -e s,@E2FSPROGS_MONTH@,Aug, + -e s,@E2FSPROGS_YEAR@,2021, + -e s,@JDEV@,, + " } et() { - awk $2 $1 '|' lib/et/et_c.awk - bind expr "-f $srcdir/lib/et/et_c.awk -v outfile=/dev/stdout outfn=${2##*/}" - awk $3 $1 '|' lib/et/et_c.awk - bind expr "-f $srcdir/lib/et/et_h.awk -v outfile=/dev/stdout outfn=${3##*/}" + awk $1 $2 '|' lib/et/et_c.awk + bind expr "-f $srcdir/lib/et/et_${1##*.}.awk -v outfile=/dev/stdout outfn=${1##*/}" } -subst _et/ext2_err.et lib/ext2fs/ext2_err.et.in -et $outdir/_et/ext2_err.et _c/ext2_err.c include/ext2fs/ext2_err.h -et $srcdir/lib/support/prof_err.et _c/prof_err.c _include/support/prof_err.h - -copy include/ext2fs/ext2_types.h $dir/ext2_types.h - -host() { - exe gen_crc32ctable lib/ext2fs/gen_crc32ctable.c -} +cat config.h " + $pkgdir/probe/HAVE__THREAD_LOCAL + $pkgdir/probe/SIZEOF_LONG + $pkgdir/probe/SIZEOF_TIME_T + $dir/config.h +" -rule gen_crc32ctable '$hostdir/gen_crc32ctable >$out' -build gen_crc32ctable _include/crc32c_table.h +subst ext2_err.et lib/ext2fs/ext2_err.et.in +subst e2fsck.8 e2fsck/e2fsck.8.in +subst e2fsck.conf.5 e2fsck/e2fsck.conf.5.in +subst resize2fs.8 resize/resize2fs.8.in +subst mke2fs.8 misc/mke2fs.8.in +subst tune2fs.8 misc/tune2fs.8.in +subst e4crypt.8 misc/e4crypt.8.in -include --prefix ext2fs $dir/ext2_types.h -include $outdir/include/ext2fs/ext2_err.h +et ext2_err.c $outdir/ext2_err.et +et ext2_err.h $outdir/ext2_err.et +et support/prof_err.c $srcdir/lib/support/prof_err.et +et support/prof_err.h $srcdir/lib/support/prof_err.et -dep " - $tgtdir/headers - $outdir/_include/support/prof_err.h - $outdir/_include/crc32c_table.h - $outdir/_include/config.h - linux-headers/headers - util-linux/headers -" +gen_crc32ctable crc32c_table.h lib libcomm_err.a " lib/et/error_message.c @@ -114,7 +111,6 @@ lib libe2p.a " " lib libext2fs.a " - $outdir/_c/ext2_err.c lib/ext2fs/alloc.c lib/ext2fs/alloc_sb.c lib/ext2fs/alloc_stats.c @@ -192,10 +188,10 @@ lib libext2fs.a " lib/ext2fs/version.c lib/ext2fs/rbtree.c lib/ext2fs/dupfs.c + $outdir/ext2_err.c " lib libsupport.a " - $outdir/_c/prof_err.c lib/support/cstring.c lib/support/mkquota.c lib/support/plausible.c @@ -206,6 +202,7 @@ lib libsupport.a " lib/support/quotaio_v2.c lib/support/quotaio_tree.c lib/support/dict.c + $outdir/support/prof_err.c " exe e2fsck " @@ -237,10 +234,10 @@ exe e2fsck " e2fsck/readahead.c e2fsck/extents.c e2fsck/encrypted_files.c - $outdir/libsupport.a - $outdir/libext2fs.a - $outdir/libe2p.a - $outdir/libcomm_err.a + $libdir/libsupport.a + $libdir/libext2fs.a + $libdir/libe2p.a + $libdir/libcomm_err.a $pkgdir/util-linux/libblkid.a.d $pkgdir/util-linux/libuuid.a.d " @@ -252,12 +249,12 @@ exe resize2fs " resize/online.c resize/resource_track.c resize/sim_progress.c - $outdir/libext2fs.a - $outdir/libe2p.a - $outdir/libcomm_err.a + $libdir/libext2fs.a + $libdir/libe2p.a + $libdir/libcomm_err.a " -awk _c/default_profile.c misc/mke2fs.conf.in '|' misc/profile-to-c.awk +awk default_profile.c misc/mke2fs.conf.in '|' misc/profile-to-c.awk bind expr '-f $srcdir/misc/profile-to-c.awk' exe mke2fs " @@ -265,50 +262,54 @@ exe mke2fs " misc/util.c misc/mk_hugefiles.c misc/create_inode.c - $outdir/_c/default_profile.c - $outdir/libsupport.a - $outdir/libext2fs.a - $outdir/libe2p.a - $outdir/libcomm_err.a + $outdir/default_profile.c + $libdir/libsupport.a + $libdir/libext2fs.a + $libdir/libe2p.a + $libdir/libcomm_err.a $pkgdir/util-linux/libblkid.a.d $pkgdir/util-linux/libuuid.a.d " -journal() { - cflags -I $srcdir/e2fsck -D DEBUGFS - setv objdir $objdir/journal - dep $dir/headers - - lib libjournal.a " - debugfs/journal.c - e2fsck/revoke.c - e2fsck/recovery.c - " -} - -subninja journal - -exe tune2fs " - misc/tune2fs.c - misc/util.c - $outdir/journal/libjournal.a - $outdir/libsupport.a - $outdir/libext2fs.a - $outdir/libe2p.a - $outdir/libcomm_err.a - $pkgdir/util-linux/libblkid.a.d - $pkgdir/util-linux/libuuid.a.d -" +# journal() { +# cflags -I $srcdir/e2fsck -D DEBUGFS +# setv objdir $objdir/journal +# dep $dir/headers +# +# lib libjournal.a " +# debugfs/journal.c +# e2fsck/revoke.c +# e2fsck/recovery.c +# " +# } +# +# subninja journal +# +# exe tune2fs " +# misc/tune2fs.c +# misc/util.c +# $outdir/journal/libjournal.a +# $outdir/libsupport.a +# $outdir/libext2fs.a +# $outdir/libe2p.a +# $outdir/libcomm_err.a +# $pkgdir/util-linux/libblkid.a.d +# $pkgdir/util-linux/libuuid.a.d +# " exe e4crypt " misc/e4crypt.c - $outdir/libext2fs.a + $libdir/libext2fs.a $pkgdir/util-linux/libuuid.a.d " -substman e2fsck/e2fsck.8.in -substman e2fsck/e2fsck.conf.5.in -substman resize/resize2fs.8.in -substman misc/mke2fs.8.in -substman misc/tune2fs.8.in -substman misc/e4crypt.8.in +man $outdir/e2fsck.8 +man $outdir/e2fsck.conf.5 +man $outdir/resize2fs.8 +man $outdir/mke2fs.8 +man $outdir/tune2fs.8 +man $outdir/e4crypt.8 + +host() { + exe gen_crc32ctable lib/ext2fs/gen_crc32ctable.c +} diff --git a/pkg/freetype/gen.sh b/pkg/freetype/gen.sh @@ -1,14 +1,14 @@ -fetch git +fetch git VER-2-14-1 cflags " -std=c99 - -D FT2_BUILD_LIBRARY - -D FT_CONFIG_OPTION_SYSTEM_ZLIB - -D HAVE_FCNTL_H - -D HAVE_UNISTD_H - -I $srcdir/builds/unix - -I $srcdir/include/freetype/config - -I $srcdir/include + -DFT2_BUILD_LIBRARY + -DFT_CONFIG_OPTION_SYSTEM_ZLIB + -DHAVE_FCNTL_H + -DHAVE_UNISTD_H + -I$srcdir/builds/unix + -I$srcdir/include/freetype/config + -I$srcdir/include -isystem $pkgdir/zlib/include -Wno-maybe-uninitialized " diff --git a/pkg/fspec-sync/gen.sh b/pkg/fspec-sync/gen.sh @@ -1,8 +1,8 @@ -fetch git +fetch git eca7ad6 cflags " -std=c99 - -I $pkgdir/b3sum/include + -I$pkgdir/b3sum/include -Wno-maybe-uninitialized -Wno-sign-compare " @@ -17,14 +17,18 @@ libcommon_srcs=" fspec_hash_srcs=" fspec-hash.c - $outdir/libcommon.a + $libdir/libcommon.a " fspec_tar_srcs=" fspec-tar.c - $outdir/libcommon.a + $libdir/libcommon.a " +lib libcommon.a $libcommon_srcs +exe fspec-hash $fspec_hash_srcs $pkgdir/b3sum/libblake3.a +exe fspec-tar $fspec_tar_srcs + host() { cflags -I $pkgdir/b3sum/include dep b3sum/headers @@ -33,7 +37,3 @@ host() { exe fspec-hash $fspec_hash_srcs $hostdir/libblake3.a exe fspec-tar $fspec_tar_srcs } - -lib libcommon.a $libcommon_srcs -exe fspec-hash $fspec_hash_srcs $pkgdir/b3sum/libblake3.a -exe fspec-tar $fspec_tar_srcs diff --git a/pkg/fzy/gen.sh b/pkg/fzy/gen.sh @@ -1,11 +1,13 @@ -fetch git +version=1.1 + +fetch git $version cflags " -std=c99 - -D _GNU_SOURCE - -D VERSION='\"1.1\"' - -I $srcdir/src - -I $dir + -D_GNU_SOURCE + -DVERSION=\\\"$version\\\" + -I$srcdir/src + -I$dir -Wno-maybe-uninitialized " diff --git a/pkg/gen.sh b/pkg/gen.sh @@ -0,0 +1,106 @@ +import genfn.sh + +TARGET_ARCH=x86_64 + +var ar $TARGET_ARCH-linux-musl-ar +var as $TARGET_ARCH-linux-musl-as +var cc $TARGET_ARCH-linux-musl-cc +var ld $TARGET_ARCH-linux-musl-ld +var objcopy $TARGET_ARCH-linux-musl-objcopy +var cflags -Os -fPIE -pipe -Wall -Werror -Wextra -pedantic +var ldflags -s -static-pie + +var pkgdir $outdir +var hostdir $outdir/host + +rule cc '$cc -MD -MF $out.d $cflags -c -o $out $in' +bind description 'CC $out' +bind depfile '$out.d' +bind deps gcc + +rule cpp '$cc -MD -MF $out.d $cflags -E -P -o $out $in' +bind description 'CPP $out' +bind depfile '$out.d' +bind deps gcc + +rule rsp 'ln -f $rspfile $out' +bind description 'RSP $out' +bind rspfile '$out.tmp' +bind rspfile_content '$in_newline' + +rule ar 'rm -f $out && $ar crs $out $in' +bind description 'AR $out' + +rule link '$cc $ldflags -o $out $in $ldlibs' +bind description 'LINK $out' + +rule copy 'ln -f $in $out' +bind description 'COPY $out' + +rule gzip 'gzip -c -9 <$in >$out' +bind description 'GZIP $out' + +rule awk 'awk $expr $in >$out' +bind description 'AWK $out' + +rule cat 'cat $in >$out' +bind description 'CAT $out' + +rule sed 'sed $expr $in >$out' +bind description 'SED $out' + +rule touch 'touch $out' +bind description 'TOUCH $out' + +rule fetch_git 'git submodule update --init --filter=blob:none $srcdir 1>/dev/null && git -C $srcdir checkout $ref 1>/dev/null 2>&1 && touch $out' +bind description 'FETCH GIT $dir $ref' +bind generator 1 +bind restat 1 +bind pool console + +rule fetch_curl 'rm -f $out && curl -L# -o $out $url' +bind description 'FETCH CURL $url' +bind generator 1 +bind restat 1 +bind pool console + +rule sha256sum 'test $sha256 = "$$(sha256sum $in | awk "{print \$$1}")" && touch $out' +bind description 'SHA256SUM $in' + +rule extract '$tool -c -d <$in | $hostdir/pax -r -s ",^[^/]*,$srcdir," $srcs && touch $out' +bind description 'EXTRACT $in' + +rule patch 'git -C $srcdir am -3 --keep-non-patch --no-gpg-sign --whitespace=nowarn ../../../$in >/dev/null && touch $out' +bind description 'PATCH $in' + +pkg ag +pkg awk +pkg b3sum +pkg bestline +pkg byacc +pkg bzip2 +pkg e2fsprogs +pkg freetype +pkg fspec-sync +pkg fzy +pkg less +pkg libpng +pkg libtermkey +pkg linux-headers +pkg lpeg +pkg lua +pkg mandoc +pkg netbsd-curses +pkg oksh +pkg pax +pkg pcre +pkg perp +pkg probe +pkg sbase +pkg sinit +pkg ubase +pkg util-linux +pkg vis +pkg xz +pkg zlib +pkg zstd diff --git a/pkg/genfn.sh b/pkg/genfn.sh @@ -0,0 +1,277 @@ +pkg() { + subgen $1 init_pkg fini_pkg +} + +init_pkg() { + OBJS= + HDRS= + SRCS= + DEPS= + PCHS= + unset -f host + var srcdir $dir/repo + var libdir $outdir + var objdir $outdir/obj + var hdrdir $outdir/include +} + +fini_pkg() { + if command -v host >/dev/null 2>&1 && persist && ! ${RUN_HOST-false}; then + write "subninja $dir/host.ninja" + SRCS="$SRCS $(run_host)" + fi + + [ "$DEPS" ] && phony deps $DEPS + [ "$HDRS" ] && phony headers $HDRS + + if [ "$SRCS" ]; then + phony "$(printf '%s\n' $SRCS | sort | uniq | xargs)" $outdir/fetched "$PCHS" + fi +} + +run_host() { + RUN_HOST=true + OBJS= + DEPS= + rm -f $DIR/host.ninja.tmp + + write() { + if persist; then + printf '%s\n' "$@" >> $DIR/host.ninja.tmp + fi + } + + var tgtdir $outdir + var outdir $hostdir + var libdir $outdir + var hdrdir $outdir/include + var objdir $objdir/host + var ar ar + var as as + var cc cc + var ld ld + var objcopy objcopy + var cflags -O2 -pipe + var ldflags '' + + host + mv $DIR/host.ninja.tmp $DIR/host.ninja + echo $SRCS +} + +build() { + _v1=$1 + _v2=$2 + shift 2 + + prefix _v2 $outdir $_v2 + prefix _vs \$srcdir $* + + for _v in $_vs; do + case $_v in + \$srcdir/*) SRCS="$SRCS $_v" + esac + done + + build_parse $_vs + write "build $_v2: $_v1 $_vs $_vd $_vo" +} + +cflags() { + var cflags '$cflags' "$*" +} + +ldflags() { + var ldflags '$ldflags' "$*" +} + +dep() { + _deps= + for _d in $*; do + case $_d in + *.c) prefix _d $outdir $_d;; + *.h) prefix _d $hdrdir $_d;; + */headers) prefix _d pkg $_d;; + esac + _deps="$_deps $_d" + done + DEPS="$DEPS $_deps" +} + +exe() { + _out=$1; shift + compile $* + + if [ "$_objs" ] && [ "$_deps" ]; then + _rspfile=$outdir/rsp/$_out + + awk $_rspfile $_deps '|' ./pkg/rsp.awk + bind expr '-f ./pkg/rsp.awk' + + link $_out $_objs $_libs '|' $_rspfile + bind ldlibs @$_rspfile + elif [ "$_objs" ]; then + link $_out $_objs $_libs + fi +} + +lib() { + _out=$1; shift + compile $* + + if [ "$_objs" ]; then + ar $libdir/$_out $_objs $_libs + rsp $libdir/$_out.d $outdir/$_out $_libs + fi +} + +compile() { + _srcs= + _objs= + _libs= + _deps= + _hdrs= + + for _src in $*; do + case $_src in + *.[cS]) _srcs="$_srcs $_src";; + *.o) _objs="$_objs $_src";; + *.a) _libs="$_libs $_src";; + *.a.d) _deps="$_deps $_src";; + *.h) _hdrs="$_hdrs $_src";; + *) error unknown file to compile: $_src;; + esac + done + + prefix _srcs $srcdir $_srcs + prefix _hdrs $hdrdir $_hdrs + prefix _objs $objdir $_objs + prefix _libs $libdir $_libs + prefix _deps $libdir $_deps + + for _src in $_srcs; do + _obj=$objdir/${_src#\$*/}.o + + if has $_obj $OBJS; then + _objs="$_objs $_obj" + continue + fi + + [ "$DEPS" ] && _src="$_src || $dir/deps" + [ "$_hdrs" ] && _src="$_src || $_hdrs" + + cc $_obj $_src + _objs="$_objs $_obj" + OBJS="$OBJS $_obj" + done +} + +include() { + _prefix=$hdrdir + _src_prefix=$srcdir + + while [ $# -gt 0 ]; do + case "$1" in + --prefix) + _prefix=$hdrdir/$2 + shift 2 + ;; + --src-prefix) + _src_prefix=$srcdir/$2 + shift 2 + ;; + *) + break + ;; + esac + done + + prefix _srcs $_src_prefix $* + + for _src in $_srcs; do + case $_src in + $srcdir/*|$outdir/*|$dir/*) + prefix _out $_prefix ${_src##*/} + copy $_out $_src + ;; + *) + _out=$_src + ;; + esac + HDRS="$HDRS $_out" + done +} + +fetch() { + case $1 in + git) + [ ! "${2-}" ] && error missing git ref || _ref=$2 + + fetch_git fetched + bind ref $_ref + ;; + curl) + [ ! "${2-}" ] && error missing curl url || _url=$2 + [ ! "${3-}" ] && error missing curl sha256sum || _sha=$3 + shift 3 + _srcs=$* + _name=${_url##*/} + + fetch_curl $_name + bind url $_url + + sha256sum checksum $outdir/$_name + bind sha256 $_sha + + case $_name in + *.tar.gz|*.tgz) + _archive=${_name%.t*gz}.tar + _tool=gzip + ;; + *.tar.xz) + _archive=${_name%.xz} + _tool=xz + ;; + *.tar.bz2) + _archive=${_name%.bz2} + _tool=bzip2 + ;; + *) + error unknown archive type $_name + ;; + esac + + extract fetched $outdir/$_name '|' $outdir/checksum + bind tool $_tool + bind srcs $_srcs + + if ! grep -qE "^$DIR/repo$" .git/info/exclude; then + printf "%s/repo\n" $DIR >> .git/info/exclude + fi + ;; + *) + error unknown fetch method $1 + ;; + esac + + if [ -d $DIR/patch ]; then + for _v in $DIR/patch/*.patch; do + _out=$outdir/${_v##*/} + _in=$dir/${_v#"$DIR"/} + patch $_out $_in '|' $outdir/fetched $PCHS + PCHS="$PCHS $_out" + done + fi +} + +man() { + _src=$1 + _sec=${2-} + _out=${_src##*/} + + if [ $_sec ]; then + _out=${_out%.*}.$_sec + fi + + gzip $_out.gz $_src +} diff --git a/pkg/less/gen.sh b/pkg/less/gen.sh @@ -3,9 +3,9 @@ fetch curl https://www.greenwoodsoftware.com/less/less-679.tar.gz \ cflags " -std=c99 - -D _XOPEN_SOURCE=700 - -I $dir - -I $pkgdir/netbsd-curses/include + -D_XOPEN_SOURCE=700 + -I$dir + -I$pkgdir/netbsd-curses/include -Wno-type-limits -Wno-maybe-uninitialized -Wno-sign-compare @@ -56,7 +56,7 @@ exe less " exe lessecho " lessecho.c - $objdir/version.c.o + version.c " exe lesskey " diff --git a/pkg/libpng/gen.sh b/pkg/libpng/gen.sh @@ -1,35 +1,35 @@ -fetch git +fetch git v1.6.43 cflags " - -D HAVE_CONFIG_H - -I $dir - -I $outdir/include + -DHAVE_CONFIG_H + -I$dir + -I$hdrdir -isystem $pkgdir/zlib/include " +dep " + $dir/headers + zlib/headers +" + +include " + png.h + pngconf.h + $outdir/pnglibconf.h +" + awk pnglibconf.tf4 pngconf.h scripts/pnglibconf.dfa pngusr.dfa '|' scripts/options.awk bind expr '-f $srcdir/scripts/options.awk out=/dev/stdout version=search' awk pnglibconf.c $outdir/pnglibconf.tf4 '|' scripts/options.awk bind expr '-f $srcdir/scripts/options.awk out=/dev/stdout' -cpp pnglibconf.tf1 $outdir/pnglibconf.c '||' $basedir/pkg/zlib/headers +cpp pnglibconf.tf1 $outdir/pnglibconf.c '||' ./pkg/zlib/headers -awk include/pnglibconf.h $outdir/pnglibconf.tf1 +awk pnglibconf.h $outdir/pnglibconf.tf1 bind expr '-f $srcdir/scripts/dfn.awk out=/dev/stdout' -include " - png.h - pngconf.h - $outdir/include/pnglibconf.h -" - -dep " - zlib/headers - $tgtdir/headers -" - -if [ $TARGET_ARCH == x86_64 ]; then +if [ $TARGET_ARCH = x86_64 ]; then libpng=" intel/intel_init.c intel/filter_sse2_intrinsics.c diff --git a/pkg/libtermkey/gen.sh b/pkg/libtermkey/gen.sh @@ -3,7 +3,7 @@ fetch curl http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.22.tar.gz \ cflags " -std=c99 - -I $pkgdir/netbsd-curses/include + -I$pkgdir/netbsd-curses/include -Wno-unused-parameter -Wno-sign-compare -Wno-implicit-fallthrough @@ -13,8 +13,8 @@ dep netbsd-curses/headers include termkey.h lib libtermkey.a " - termkey.c driver-csi.c driver-ti.c + termkey.c $pkgdir/netbsd-curses/libcurses.a.d " diff --git a/pkg/linux-headers/gen.sh b/pkg/linux-headers/gen.sh @@ -13,50 +13,50 @@ case $TARGET_ARCH in esac rule linux_header 'sed -E -f $dir/header.sed $in >$out.tmp && { $hostdir/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $out.tmp >$out; [ $$? -le 1 ]; } && rm $out.tmp' -rule linux_wrapper 'printf "#include <asm-generic/%s>\n" $file >$out' +bind description 'LINUX HEADER $out' -host() { - exe unifdef scripts/unifdef.c -} +rule linux_wrapper 'printf "#include <asm-generic/%s>\n" $file >$out' +bind description 'LINUX HEADER $out' -uapi_headers() { - while read -r src; do - outfile=$outdir/include/${src#*/uapi/} - linux_header $outfile $src - include $outfile - done <$DIR/$1 +uapi_header() { + out=$hdrdir/${1#*/uapi/} + linux_header $out $1 + include $out } -asm_headers() { - while read -r src; do - outfile=$outdir/include/asm/$src - linux_wrapper $outfile - bind file $src - include $outfile - done <$DIR/$1 +asm_header() { + out=$hdrdir/asm/$1 + linux_wrapper $out + bind file $1 + include $out } unistd_header() { - out=$outdir/include/asm/$1 + out=$hdrdir/asm/$1 awk $out $2 '|' $dir/unistd.awk - bind expr "-f $dir/unistd.awk -v arch=x86 -v file='$1' -v spec='${4-}' -v abi='$3'" + bind expr "-f $dir/unistd.awk -v arch=x86 -v file=$1 -v spec=${4-} -v abi='$3'" include $out } -# base gen: find $SRCDIR/include/uapi/* -name '*.h' | sed "s|^$SRCDIR||" | LC_COLLATE=C sort -# x86 gen: find $SRCDIR/arch/x86/include/uapi/* -name '*.h' | sed "s|^$SRCDIR||" | LC_COLLATE=C sort -# mandatory gen: cat $SRCDIR/include/uapi/asm-generic/Kbuild | grep -E '^mandatory-y' | sed 's|^mandatory-y += ||' -uapi_headers base -uapi_headers $linux_headers_arch -asm_headers mandatory +# base gen: find include/uapi/* -name '*.h' | LC_COLLATE=C sort +foreach base uapi_header -awk include/linux/version.h Makefile '|' $dir/version.awk -bind expr '-f $dir/version.awk' -include $outdir/include/linux/version.h +# mandatory gen: cat include/uapi/asm-generic/Kbuild | grep -E '^mandatory-y' | sed 's|^mandatory-y += ||' +foreach mandatory asm_header +awk $hdrdir/linux/version.h Makefile '|' $dir/version.awk +bind expr '-f $dir/version.awk' +include $hdrdir/linux/version.h if [ $linux_headers_arch = x86 ]; then - unistd_header unistd_32.h arch/x86/entry/syscalls/syscall_32.tbl i386 - unistd_header unistd_x32.h arch/x86/entry/syscalls/syscall_64.tbl 'common|x32' __X32_SYSCALL_BIT - unistd_header unistd_64.h arch/x86/entry/syscalls/syscall_64.tbl 'common|64' + # x86 gen: find arch/x86/include/uapi/* -name '*.h' | LC_COLLATE=C sort + foreach x86 uapi_header + + unistd_header unistd_32.h arch/x86/entry/syscalls/syscall_32.tbl i386 + unistd_header unistd_x32.h arch/x86/entry/syscalls/syscall_64.tbl common"'\"|\"'"x32 __X32_SYSCALL_BIT + unistd_header unistd_64.h arch/x86/entry/syscalls/syscall_64.tbl common"'\"|\"'"64 fi + +host() { + exe unifdef scripts/unifdef.c +} diff --git a/pkg/lua/gen.sh b/pkg/lua/gen.sh @@ -3,9 +3,9 @@ fetch curl http://www.lua.org/ftp/lua-5.4.7.tar.gz \ cflags " -std=c99 - -D _DEFAULT_SOURCE - -D LUA_USE_POSIX - -D LUA_USE_JUMPTABLE=0 + -D_DEFAULT_SOURCE + -DLUA_USE_POSIX + -DLUA_USE_JUMPTABLE=0 " include " @@ -50,16 +50,8 @@ lib liblua.a " src/lzio.c " -exe lua " - src/lua.c - $outdir/liblua.a - $pkgdir/luaposix/libluaposix.a -" - -exe luac " - src/lua.c - $outdir/liblua.a -" +exe lua src/lua.c $libdir/liblua.a +exe luac src/luac.c $libdir/liblua.a man doc/lua.1 man doc/luac.1 diff --git a/pkg/mandoc/gen.sh b/pkg/mandoc/gen.sh @@ -2,10 +2,10 @@ fetch curl http://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz \ 8bf0d570f01e70a6e124884088870cbed7537f36328d512909eb10cd53179d9c cflags " - -I $dir - -I $pkgdir/zlib/include - -D MANPATH_BASE='"\"'/$MANDIR'\""' - -D MANPATH_DEFAULT='"\"'/$MANDIR'\""' + -I$dir + -I$pkgdir/zlib/include + -DMANPATH_BASE=\\\"/share/man\\\" + -DMANPATH_DEFAULT=\\\"/share/man\\\" -Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-parameter @@ -84,13 +84,13 @@ exe mandoc " term_tab.c term_tag.c tree.c - $outdir/libmandoc.a + $libdir/libmandoc.a $pkgdir/zlib/libz.a " exe demandoc " demandoc.c - $outdir/libmandoc.a + $libdir/libmandoc.a $pkgdir/zlib/libz.a " diff --git a/pkg/netbsd-curses/gen.sh b/pkg/netbsd-curses/gen.sh @@ -1,16 +1,16 @@ -fetch git +fetch git 3aa07c2 cflags " - -D _XOPEN_SOURCE=700 - -D TERMINFO_DB - -D _PATH_TERMINFO='"\"'$PREFIX/share/misc/terminfo'"\"' - -I $srcdir/compat - -I $srcdir/lib/libcurses - -I $srcdir/lib/libterminfo - -I $srcdir/lib/libform - -I $srcdir/lib/libmenu - -I $srcdir/lib/libpanel - -I $outdir/deps + -D_XOPEN_SOURCE=700 + -DTERMINFO_DB + -D_PATH_TERMINFO=\"\\\"/share/misc/terminfo\\\"\" + -I$srcdir/compat + -I$srcdir/lib/libcurses + -I$srcdir/lib/libterminfo + -I$srcdir/lib/libform + -I$srcdir/lib/libmenu + -I$srcdir/lib/libpanel + -I$outdir -Wno-implicit-function-declaration -Wno-unused-parameter -Wno-sign-compare @@ -19,6 +19,12 @@ cflags " -Wno-type-limits " +dep " + compiled_terms.c + hash.c + termcap_hash.c +" + include " lib/libcurses/curses.h lib/libcurses/unctrl.h @@ -27,40 +33,18 @@ include " lib/libpanel/panel.h " -host() { - cflags " - -I $srcdir/compat - -I $srcdir/lib/libterminfo - " - - exe tic " - lib/libterminfo/compile.c - compat/cdbw.c - compat/mi_vector_hash.c - usr.bin/tic/tic.c - $pkgdir/netbsd-curses/deps/hash.c - " +rule nbperf 'TOOL_NBPERF=$hostdir/nbperf $in >$out 2>/dev/null' +bind description 'NBPERF $out' - exe nbperf " - usr.bin/nbperf/nbperf.c - usr.bin/nbperf/nbperf-bdz.c - usr.bin/nbperf/nbperf-chm.c - usr.bin/nbperf/nbperf-chm3.c - usr.bin/nbperf/graph2.c - usr.bin/nbperf/graph3.c - $objdir/compat/mi_vector_hash.c.o - " -} +rule tic '$hostdir/tic $ticflags -o $out $in $terms' +bind description 'TIC $out' -rule nbperf 'TOOL_NBPERF=$hostdir/nbperf $in >$out' +tic $outdir/compiled_terms.c share/terminfo/terminfo +bind ticflags -Sx +bind terms dumb -nbperf deps/hash.c lib/libterminfo/genhash lib/libterminfo/term.h -nbperf deps/termcap_hash.c lib/libterminfo/genthash lib/libterminfo/termcap_map.c - -dep " - $outdir/deps/hash.c - $outdir/deps/termcap_hash.c -" +nbperf $outdir/hash.c lib/libterminfo/genhash lib/libterminfo/term.h +nbperf $outdir/termcap_hash.c lib/libterminfo/genthash lib/libterminfo/termcap_map.c lib libterminfo.a " compat/cdbr.c @@ -72,7 +56,7 @@ lib libterminfo.a " lib/libterminfo/tparm.c lib/libterminfo/tputs.c lib/libterminfo/termcap.c - $outdir/deps/hash.c + $outdir/hash.c " lib libcurses.a " @@ -167,29 +151,29 @@ lib libcurses.a " lib/libcurses/unctrl.c lib/libcurses/underscore.c lib/libcurses/version.c - $outdir/libterminfo.a + $libdir/libterminfo.a " exe infocmp " usr.bin/infocmp/infocmp.c - $outdir/libterminfo.a + $libdir/libterminfo.a " exe tabs " usr.bin/tabs/tabs.c - $outdir/libterminfo.a + $libdir/libterminfo.a " exe tic " compat/cdbw.c lib/libterminfo/compile.c usr.bin/tic/tic.c - $outdir/libterminfo.a + $libdir/libterminfo.a " exe tput " usr.bin/tput/tput.c - $outdir/libterminfo.a + $libdir/libterminfo.a " exe tset " @@ -198,7 +182,7 @@ exe tset " usr.bin/tset/set.c usr.bin/tset/term.c usr.bin/tset/tset.c - $outdir/libterminfo.a + $libdir/libterminfo.a " man usr.bin/infocmp/infocmp.1 @@ -206,3 +190,28 @@ man usr.bin/tabs/tabs.1 man usr.bin/tic/tic.1 man usr.bin/tput/tput.1 man usr.bin/tset/tset.1 + +host() { + cflags " + -I$srcdir/compat + -I$srcdir/lib/libterminfo + " + + exe tic " + lib/libterminfo/compile.c + compat/cdbw.c + compat/mi_vector_hash.c + usr.bin/tic/tic.c + $tgtdir/hash.c + " + + exe nbperf " + usr.bin/nbperf/nbperf.c + usr.bin/nbperf/nbperf-bdz.c + usr.bin/nbperf/nbperf-chm.c + usr.bin/nbperf/nbperf-chm3.c + usr.bin/nbperf/graph2.c + usr.bin/nbperf/graph3.c + compat/mi_vector_hash.c + " +} diff --git a/pkg/oksh/gen.sh b/pkg/oksh/gen.sh @@ -1,10 +1,10 @@ -fetch git +fetch git oksh-7.7 cflags " - -D EMACS - -D VI - -D _GNU_SOURCE - -I $dir + -DEMACS + -DVI + -D_GNU_SOURCE + -I$dir -Wno-pedantic -Wno-unused-but-set-variable -Wno-sign-compare diff --git a/pkg/pax/gen.sh b/pkg/pax/gen.sh @@ -1,4 +1,4 @@ -fetch git +fetch git 95d26ab cflags " -std=c99 @@ -8,9 +8,9 @@ cflags " -Wno-type-limits " +exe pax pax.c + host() { - cflags -D _GNU_SOURCE + cflags -D_GNU_SOURCE exe pax pax.c } - -exe pax pax.c diff --git a/pkg/pcre/gen.sh b/pkg/pcre/gen.sh @@ -1,26 +1,31 @@ +version=8.45 +rel=2019-02-23 + fetch curl https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz \ 4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09 cflags " - -D HAVE_CONFIG_H - -I $dir - -I $srcdir - -I $outdir/include + -DHAVE_CONFIG_H + -I$dir + -I$srcdir + -I$hdrdir -Wno-implicit-fallthrough " -dep " - $outdir/pcre_chartables.c - $outdir/include/pcre.h -" +include $outdir/pcre.h -sed include/pcre.h pcre.h.in -bind expr '-e s,@PCRE_MAJOR@,8, -e s,@PCRE_MINOR@,43, -e s,@PCRE_PRERELEASE@,, -e s,@PCRE_DATE@,2019-02-23,' -include $outdir/include/pcre.h +sed pcre.h pcre.h.in +bind expr " + -e s,@PCRE_MAJOR@,${version%.*}, + -e s,@PCRE_MINOR@,${version#*.}, + -e s,@PCRE_PRERELEASE@,, + -e s,@PCRE_DATE@,$rel, +" copy pcre_chartables.c pcre_chartables.c.dist lib libpcre.a " + pcre.h pcre_byte_order.c pcre_compile.c pcre_config.c diff --git a/pkg/perp/gen.sh b/pkg/perp/gen.sh @@ -3,11 +3,11 @@ fetch curl http://b0llix.net/perp/distfiles/perp-2.07.tar.gz \ cflags " -std=c99 - -D _GNU_SOURCE - -D TINYLOG_ZIP='\"/bin/gzip\"' - -D ZIP_EXT='\".gz\"' - -I $srcdir/lasagna - -I $outdir/_include + -D_GNU_SOURCE + -DTINYLOG_ZIP=\\\"/bin/gzip\\\" + -DZIP_EXT=\\\".gz\\\" + -I$srcdir/lasagna + -I$outdir -Wno-implicit-fallthrough -Wno-implicit-function-declaration -Wno-pointer-arith @@ -17,46 +17,47 @@ cflags " -Wno-misleading-indentation " +dep " + $outdir/outvec_STDOUT.h + $outdir/rlimit_defs.c.in + $outdir/sysstr_errno.c.in + $outdir/sysstr_signo.c.in +" + rule outvec '$hostdir/mk_outvec >$out' +bind description 'OUTVEC $out' + rule rlimit '$hostdir/mk_rlimit >$out' -rule sysstr '$hostdir/mksysstr $type >$out' +bind description 'RLIMIT $out' -host() { - exe mk_outvec lasagna/outvec/mk_outvec.c - exe mk_rlimit lasagna/rlimit/mk_rlimit.c - exe mksysstr lasagna/sysstr/mksysstr.c -} +rule sysstr '$hostdir/mksysstr $type >$out' +bind description 'MKSYSSTR $out' -outvec _include/outvec_STDOUT.h -rlimit _include/rlimit_defs.c.in +outvec outvec_STDOUT.h +rlimit rlimit_defs.c.in -sysstr _include/sysstr_errno.c.in +sysstr sysstr_errno.c.in bind type errno -sysstr _include/sysstr_signo.c.in +sysstr sysstr_signo.c.in bind type signo -dep " - $outdir/_include/outvec_STDOUT.h - $outdir/_include/rlimit_defs.c.in - $outdir/_include/sysstr_errno.c.in - $outdir/_include/sysstr_signo.c.in -" +lib libasagna.a "$(command cat $DIR/lasagna)" perp() { for src in $*; do case $src in - perpd) - exe perpd " - perp/perpd.c - perp/perpd_conn.c - perp/perpd_svdef.c - $outdir/libasagna.a - " - ;; - *) - exe $src perp/$src.c $outdir/libasagna.a - ;; + perpd) + exe perpd " + perp/perpd.c + perp/perpd_conn.c + perp/perpd_svdef.c + $libdir/libasagna.a + " + ;; + *) + exe $src perp/$src.c $libdir/libasagna.a + ;; esac man perp/man/$src.8 done @@ -64,16 +65,14 @@ perp() { runtools() { for src in $*; do - exe $src runtools/$src.c $outdir/libasagna.a + exe $src runtools/$src.c $libdir/libasagna.a case $src in - [!cat]*) man runtools/man/$src.8;; + [!cat]*) man runtools/man/$src.8;; esac done } -lib libasagna.a "$(command cat $DIR/lasagna)" - perp " perpboot perpctl @@ -109,3 +108,9 @@ runtools " man perp/man/perpetrate.8 man perp/man/perp_intro.8 man runtools/man/runtools_intro.8 + +host() { + exe mk_outvec lasagna/outvec/mk_outvec.c + exe mk_rlimit lasagna/rlimit/mk_rlimit.c + exe mksysstr lasagna/sysstr/mksysstr.c +} diff --git a/pkg/probe/gen.sh b/pkg/probe/gen.sh @@ -1,5 +1,8 @@ -rule -o '$var' probe 'sh $dir/probe.sh $var $out $cc $cflags $ldflags -x c -o /dev/null $in' -rule -o '$var' probesize 'sh $dir/probe-size.sh $var $out $cc $cflags -c -x c -o /dev/null $in' +rule probe 'sh $dir/probe.sh $var $out $cc $cflags $ldflags -x c -o /dev/null $in' +bind description 'PROBE $var' + +rule probesize 'sh $dir/probe-size.sh $var $out $cc $cflags -c -x c -o /dev/null $in' +bind description 'PROBESIZE $var' _probe() { probe $1 $dir/$1 diff --git a/pkg/probe/probe-size.sh b/pkg/probe/probe-size.sh @@ -1,7 +1,8 @@ set -e -var=$1; shift -out=$1; shift +var=$1 +out=$2 +shift 2 for size in 8 4 2 1 ; do echo "==> trying $var=$size..." >&2 diff --git a/pkg/probe/probe.sh b/pkg/probe/probe.sh @@ -1,7 +1,8 @@ set -e -var=$1; shift -out=$1; shift +var=$1 +out=$2 +shift 2 if "$@" 2>$out.log; then echo "#define $var 1" >$out diff --git a/pkg/rsp.awk b/pkg/rsp.awk @@ -0,0 +1,35 @@ +function line() { + if (match($0, /\.d$/)) + read($0) + else + libs[++n] = $0 +} + +function read(name) { + for (;;) { + ret = getline < name + if (ret < 0) { + print "failed to read line from " name > "/proc/self/fd/2" + exit(1) + } + if (ret == 0) + break + line() + } + close(name) +} + +{line()} + +END { + for (i = n; i > 0; --i) { + lib = libs[i] + if (lib in seen) + continue + seen[lib] = 1 + uniq[++m] = lib + } + for (i = m; i > 0; --i) + print uniq[i] +} + diff --git a/pkg/sbase/gen.sh b/pkg/sbase/gen.sh @@ -1,12 +1,12 @@ -fetch git +fetch git 6b802ab cflags " -std=c99 - -D _DEFAULT_SOURCE - -D _BSD_SOURCE - -D _NETBSD_SOURCE - -D _XOPEN_SOURCE=700 - -I $outdir/include + -D_DEFAULT_SOURCE + -D_BSD_SOURCE + -D_NETBSD_SOURCE + -D_XOPEN_SOURCE=700 + -I$hdrdir -Wno-maybe-uninitialized -Wno-parentheses -Wno-misleading-indentation @@ -19,6 +19,20 @@ cflags " -Wno-empty-body " +dep $hdrdir/getconf.h + +rule getconf '$srcdir/scripts/getconf.sh >$out' +bind description 'GETCONF $out' + +getconf $hdrdir/getconf.h + +tools() { + for src in $*; do + exe $src $src.c $libdir/libutil.a $libdir/libutf.a + man $src.1 + done +} + lib libutil.a " libutil/concat.c libutil/cp.c @@ -82,19 +96,7 @@ lib libutf.a " libutf/utftorunestr.c " -rule getconf '$srcdir/scripts/getconf.sh >$out' -getconf include/getconf.h - -dep $outdir/include/getconf.h - -exes() { - for src in $*; do - exe $src $src.c $outdir/libutil.a $outdir/libutf.a - man $src.1 - done -} - -exes " +tools " basename cal cat diff --git a/pkg/sinit/gen.sh b/pkg/sinit/gen.sh @@ -1,10 +1,10 @@ -fetch git +fetch git v1.1 cflags " -std=c99 - -D _POSIX_C_SOURCE=200809L - -D PREFIX='"\"'/$PREFIX'\""' - -I $dir + -D_POSIX_C_SOURCE=200809L + -DPREFIX=\\\"/\\\" + -I$dir -Wno-unused-parameter " diff --git a/pkg/ubase/gen.sh b/pkg/ubase/gen.sh @@ -1,8 +1,10 @@ +fetch git a570a80 + cflags " -std=c99 - -D _GNU_SOURCE - -D _XOPEN_SOURCE=700 - -I $dir + -D_GNU_SOURCE + -D_XOPEN_SOURCE=700 + -I$dir -Wno-maybe-uninitialized -Wno-format-truncation -Wno-sign-compare @@ -32,21 +34,21 @@ lib libutil.a " libutil/tty.c " -exes() { +tools() { for val in $*; do case $val in - [0-9]) - man $src.$val - ;; - *) - src=$val - exe $src $src.c $outdir/libutil.a - ;; + [0-9]) + man $src.$val + ;; + *) + src=$val + exe $src $src.c $outdir/libutil.a + ;; esac done } -exes " +tools " blkdiscard chvt 1 clear 1 diff --git a/pkg/ubase/mount.swap b/pkg/ubase/mount.swap @@ -12,8 +12,8 @@ fi while getopts "o:" opt; do case $opt in - o) ;; # not handled for now - *) usage;; + o) ;; # not handled for now + *) usage;; esac done diff --git a/pkg/util-linux/gen.sh b/pkg/util-linux/gen.sh @@ -1,14 +1,13 @@ -fetch git +version=2.37.0 -setv version 2.37.0 +fetch git v2.37 cflags " -include $dir/config.h - -I $outdir/include/blkid - -I $outdir/internal - -I $srcdir/include - -I $srcdir/libblkid/src - -I $srcdir/libuuid/src + -I$outdir + -I$srcdir/include + -I$srcdir/libblkid/src + -I$srcdir/libuuid/src -isystem $pkgdir/linux-headers/include -Wno-format -Wno-variadic-macros @@ -21,40 +20,41 @@ cflags " -Wno-maybe-uninitialized " -cat internal/config.h " +dep " + $outdir/config.h + $outdir/libsmartcols.h + $outdir/libfdisk.h + $outdir/blkid.h + linux-headers/headers +" + +include --prefix uuid libuuid/src/uuid.h +include --prefix blkid $outdir/blkid.h + +cat config.h " $pkgdir/probe/HAVE__THREAD_LOCAL $dir/config.h " -sed internal/libsmartcols.h libsmartcols/src/libsmartcols.h.in -bind expr 's,@LIBSMARTCOLS_VERSION@,$version,' +sed libsmartcols.h libsmartcols/src/libsmartcols.h.in +bind expr "s,@LIBSMARTCOLS_VERSION@,$version," -sed internal/libfdisk.h libfdisk/src/libfdisk.h.in +sed libfdisk.h libfdisk/src/libfdisk.h.in bind expr " - -e s,@LIBFDISK_VERSION@,\$version, + -e s,@LIBFDISK_VERSION@,$version, -e /@LIBFDISK_MAJOR_VERSION@/d -e /@LIBFDISK_MINOR_VERSION@/d -e /@LIBFDISK_PATCH_VERSION@/d " -sed include/blkid/blkid.h libblkid/src/blkid.h.in +sed blkid.h libblkid/src/blkid.h.in bind expr '-e /@LIBBLKID_VERSION@/d -e /@LIBBLKID_DATE@/d' -include --prefix uuid libuuid/src/uuid.h -include $outdir/include/blkid/blkid.h - -dep " - $outdir/internal/config.h - $outdir/internal/libsmartcols.h - $outdir/internal/libfdisk.h - $outdir/include/blkid/blkid.h - linux-headers/headers -" - lib libcommon.a " lib/blkdev.c lib/buffer.c lib/canonicalize.c + lib/cpuset.c lib/crc32.c lib/crc32c.c lib/encode.c @@ -62,29 +62,27 @@ lib libcommon.a " lib/fileutils.c lib/idcache.c lib/jsonwrt.c + lib/linux_version.c + lib/loopdev.c lib/mangle.c lib/match.c lib/mbsalign.c lib/md5.c lib/pager.c + lib/path.c + lib/procutils.c lib/pwdutils.c lib/randutils.c lib/sha1.c lib/signames.c lib/strutils.c lib/strv.c + lib/sysfs.c lib/timeutils.c lib/ttyutils.c - lib/linux_version.c - lib/procutils.c - lib/loopdev.c - lib/cpuset.c - lib/path.c - lib/sysfs.c " lib libblkid.a " - libblkid/src/init.c libblkid/src/cache.c libblkid/src/config.c libblkid/src/dev.c @@ -93,13 +91,7 @@ lib libblkid.a " libblkid/src/encode.c libblkid/src/evaluate.c libblkid/src/getsize.c - libblkid/src/probe.c - libblkid/src/read.c - libblkid/src/resolve.c - libblkid/src/save.c - libblkid/src/tag.c - libblkid/src/verify.c - libblkid/src/version.c + libblkid/src/init.c libblkid/src/partitions/aix.c libblkid/src/partitions/atari.c libblkid/src/partitions/bsd.c @@ -113,6 +105,10 @@ lib libblkid.a " libblkid/src/partitions/sun.c libblkid/src/partitions/ultrix.c libblkid/src/partitions/unixware.c + libblkid/src/probe.c + libblkid/src/read.c + libblkid/src/resolve.c + libblkid/src/save.c libblkid/src/superblocks/adaptec_raid.c libblkid/src/superblocks/apfs.c libblkid/src/superblocks/bcache.c @@ -124,8 +120,9 @@ lib libblkid.a " libblkid/src/superblocks/cramfs.c libblkid/src/superblocks/ddf_raid.c libblkid/src/superblocks/drbd.c - libblkid/src/superblocks/drbdproxy_datalog.c libblkid/src/superblocks/drbdmanage.c + libblkid/src/superblocks/drbdproxy_datalog.c + libblkid/src/superblocks/erofs.c libblkid/src/superblocks/exfat.c libblkid/src/superblocks/exfs.c libblkid/src/superblocks/ext.c @@ -147,10 +144,10 @@ lib libblkid.a " libblkid/src/superblocks/netware.c libblkid/src/superblocks/nilfs.c libblkid/src/superblocks/ntfs.c - libblkid/src/superblocks/refs.c libblkid/src/superblocks/nvidia_raid.c libblkid/src/superblocks/ocfs.c libblkid/src/superblocks/promise_raid.c + libblkid/src/superblocks/refs.c libblkid/src/superblocks/reiserfs.c libblkid/src/superblocks/romfs.c libblkid/src/superblocks/silicon_raid.c @@ -171,15 +168,17 @@ lib libblkid.a " libblkid/src/superblocks/xfs.c libblkid/src/superblocks/zfs.c libblkid/src/superblocks/zonefs.c - libblkid/src/superblocks/erofs.c - libblkid/src/topology/topology.c + libblkid/src/tag.c libblkid/src/topology/dm.c libblkid/src/topology/evms.c libblkid/src/topology/ioctl.c libblkid/src/topology/lvm.c libblkid/src/topology/md.c libblkid/src/topology/sysfs.c - $outdir/libcommon.a + libblkid/src/topology/topology.c + libblkid/src/verify.c + libblkid/src/version.c + $libdir/libcommon.a " lib libuuid.a " @@ -190,76 +189,76 @@ lib libuuid.a " libuuid/src/isnull.c libuuid/src/pack.c libuuid/src/parse.c + libuuid/src/predefined.c libuuid/src/unpack.c libuuid/src/unparse.c libuuid/src/uuid_time.c - libuuid/src/predefined.c - $outdir/libcommon.a + $libdir/libcommon.a " lib libfdisk.a " - libfdisk/src/init.c + libfdisk/src/alignment.c + libfdisk/src/ask.c + libfdisk/src/bsd.c + libfdisk/src/context.c + libfdisk/src/dos.c libfdisk/src/field.c + libfdisk/src/gpt.c + libfdisk/src/init.c libfdisk/src/item.c - libfdisk/src/test.c - libfdisk/src/ask.c - libfdisk/src/alignment.c + libfdisk/src/iter.c libfdisk/src/label.c - libfdisk/src/utils.c - libfdisk/src/context.c - libfdisk/src/parttype.c libfdisk/src/partition.c - libfdisk/src/table.c - libfdisk/src/iter.c + libfdisk/src/parttype.c libfdisk/src/script.c + libfdisk/src/sgi.c + libfdisk/src/sun.c + libfdisk/src/table.c + libfdisk/src/test.c + libfdisk/src/utils.c libfdisk/src/version.c libfdisk/src/wipe.c - libfdisk/src/sun.c - libfdisk/src/sgi.c - libfdisk/src/dos.c - libfdisk/src/bsd.c - libfdisk/src/gpt.c - $outdir/libcommon.a - $outdir/libblkid.a - $outdir/libuuid.a + $libdir/libcommon.a + $libdir/libblkid.a + $libdir/libuuid.a " lib libtcolors.a " - lib/colors.c lib/color-names.c + lib/colors.c " lib libsmartcols.a " - libsmartcols/src/iter.c - libsmartcols/src/symbols.c + libsmartcols/src/buffer.c + libsmartcols/src/calculate.c libsmartcols/src/cell.c libsmartcols/src/column.c + libsmartcols/src/grouping.c + libsmartcols/src/init.c + libsmartcols/src/iter.c libsmartcols/src/line.c - libsmartcols/src/table.c - libsmartcols/src/print.c libsmartcols/src/print-api.c + libsmartcols/src/print.c + libsmartcols/src/symbols.c + libsmartcols/src/table.c libsmartcols/src/version.c - libsmartcols/src/buffer.c - libsmartcols/src/calculate.c - libsmartcols/src/grouping.c libsmartcols/src/walk.c - libsmartcols/src/init.c - $outdir/libtcolors.a - $outdir/libcommon.a + $libdir/libtcolors.a + $libdir/libcommon.a " exe fdisk " - disk-utils/fdisk.c - disk-utils/fdisk-menu.c disk-utils/fdisk-list.c - $outdir/libfdisk.a.d - $outdir/libsmartcols.a.d + disk-utils/fdisk-menu.c + disk-utils/fdisk.c + $libdir/libfdisk.a.d + $libdir/libsmartcols.a.d " exe losetup " sys-utils/losetup.c - $outdir/libsmartcols.a.d - $outdir/libcommon.a + $libdir/libsmartcols.a.d + $libdir/libcommon.a " man $dir/fdisk.8 diff --git a/pkg/vis/gen.sh b/pkg/vis/gen.sh @@ -1,39 +1,39 @@ -fetch git +version=0.9 -setv version v0.9 +fetch git 8cdf93e cflags " -std=c99 - -D CONFIG_HELP=1 - -D CONFIG_CURSES=1 - -D CONFIG_LUA=1 - -D CONFIG_LPEG=1 - -D CONFIG_TRE=0 - -D CONFIG_SELINUX=0 - -D CONFIG_ACL=0 - -D HAVE_MEMRCHR=1 - -D LUA_COMPAT_APIINTCASTS - -D _XOPEN_SOURCE=700 - -D VERSION='\"\$version\"' - -D VIS_PATH='"\"'/$PREFIX/share/vis'\""' - -D NDEBUG - -I $outdir/_include - -isystem $builddir/pkg/libtermkey/include - -isystem $builddir/pkg/lua/include - -isystem $builddir/pkg/netbsd-curses/include + -DCONFIG_HELP=1 + -DCONFIG_CURSES=1 + -DCONFIG_LUA=1 + -DCONFIG_LPEG=1 + -DCONFIG_TRE=0 + -DCONFIG_SELINUX=0 + -DCONFIG_ACL=0 + -DHAVE_MEMRCHR=1 + -DLUA_COMPAT_APIINTCASTS + -D_XOPEN_SOURCE=700 + -DVERSION=\\\"$version\\\" + -DVIS_PATH=\\\"/share/vis\\\" + -DNDEBUG + -I$outdir + -isystem $pkgdir/libtermkey/include + -isystem $pkgdir/lua/include + -isystem $pkgdir/netbsd-curses/include -Wno-unused-parameter -Wno-missing-field-initializers " -copy _include/config.h config.def.h - dep " - $outdir/_include/config.h + $outdir/config.h libtermkey/headers lua/headers netbsd-curses/headers " +copy config.h config.def.h + exe vis " array.c buffer.c @@ -69,16 +69,16 @@ exe vis " " exe vis-digraph vis-digraph.c -exe vis-menu vis-menu.c +exe vis-menu vis-menu.c copy vis-complete vis-complete copy vis-clipboard vis-clipboard copy vis-open vis-open visman() { - sed _man/$1 man/$1 - bind expr 's,VERSION,$version,' - man $outdir/_man/$1 + sed $1 man/$1 + bind expr "s,VERSION,$version," + man $outdir/$1 } visman vis.1 @@ -88,6 +88,8 @@ visman vis-digraph.1 visman vis-menu.1 visman vis-open.1 -for f in $(command cat $DIR/lua.txt | xargs); do - copy lua/$f lua/$f -done +copylua() { + copy lua/$1 lua/$1 +} + +foreach lua.txt copylua diff --git a/pkg/xz/gen.sh b/pkg/xz/gen.sh @@ -1,23 +1,25 @@ -fetch git +fetch git v5.8.1 cflags " - -D HAVE_CONFIG_H - -D SYS_landlock_create_ruleset=444 - -D SYS_landlock_restrict_self=446 - -I $outdir - -I $srcdir/src/common - -I $srcdir/src/liblzma/api - -I $srcdir/src/liblzma/check - -I $srcdir/src/liblzma/common - -I $srcdir/src/liblzma/delta - -I $srcdir/src/liblzma/lz - -I $srcdir/src/liblzma/lzma - -I $srcdir/src/liblzma/rangecoder - -I $srcdir/src/liblzma/simple + -DHAVE_CONFIG_H + -DSYS_landlock_create_ruleset=444 + -DSYS_landlock_restrict_self=446 + -I$outdir + -I$srcdir/src/common + -I$srcdir/src/liblzma/api + -I$srcdir/src/liblzma/check + -I$srcdir/src/liblzma/common + -I$srcdir/src/liblzma/delta + -I$srcdir/src/liblzma/lz + -I$srcdir/src/liblzma/lzma + -I$srcdir/src/liblzma/rangecoder + -I$srcdir/src/liblzma/simple -Wno-format -Wno-pedantic " +dep $outdir/config.h + include src/liblzma/api/lzma.h include --prefix lzma --src-prefix src/liblzma/api/lzma " @@ -47,8 +49,6 @@ cat config.h " $dir/config.h " -dep $outdir/config.h - lib liblzma.a " src/common/tuklib_physmem.c src/common/tuklib_cpucores.c @@ -150,7 +150,7 @@ exe xz " src/xz/suffix.c src/xz/util.c src/xz/list.c - $outdir/liblzma.a + $libdir/liblzma.a " man src/xz/xz.1 diff --git a/pkg/zlib/gen.sh b/pkg/zlib/gen.sh @@ -1,16 +1,13 @@ -fetch git +fetch git v1.3.1 cflags " -std=c99 - -D HAVE_STDARG_H - -D HAVE_UNISTD_H - -D _LARGEFILE64_SOURCE + -DHAVE_STDARG_H + -DHAVE_UNISTD_H + -D_LARGEFILE64_SOURCE " -include " - zconf.h - zlib.h -" +include zconf.h zlib.h zlib_srcs=" adler32.c @@ -30,10 +27,9 @@ zlib_srcs=" zutil.c " +lib libz.a $zlib_srcs + host() { - cflags -D STDC -D HAVE_UNISTD_H + cflags -DSTDC -DHAVE_UNISTD_H lib libz.a $zlib_srcs - exe minigzip test/minigzip.c $outdir/libz.a } - -lib libz.a $zlib_srcs diff --git a/pkg/zstd/gen.sh b/pkg/zstd/gen.sh @@ -1,18 +1,18 @@ -fetch git +fetch git v1.5.7 if [ $TARGET_ARCH = x86_64 ]; then zstd_x86_64=lib/decompress/huf_decompress_amd64.S fi cflags " - -D ZSTD_NOBENCH - -D ZSTD_NODICT - -D ZSTD_NOTRACE - -D ZSTD_NO_UNUSED_FUNCTIONS - -D ZSTD_MULTITHREAD - -D XXH_NAMESPACE=ZSTD_ - -U ZSTD_LEGACY_SUPPORT - -D ZSTD_LEGACY_SUPPORT=0 + -DZSTD_NOBENCH + -DZSTD_NODICT + -DZSTD_NOTRACE + -DZSTD_NO_UNUSED_FUNCTIONS + -DZSTD_MULTITHREAD + -DXXH_NAMESPACE=ZSTD_ + -UZSTD_LEGACY_SUPPORT + -DZSTD_LEGACY_SUPPORT=0 " lib libzstd.a " @@ -46,12 +46,12 @@ lib libzstd.a " " exe zstd " - programs/zstdcli.c - programs/util.c - programs/timefn.c programs/fileio.c programs/fileio_asyncio.c - $outdir/libzstd.a + programs/timefn.c + programs/util.c + programs/zstdcli.c + $libdir/libzstd.a " man programs/zstd.1