linux-qubasis
linux oasis port as a qubes template
git clone https://9o.is/git/linux-qubasis.git
commit a14c7deedcc59f6e36b69c4d357d569d3957f173 parent 838e12a3ff559dd675175ffb5a13bbe3c56759bc Author: Jul <jul@9o.is> Date: Tue, 9 Sep 2025 12:21:47 +0800 add e2fsprogs Diffstat:
| M | .gitmodules | | | 4 | ++++ |
| M | gen.sh | | | 1 | + |
| M | ninja/functions.sh | | | 43 | ++++++++++++++++++++++++++++++++----------- |
| M | ninja/rules.ninja | | | 4 | ---- |
| A | pkg/e2fsprogs/config.h | | | 205 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | pkg/e2fsprogs/ext2_types.h | | | 3 | +++ |
| A | pkg/e2fsprogs/gen.sh | | | 329 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | pkg/e2fsprogs/patch/0001-libsupport-remove-unused-sort_r-definition.patch | | | 156 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | pkg/e2fsprogs/repo | | | 1 | + |
| A | pkg/probe/SIZEOF_LONG | | | 1 | + |
| A | pkg/probe/SIZEOF_TIME_T | | | 2 | ++ |
| M | pkg/probe/gen.sh | | | 15 | ++++++++++++++- |
| A | pkg/probe/probe-size.sh | | | 17 | +++++++++++++++++ |
| A | pkg/probe/probe.sh | | | 10 | ++++++++++ |
14 files changed, 775 insertions(+), 16 deletions(-)
diff --git a/.gitmodules b/.gitmodules @@ -66,6 +66,10 @@ path = pkg/pax/repo url = https://git.sr.ht/~mcf/pax ignore = all +[submodule "e2fsprogs"] + path = pkg/e2fsprogs/repo + url = https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git + ignore = all [submodule "util-linux"] path = pkg/util-linux/repo url = https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git diff --git a/gen.sh b/gen.sh @@ -21,6 +21,7 @@ subgen pkg/abduco subgen pkg/awk subgen pkg/b3sum subgen pkg/byacc +subgen pkg/e2fsprogs subgen pkg/fspec-sync subgen pkg/less subgen pkg/linux-headers diff --git a/ninja/functions.sh b/ninja/functions.sh @@ -148,6 +148,22 @@ fetch() { _ninja_buffer_fetch="$*" } +subninja() { + _srcs="$( + _ninja_subninja=$1 + _ninja_init "$_ninja_gendir" + + setv outdir $outdir/$1 + setv tgtdir $gendir/$1 + + $1 + _ninja_complete + )" + + printf 'subninja $ninjadir/%s.ninja\n' "$_ninja_gendir-$1" >> "$_ninja_writepath" + _ninja_buffer_sync="$_ninja_buffer_sync $_srcs" +} + subgen() { _prefix= @@ -195,7 +211,7 @@ _ninja_init() { _ninja_complete() { _ninja_flush - if [ ! ${_ninja_host-} ]; then + if [ ! ${_ninja_subninja-} ]; then build phony $gendir/configure $ninjadir/$_ninja_file build gen $ninjadir/$_ninja_file '|' $basedir/config.sh $basedir/ninja/functions.sh $dir/gen.sh fi @@ -225,8 +241,8 @@ _ninja_initglobals() { _ninja_gendir=$1 _ninja_name=${1#*/} - if [ ${_ninja_host-} ]; then - _ninja_file=host/${1#*/}.ninja + if [ ${_ninja_subninja-} ]; then + _ninja_file=$1-$_ninja_subninja.ninja else _ninja_file=$1.ninja fi @@ -427,9 +443,9 @@ _ninja_flush_subninjas() { printf 'subninja $ninjadir/%s.ninja\n' $_v >> "$_ninja_writepath" done - if [ ! ${_ninja_host-} ] && command -v host >/dev/null 2>&1; then + if [ ! ${_ninja_subninja-} ] && command -v host >/dev/null 2>&1; then _srcs="$( - _ninja_host=true + _ninja_subninja=host _ninja_init $_ninja_gendir setv outdir $builddir/host @@ -447,7 +463,7 @@ _ninja_flush_subninjas() { _ninja_complete )" - printf 'subninja $ninjadir/host/%s.ninja\n' ${_ninja_gendir#*/} >> "$_ninja_writepath" + printf 'subninja $ninjadir/%s-host.ninja\n' $_ninja_gendir >> "$_ninja_writepath" _ninja_buffer_sync="$_ninja_buffer_sync $_srcs" fi } @@ -455,7 +471,7 @@ _ninja_flush_subninjas() { _ninja_flush_fetch() { _fetchdir=$outdir/_fetch - if [ ${_ninja_host-} ] || [ $_ninja_type = root ]; then + if [ ${_ninja_subninja-} ] || [ $_ninja_type = root ]; then return fi @@ -515,7 +531,7 @@ _ninja_flush_fetch() { } _ninja_flush_build() { - if [ ${_ninja_host-} ]; then + if [ ${_ninja_subninja-} ]; then return fi @@ -542,7 +558,12 @@ _ninja_flush_build() { build phony $tgtdir/build $_subgens ;; pkg) - build phony $tgtdir/build $_ninja_buffer_build $_subgens + if [ "$_ninja_buffer_build" ] || [ "$_subgens" ]; then + build phony $tgtdir/build $_ninja_buffer_build $_subgens + else + build touch $outdir/_fetch/build + build phony $tgtdir/build $outdir/_fetch/build + fi ;; tpl) build fspec-tar $outdir/rootfs.tar.zst '|' $hostdir/fspec-tar $hostdir/zstd '||' $outdir/_fspec/ALL @@ -552,7 +573,7 @@ _ninja_flush_build() { } _ninja_flush_sync() { - if [ ${_ninja_host-} ]; then + if [ ${_ninja_subninja-} ]; then printf "$_ninja_buffer_sync" return fi @@ -623,7 +644,7 @@ _ninja_flush_headers() { } _ninja_flush_fspec() { - if [ ${_ninja_host-} ]; then + if [ ${_ninja_subninja-} ]; then return fi diff --git a/ninja/rules.ninja b/ninja/rules.ninja @@ -96,7 +96,3 @@ rule patch rule sed command = sed $expr $in >$out description = SED $out - -rule probe - command = if $cc $cflags $ldflags -x c -o /dev/null $in 2>$out.log; then echo '#define $var 1'; fi >$out - description = PROBE $var diff --git a/pkg/e2fsprogs/config.h b/pkg/e2fsprogs/config.h @@ -0,0 +1,205 @@ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ +/* #undef CONFIG_BLKID_DEBUG */ +#define CONFIG_BUILD_FINDFS 1 +/* #undef CONFIG_DEVELOPER_FEATURES */ +/* #undef CONFIG_JBD_DEBUG */ +#define CONFIG_MMP 1 +/* #undef CONFIG_TDB */ +/* #undef CONFIG_TESTIO_DEBUG */ +/* #undef DISABLE_BACKTRACE */ +#define ENABLE_BMAP_STATS 1 +/* #undef ENABLE_BMAP_STATS_OPS */ +/* #undef ENABLE_NLS */ +/* #undef HAVE_ADD_KEY */ +/* #undef HAVE_ATTR_XATTR_H */ +/* #undef HAVE_BACKTRACE */ +/* #undef HAVE_BLKID_PROBE_ENABLE_PARTITIONS */ +/* #undef HAVE_BLKID_PROBE_GET_TOPOLOGY */ +/* #undef HAVE_BLKID_TOPOLOGY_GET_DAX */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ +/* #undef HAVE_CHFLAGS */ +/* #undef HAVE_DCGETTEXT */ +#define HAVE_DIRENT_H 1 +#define HAVE_DLOPEN 1 +/* #undef HAVE_DOPRNT */ +#define HAVE_ERRNO_H 1 +/* #undef HAVE_EXECINFO_H */ +#define HAVE_EXT2_IOCTLS 1 +/* #undef HAVE_FADVISE64 */ +#define HAVE_FALLOCATE 1 +/* #undef HAVE_FALLOCATE64 */ +#define HAVE_FCHOWN 1 +#define HAVE_FCNTL 1 +#define HAVE_FDATASYNC 1 +#define HAVE_FSTAT64 1 +#define HAVE_FSYNC 1 +#define HAVE_FTRUNCATE64 1 +/* #undef HAVE_FUSE_H */ +#define HAVE_FUTIMES 1 +#define HAVE_GETCWD 1 +#define HAVE_GETDTABLESIZE 1 +#define HAVE_GETHOSTNAME 1 +/* #undef HAVE_GETMNTINFO */ +#define HAVE_GETOPT_H 1 +#define HAVE_GETPWUID_R 1 +#define HAVE_GETRLIMIT 1 +#define HAVE_GETRUSAGE 1 +/* #undef HAVE_GETTEXT */ +/* #undef HAVE_ICONV */ +#define HAVE_INTPTR_T 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_JRAND48 1 +/* #undef HAVE_KEYCTL */ +#define HAVE_LINUX_FALLOC_H 1 +#define HAVE_LINUX_FD_H 1 +#define HAVE_LINUX_FSMAP_H 1 +#define HAVE_LINUX_LOOP_H 1 +#define HAVE_LINUX_MAJOR_H 1 +#define HAVE_LINUX_TYPES_H 1 +#define HAVE_LLISTXATTR 1 +/* #undef HAVE_LLSEEK */ +/* #undef HAVE_LLSEEK_PROTOTYPE */ +#define HAVE_LSEEK64 1 +#define HAVE_LSEEK64_PROTOTYPE 1 +/* #undef HAVE_MAGIC_H */ +/* #undef HAVE_MALLINFO */ +#define HAVE_MALLOC_H 1 +#define HAVE_MBSTOWCS 1 +#define HAVE_MEMALIGN 1 +#define HAVE_MEMORY_H 1 +#define HAVE_MEMPCPY 1 +#define HAVE_MMAP 1 +#define HAVE_MNTENT_H 1 +#define HAVE_MOUNT_NODEV 1 +#define HAVE_MOUNT_NOSUID 1 +#define HAVE_MSYNC 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_NETINET_IN_H 1 +/* #undef HAVE_NET_IF_DL_H */ +#define HAVE_NET_IF_H 1 +#define HAVE_OPEN64 1 +#define HAVE_OPTRESET 1 +#define HAVE_PATHCONF 1 +#define HAVE_PATHS_H 1 +#define HAVE_POSIX_FADVISE 1 +#define HAVE_POSIX_FADVISE64 1 +#define HAVE_POSIX_MEMALIGN 1 +#define HAVE_PRCTL 1 +#define HAVE_PREAD 1 +#define HAVE_PREAD64 1 +#define HAVE_PTHREAD 1 +#define HAVE_PTHREAD_H 1 +#define HAVE_PTHREAD_PRIO_INHERIT 1 +#define HAVE_PWRITE 1 +#define HAVE_PWRITE64 1 +#define HAVE_RECLEN_DIRENT 1 +/* #undef HAVE_SA_LEN */ +#define HAVE_SECURE_GETENV 1 +#define HAVE_SEMAPHORE_H 1 +/* #undef HAVE_SEM_INIT */ +#define HAVE_SETJMP_H 1 +#define HAVE_SETMNTENT 1 +#define HAVE_SETRESGID 1 +#define HAVE_SETRESUID 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_SNPRINTF 1 +#define HAVE_SRANDOM 1 +/* #undef HAVE_STAT_FLAGS */ +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STPCPY 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRDUP 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRNLEN 1 +#define HAVE_STRPTIME 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRUCT_STAT_ST_ATIM 1 +#define HAVE_SYNC_FILE_RANGE 1 +#define HAVE_SYSCONF 1 +/* #undef HAVE_SYS_ACL_H */ +/* #undef HAVE_SYS_DISKLABEL_H */ +/* #undef HAVE_SYS_DISK_H */ +#define HAVE_SYS_FILE_H 1 +#define HAVE_SYS_IOCTL_H 1 +/* #undef HAVE_SYS_KEY_H */ +/* #undef HAVE_SYS_MKDEV_H */ +#define HAVE_SYS_MMAN_H 1 +#define HAVE_SYS_MOUNT_H 1 +#define HAVE_SYS_PRCTL_H 1 +#define HAVE_SYS_RESOURCE_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_SYS_SOCKET_H 1 +/* #undef HAVE_SYS_SOCKIO_H */ +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_SYSCALL_H 1 +#define HAVE_SYS_SYSMACROS_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_UN_H 1 +#define HAVE_SYS_WAIT_H 1 +#define HAVE_SYS_XATTR_H 1 +#define HAVE_TERMIOS_H 1 +/* #undef HAVE_TERMIO_H */ +#define HAVE_TYPE_SSIZE_T 1 +#define HAVE_UNISTD_H 1 +#define HAVE_USLEEP 1 +#define HAVE_UTIME 1 +#define HAVE_UTIMES 1 +#define HAVE_UTIME_H 1 +#define HAVE_VALLOC 1 +#define HAVE_VPRINTF 1 +/* #undef HAVE___SECURE_GETENV */ +#define PACKAGE "e2fsprogs" +#define PACKAGE_BUGREPORT "" +#define PACKAGE_NAME "" +#define PACKAGE_STRING "" +#define PACKAGE_TARNAME "" +#define PACKAGE_URL "" +#define PACKAGE_VERSION "" +/* #undef PTHREAD_CREATE_JOINABLE */ +#define SIZEOF_INT 4 +/* probe SIZEOF_LONG */ +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_OFF_T 8 +#define SIZEOF_SHORT 2 +/* probe SIZEOF_TIME_T */ +#define STDC_HEADERS 1 +#ifdef HAVE__THREAD_LOCAL +# define TLS _Thread_local +#endif +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif +/* #undef USE_UUIDD */ +#define VERSION "0.14.1" +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif +/* #undef _INTL_REDIRECT_MACROS */ +/* #undef _MINIX */ +/* #undef _POSIX_1_SOURCE */ +/* #undef _POSIX_SOURCE */ +#define LOCALEDIR "/share/locale" +#define ROOT_SYSCONFDIR "/etc" diff --git a/pkg/e2fsprogs/ext2_types.h b/pkg/e2fsprogs/ext2_types.h @@ -0,0 +1,3 @@ +#include <sys/types.h> +#include <linux/types.h> +#define __force diff --git a/pkg/e2fsprogs/gen.sh b/pkg/e2fsprogs/gen.sh @@ -0,0 +1,329 @@ +fetch git + +setv version 1.46.4 + +cflags " + -std=c99 + -D HAVE_CONFIG_H + -I $outdir/include + -I $outdir/_include + -I $outdir/_include/support + -I $srcdir/lib + -isystem $pkgdir/util-linux/include + -isystem $pkgdir/linux-headers/include + -Wno-variadic-macros + -Wno-pedantic + -Wno-format-truncation + -Wno-maybe-uninitialized + -Wno-format-overflow + -Wno-unused-parameter +" + +build cat $outdir/_include/config.h " + $pkgdir/probe/HAVE__THREAD_LOCAL + $pkgdir/probe/SIZEOF_LONG + $pkgdir/probe/SIZEOF_TIME_T + $dir/config.h +" + +setv subst " + -e s,@E2FSPROGS_VERSION@,\$version, + -e s,@E2FSPROGS_MONTH@,Aug, + -e s,@E2FSPROGS_YEAR@,2021, + -e s,@JDEV@,, +" + +subst() { + out=$outdir/$1 + in=$srcdir/$2 + + build sed $out $in + bind expr '$subst' + sync $in +} + +substman() { + out=_man/${1%.in} + subst $out $1 + man $out +} + +et() { + build awk $outdir/$2 $1 '|' $srcdir/lib/et/et_c.awk + bind expr "-f $srcdir/lib/et/et_c.awk -v outfile=/dev/stdout outfn=${2##*/}" + build awk $outdir/$3 $1 '|' $srcdir/lib/et/et_c.awk + bind expr "-f $srcdir/lib/et/et_h.awk -v outfile=/dev/stdout outfn=${3##*/}" + sync $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 + +build copy $outdir/include/ext2fs/ext2_types.h $dir/ext2_types.h + +host() { + exe gen_crc32ctable lib/ext2fs/gen_crc32ctable.c +} + +rule gen_crc32ctable '$hostdir/gen_crc32ctable >$out' +build gen_crc32ctable $outdir/_include/crc32c_table.h '|' $hostdir/gen_crc32ctable + +headers " + $outdir/include/ext2fs/ext2_err.h + $outdir/include/ext2fs/ext2_types.h +" + +dep " + $tgtdir/headers + $outdir/_include/support/prof_err.h + $outdir/_include/crc32c_table.h + $outdir/_include/config.h + linux-headers/headers + util-linux/headers +" + +lib libcomm_err.a " + lib/et/error_message.c + lib/et/et_name.c + lib/et/init_et.c + lib/et/com_err.c + lib/et/com_right.c +" + +lib libe2p.a " + lib/e2p/feature.c + lib/e2p/fgetflags.c + lib/e2p/fsetflags.c + lib/e2p/fgetversion.c + lib/e2p/fsetversion.c + lib/e2p/getflags.c + lib/e2p/getversion.c + lib/e2p/hashstr.c + lib/e2p/iod.c + lib/e2p/ls.c + lib/e2p/ljs.c + lib/e2p/mntopts.c + lib/e2p/parse_num.c + lib/e2p/pe.c + lib/e2p/pf.c + lib/e2p/ps.c + lib/e2p/setflags.c + lib/e2p/setversion.c + lib/e2p/uuid.c + lib/e2p/ostype.c + lib/e2p/percent.c + lib/e2p/crypto_mode.c + lib/e2p/fgetproject.c + lib/e2p/fsetproject.c + lib/e2p/encoding.c + lib/e2p/errcode.c +" + +lib libext2fs.a " + $outdir/_c/ext2_err.c + lib/ext2fs/alloc.c + lib/ext2fs/alloc_sb.c + lib/ext2fs/alloc_stats.c + lib/ext2fs/alloc_tables.c + lib/ext2fs/atexit.c + lib/ext2fs/badblocks.c + lib/ext2fs/bb_inode.c + lib/ext2fs/bitmaps.c + lib/ext2fs/bitops.c + lib/ext2fs/blkmap64_ba.c + lib/ext2fs/blkmap64_rb.c + lib/ext2fs/blknum.c + lib/ext2fs/block.c + lib/ext2fs/bmap.c + lib/ext2fs/check_desc.c + lib/ext2fs/closefs.c + lib/ext2fs/crc16.c + lib/ext2fs/crc32c.c + lib/ext2fs/csum.c + lib/ext2fs/dblist.c + lib/ext2fs/dblist_dir.c + lib/ext2fs/dirblock.c + lib/ext2fs/dirhash.c + lib/ext2fs/dir_iterate.c + lib/ext2fs/expanddir.c + lib/ext2fs/ext_attr.c + lib/ext2fs/extent.c + lib/ext2fs/fallocate.c + lib/ext2fs/fileio.c + lib/ext2fs/finddev.c + lib/ext2fs/flushb.c + lib/ext2fs/freefs.c + lib/ext2fs/gen_bitmap.c + lib/ext2fs/gen_bitmap64.c + lib/ext2fs/get_num_dirs.c + lib/ext2fs/get_pathname.c + lib/ext2fs/getsize.c + lib/ext2fs/getsectsize.c + lib/ext2fs/hashmap.c + lib/ext2fs/i_block.c + lib/ext2fs/icount.c + lib/ext2fs/ind_block.c + lib/ext2fs/initialize.c + lib/ext2fs/inline.c + lib/ext2fs/inline_data.c + lib/ext2fs/inode.c + lib/ext2fs/io_manager.c + lib/ext2fs/ismounted.c + lib/ext2fs/link.c + lib/ext2fs/llseek.c + lib/ext2fs/lookup.c + lib/ext2fs/mkdir.c + lib/ext2fs/mkjournal.c + lib/ext2fs/mmp.c + lib/ext2fs/namei.c + lib/ext2fs/native.c + lib/ext2fs/newdir.c + lib/ext2fs/nls_utf8.c + lib/ext2fs/openfs.c + lib/ext2fs/progress.c + lib/ext2fs/punch.c + lib/ext2fs/qcow2.c + lib/ext2fs/read_bb.c + lib/ext2fs/read_bb_file.c + lib/ext2fs/res_gdt.c + lib/ext2fs/rw_bitmaps.c + lib/ext2fs/sha512.c + lib/ext2fs/swapfs.c + lib/ext2fs/symlink.c + lib/ext2fs/undo_io.c + lib/ext2fs/unix_io.c + lib/ext2fs/sparse_io.c + lib/ext2fs/unlink.c + lib/ext2fs/valid_blk.c + lib/ext2fs/version.c + lib/ext2fs/rbtree.c + lib/ext2fs/dupfs.c +" + +lib libsupport.a " + $outdir/_c/prof_err.c + lib/support/cstring.c + lib/support/mkquota.c + lib/support/plausible.c + lib/support/profile.c + lib/support/parse_qtype.c + lib/support/profile_helpers.c + lib/support/quotaio.c + lib/support/quotaio_v2.c + lib/support/quotaio_tree.c + lib/support/dict.c +" + +exe e2fsck " + e2fsck/unix.c + e2fsck/e2fsck.c + e2fsck/super.c + e2fsck/pass1.c + e2fsck/pass1b.c + e2fsck/pass2.c + e2fsck/pass3.c + e2fsck/pass4.c + e2fsck/pass5.c + e2fsck/journal.c + e2fsck/badblocks.c + e2fsck/util.c + e2fsck/dirinfo.c + e2fsck/dx_dirinfo.c + e2fsck/ehandler.c + e2fsck/problem.c + e2fsck/message.c + e2fsck/quota.c + e2fsck/recovery.c + e2fsck/region.c + e2fsck/revoke.c + e2fsck/ea_refcount.c + e2fsck/rehash.c + e2fsck/logfile.c + e2fsck/sigcatcher.c + e2fsck/readahead.c + e2fsck/extents.c + e2fsck/encrypted_files.c + $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 resize2fs " + resize/extent.c + resize/resize2fs.c + resize/main.c + resize/online.c + resize/resource_track.c + resize/sim_progress.c + $outdir/libext2fs.a + $outdir/libe2p.a + $outdir/libcomm_err.a +" + +build awk $outdir/_c/default_profile.c $srcdir/misc/mke2fs.conf.in '|' $srcdir/misc/profile-to-c.awk +bind expr '-f $srcdir/misc/profile-to-c.awk' +sync $srcdir/misc/profile-to-c.awk +sync $srcdir/misc/mke2fs.conf.in + +exe mke2fs " + misc/mke2fs.c + 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 + $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 + $pkgdir/util-linux/libuuid.a.d +" + +bin e2fsck +bin resize2fs +bin mke2fs +bin tune2fs +bin e4crypt + +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 diff --git a/pkg/e2fsprogs/patch/0001-libsupport-remove-unused-sort_r-definition.patch b/pkg/e2fsprogs/patch/0001-libsupport-remove-unused-sort_r-definition.patch @@ -0,0 +1,156 @@ +From 24a0e8d916019160c1fe186ccfb9843d00a5ddde Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Tue, 2 Mar 2021 15:47:20 -0800 +Subject: [PATCH] libsupport: remove unused sort_r definition + +e2fsprogs uses sort_r_simple directly, so sort_r is not needed. + +On any linux (including linux-musl), sort_r is defined in terms of +qsort_r, so a compiler that does not support inlining may still +emit a reference to qsort_r. +--- + lib/support/sort_r.h | 119 +------------------------------------------ + 1 file changed, 2 insertions(+), 117 deletions(-) + +diff --git a/lib/support/sort_r.h b/lib/support/sort_r.h +index 3292a26a..08f496d4 100644 +--- a/lib/support/sort_r.h ++++ b/lib/support/sort_r.h +@@ -22,20 +22,10 @@ void sort_r(void *base, size_t nel, size_t width, + + */ + +-#define _SORT_R_INLINE inline +- +-#if (defined __gnu_hurd__ || defined __GNU__ || \ +- defined __linux__ || defined __MINGW32__ || defined __GLIBC__) +-# define _SORT_R_LINUX +-#elif (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \ +- defined __FreeBSD__ || defined __DragonFly__) +-# define _SORT_R_BSD +-#elif (defined _WIN32 || defined _WIN64 || defined __WINDOWS__) +-# define _SORT_R_WINDOWS +-# undef _SORT_R_INLINE ++#if (defined _WIN32 || defined _WIN64 || defined __WINDOWS__) + # define _SORT_R_INLINE __inline + #else +- /* Using our own recursive quicksort sort_r_simple() */ ++# define _SORT_R_INLINE inline + #endif + + #if (defined NESTED_QSORT && NESTED_QSORT == 0) +@@ -211,111 +201,6 @@ static _SORT_R_INLINE void sort_r_simple(void *base, size_t nel, size_t w, + } + } + +- +-#if defined NESTED_QSORT +- +- static _SORT_R_INLINE void sort_r(void *base, size_t nel, size_t width, +- int (*compar)(const void *_a, +- const void *_b, +- void *aarg), +- void *arg) +- { +- int nested_cmp(const void *a, const void *b) +- { +- return compar(a, b, arg); +- } +- +- qsort(base, nel, width, nested_cmp); +- } +- +-#else /* !NESTED_QSORT */ +- +- /* Declare structs and functions */ +- +- #if defined _SORT_R_BSD +- +- /* Ensure qsort_r is defined */ +- extern void qsort_r(void *base, size_t nel, size_t width, void *thunk, +- int (*compar)(void *_thunk, +- const void *_a, const void *_b)); +- +- #endif +- +- #if defined _SORT_R_BSD || defined _SORT_R_WINDOWS +- +- /* BSD (qsort_r), Windows (qsort_s) require argument swap */ +- +- struct sort_r_data +- { +- void *arg; +- int (*compar)(const void *_a, const void *_b, void *_arg); +- }; +- +- static _SORT_R_INLINE int sort_r_arg_swap(void *s, +- const void *a, const void *b) +- { +- struct sort_r_data *ss = (struct sort_r_data*)s; +- return (ss->compar)(a, b, ss->arg); +- } +- +- #endif +- +- #if defined _SORT_R_LINUX +- +- typedef int(* __compar_d_fn_t)(const void *, const void *, void *); +- extern void qsort_r(void *base, size_t nel, size_t width, +- __compar_d_fn_t __compar, void *arg) +- __attribute__((nonnull (1, 4))); +- +- #endif +- +- /* implementation */ +- +- static _SORT_R_INLINE void sort_r(void *base, size_t nel, size_t width, +- int (*compar)(const void *_a, +- const void *_b, void *_arg), +- void *arg) +- { +- #if defined _SORT_R_LINUX +- +- #if defined __GLIBC__ && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8)) +- +- /* no qsort_r in glibc before 2.8, need to use nested qsort */ +- sort_r_simple(base, nel, width, compar, arg); +- +- #else +- +- qsort_r(base, nel, width, compar, arg); +- +- #endif +- +- #elif defined _SORT_R_BSD +- +- struct sort_r_data tmp; +- tmp.arg = arg; +- tmp.compar = compar; +- qsort_r(base, nel, width, &tmp, sort_r_arg_swap); +- +- #elif defined _SORT_R_WINDOWS +- +- struct sort_r_data tmp; +- tmp.arg = arg; +- tmp.compar = compar; +- qsort_s(base, nel, width, sort_r_arg_swap, &tmp); +- +- #else +- +- /* Fall back to our own quicksort implementation */ +- sort_r_simple(base, nel, width, compar, arg); +- +- #endif +- } +- +-#endif /* !NESTED_QSORT */ +- + #undef _SORT_R_INLINE +-#undef _SORT_R_WINDOWS +-#undef _SORT_R_LINUX +-#undef _SORT_R_BSD + + #endif /* SORT_R_H_ */ +-- +2.32.0 + diff --git a/pkg/e2fsprogs/repo b/pkg/e2fsprogs/repo @@ -0,0 +1 @@ +Subproject commit 01b9210eb12868dbd7eba084e66d312a32465781 diff --git a/pkg/probe/SIZEOF_LONG b/pkg/probe/SIZEOF_LONG @@ -0,0 +1 @@ +_Static_assert(SIZEOF_LONG == sizeof(long), "incorrect size"); diff --git a/pkg/probe/SIZEOF_TIME_T b/pkg/probe/SIZEOF_TIME_T @@ -0,0 +1,2 @@ +#include <sys/types.h> +_Static_assert(SIZEOF_TIME_T == sizeof(time_t), "incorrect size"); diff --git a/pkg/probe/gen.sh b/pkg/probe/gen.sh @@ -1,7 +1,20 @@ +rule probe 'sh $dir/probe.sh $var $out $cc $cflags $ldflags -x c -o /dev/null $in' +bind description 'PROBE $var' + +rule probe-size 'sh $dir/probe-size.sh $var $out $cc $cflags -c -x c -o /dev/null $in' +bind description 'PROBE SIZE $var' probe() { - build probe $outdir/$1 $dir/$1 + build probe $outdir/$1 $dir/$1 '|' $dir/probe.sh + bind var $1 +} + +probesize() { + build probe-size $outdir/$1 $dir/$1 '|' $dir/probe-size.sh bind var $1 } probe HAVE__THREAD_LOCAL + +probesize SIZEOF_LONG +probesize SIZEOF_TIME_T diff --git a/pkg/probe/probe-size.sh b/pkg/probe/probe-size.sh @@ -0,0 +1,17 @@ +set -e + +var=$1; shift +out=$1; shift + +for size in 8 4 2 1 ; do + echo "==> trying $var=$size..." >&2 + if "$@" -D "$var=$size" ; then + echo '==> success' >&2 + echo "#define $var $size" >$out + exit 0 + fi +done 2>$out.log + +cat $out.log +printf "%s: could not determine %s\n" "$0" "$var" >&2 +exit 1 diff --git a/pkg/probe/probe.sh b/pkg/probe/probe.sh @@ -0,0 +1,10 @@ +set -e + +var=$1; shift +out=$1; shift + +if "$@" 2>$out.log; then + echo "#define $var 1" >$out +else + echo '' >$out +fi