From 293f5a93b77d92fd65db7f3d0df654f102e46cfb Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sun, 11 Dec 2016 16:04:20 -0800 Subject: Move to flat package hierarchy Note to self: never try to move submodules again To migrate your existing submodules (more or less): set -x set -e mkdir .git/modules/pkg for old in */*/src ; do new="pkg/${old#*/}" if ! [ -f "$old/.git" ] || [ "${old%%/*}" = pkg ] ; then continue fi git -C ".git/modules/$old" config core.worktree "../../../../../$new" rmdir "$new" mv "$old" "$new" sed -e "s,$old,$new," "$new/.git" > "$new/.git.tmp" mv "$new/.git.tmp" "$new/.git" mkdir ".git/modules/${new%/src}" mv ".git/modules/$old" ".git/modules/$new" rm "${old%/src}"/*.ninja mv "${old%/src}"/*.tar.{gz,xz,bz2} "${new%/src}/" rmdir "${old%/src}" || true done sed -e 's,^\[submodule "[^/]*/,[submodule "pkg/,' .git/config > .git/config.tmp mv .git/config.tmp .git/config --- pkg/file/config.h | 97 ++++++++++++++++++ pkg/file/gen.rc | 59 +++++++++++ pkg/file/magic.txt | 282 +++++++++++++++++++++++++++++++++++++++++++++++++++++ pkg/file/rev | 1 + pkg/file/src | 1 + 5 files changed, 440 insertions(+) create mode 100644 pkg/file/config.h create mode 100644 pkg/file/gen.rc create mode 100644 pkg/file/magic.txt create mode 100644 pkg/file/rev create mode 160000 pkg/file/src (limited to 'pkg/file') diff --git a/pkg/file/config.h b/pkg/file/config.h new file mode 100644 index 00000000..9bdf61af --- /dev/null +++ b/pkg/file/config.h @@ -0,0 +1,97 @@ +#include + +/* #undef AC_APPLE_UNIVERSAL_BUILD */ +#define BUILTIN_ELF 1 +#define ELFCORE 1 +#define HAVE_ASPRINTF 1 +#define HAVE_DECL_DAYLIGHT 1 +#define HAVE_DECL_TZNAME 1 +#define HAVE_ERR_H 1 +/* #undef HAVE_FMTCHECK */ +#define HAVE_GETOPT_H 1 +#define HAVE_GETOPT_LONG 1 +#define HAVE_GETPAGESIZE 1 +#define HAVE_INTPTR_T 1 +/* #undef HAVE_LIBGNURX */ +#define HAVE_LIBZ 1 +#define HAVE_MBSTATE_T 1 +#define HAVE_MEMORY_H 1 +#define HAVE_MKOSTEMP 1 +#define HAVE_SIG_T 1 +#define HAVE_STRCASESTR 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRUCT_OPTION 1 +/* #undef HAVE_STRUCT_TM_TM_GMTOFF */ +#define HAVE_STRUCT_TM_TM_ZONE 1 +#define HAVE_SYS_PARAM_H 1 +/* #undef HAVE_SYS_UTIME_H */ +#define HAVE_TM_ISDST 1 +#define HAVE_TM_ZONE 1 +#define HAVE_VASPRINTF 1 +/* #undef HAVE_VFORK_H */ +/* #undef HAVE_XLOCALE_H */ +#define HAVE_ZLIB_H 1 +#define LT_OBJDIR ".libs/" +/* #undef MAJOR_IN_MKDEV */ +/* #undef MAJOR_IN_SYSMACROS */ +#define PACKAGE "file" +#define PACKAGE_BUGREPORT "christos@astron.com" +#define PACKAGE_NAME "file" +#define PACKAGE_STRING "file 5.29" +#define PACKAGE_TARNAME "file" +#define PACKAGE_URL "" +#define PACKAGE_VERSION "5.29" +/* #undef TM_IN_SYS_TIME */ +#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 +#define VERSION "5.29" +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif +#define ZLIBSUPPORT 1 +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif +/* #undef _FILE_OFFSET_BITS */ +/* #undef _LARGEFILE_SOURCE */ +/* #undef _LARGE_FILES */ +/* #undef _MINIX */ +/* #undef _POSIX_1_SOURCE */ +/* #undef _POSIX_SOURCE */ +/* #undef _UINT32_T */ +/* #undef _UINT64_T */ +/* #undef _UINT8_T */ +/* #undef const */ +/* #undef int32_t */ +/* #undef int64_t */ +/* #undef intptr_t */ +/* #undef mbstate_t */ +/* #undef off_t */ +/* #undef pid_t */ +/* #undef size_t */ +/* #undef uint16_t */ +/* #undef uint32_t */ +/* #undef uint64_t */ +/* #undef uint8_t */ +/* #undef uintptr_t */ +/* #undef vfork */ diff --git a/pkg/file/gen.rc b/pkg/file/gen.rc new file mode 100644 index 00000000..005f28cc --- /dev/null +++ b/pkg/file/gen.rc @@ -0,0 +1,59 @@ +version=5.29 +cflags\ + -Wall\ + -D HAVE_CONFIG_H\ + -D 'MAGIC=''"/share/file/magic"''' \ + -D _GNU_SOURCE\ + -isystem '$builddir'/pkg/zlib/include\ + -I include\ + -I '$dir' \ + -I '$outdir'/include + +build '$outdir'/include/magic.h sed '$srcdir'/src/magic.h.in ; with\ + expr s,X.YY,`{echo $version | tr -d .}^, +phony headers '$outdir'/include/magic.h + +build '$outdir'/file.1 sed '$srcdir'/doc/file.man ; exprs=(\ + -e s,__CSECTION__,1,g\ + -e s,__FSECTION__,5,g\ + -e s,__VERSION__,$version,g\ + -e s,__MAGIC__,/share/file/magic,g\ +) with expr $"exprs + +phony deps ('$dir' pkg/zlib)^/headers + +lib libmagic.a -d '$dir'/deps src/^(\ + magic.c\ + apprentice.c\ + softmagic.c\ + ascmagic.c\ + encoding.c\ + compress.c\ + is_tar.c\ + readelf.c\ + print.c\ + fsmagic.c\ + funcs.c\ + apptype.c\ + der.c\ + cdf.c\ + cdf_time.c\ + readcdf.c\ + \ + fmtcheck.c\ +) + +exe file -d '$dir'/headers src/file.c libmagic.a '$builddir/pkg/zlib/libz.a' +file bin/file '$outdir'/file 755 +file share/man/man1/file.1 '$outdir'/file.1 644 + +srcs=`{grep -v '^#' magic.txt} +for(src in $srcs) build '$outdir'/magic/$src copy '$srcdir'/magic/Magdir/$src +for(src in Header Localstuff) build '$outdir'/magic/$src copy '$srcdir'/magic/$src +magic_outs=magic/^(Header Localstuff $srcs) + +rule magic 'cd $outdir && file -C -m magic' +build '$outdir'/magic.mgc magic '|' '$outdir'/$magic_outs +file share/file/magic.mgc '$outdir'/magic.mgc 644 + +fetch git diff --git a/pkg/file/magic.txt b/pkg/file/magic.txt new file mode 100644 index 00000000..89286288 --- /dev/null +++ b/pkg/file/magic.txt @@ -0,0 +1,282 @@ +#