From 94aa65ad1a84b9ed00b98b3c446e1c4fa6ce1b9f Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 13 Mar 2012 23:49:42 +1100 Subject: package file: reorganise and add test program -use separate native build dir -remove patch and use Make variable instead -add test program --- src/file-1-fix-cross-compilation-detection.patch | 21 --------------------- src/file-test.c | 14 ++++++++++++++ src/file.mk | 16 +++++++++++----- 3 files changed, 25 insertions(+), 26 deletions(-) delete mode 100644 src/file-1-fix-cross-compilation-detection.patch create mode 100644 src/file-test.c diff --git a/src/file-1-fix-cross-compilation-detection.patch b/src/file-1-fix-cross-compilation-detection.patch deleted file mode 100644 index 18e97a5..0000000 --- a/src/file-1-fix-cross-compilation-detection.patch +++ /dev/null @@ -1,21 +0,0 @@ -This file is part of mingw-cross-env. -See doc/index.html for further information. - -diff -Nur file-5.09/magic/Makefile.am file-5.09-mingw-cross-env/magic/Makefile.am ---- file-5.09/magic/Makefile.am 2011-09-08 23:58:42.000000000 +0200 -+++ file-5.09-mingw-cross-env/magic/Makefile.am 2011-10-23 17:31:31.456765605 +0200 -@@ -253,13 +253,8 @@ - - # FIXME: Build file natively as well so that it can be used to compile - # the target's magic file; for now we bail if the local version does not match --if IS_CROSS_COMPILE --FILE_COMPILE = file -+FILE_COMPILE = $(top_builddir)/src/file.local - FILE_COMPILE_DEP = --else --FILE_COMPILE = $(top_builddir)/src/file --FILE_COMPILE_DEP = $(FILE_COMPILE) --endif - - ${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP) - @rm -fr magic diff --git a/src/file-test.c b/src/file-test.c new file mode 100644 index 0000000..6039ed4 --- /dev/null +++ b/src/file-test.c @@ -0,0 +1,14 @@ +/* This file is part of mingw-cross-env. */ +/* See doc/index.html for further information. */ + +#include +#include + +int main(int argc, char *argv[]) +{ + (void)argc; + (void)argv; + + fprintf(stdout, "magic file from %s\n", magic_getpath(NULL, 0)); + return 0; +} \ No newline at end of file diff --git a/src/file.mk b/src/file.mk index 3386607..4de99ec 100644 --- a/src/file.mk +++ b/src/file.mk @@ -24,15 +24,21 @@ define $(PKG)_BUILD # itself. This must match the source code regarding its # version. Therefore we build a native one ourselves first. - cd '$(1)' && ./configure \ + cp -Rp '$(1)' '$(1).native' + cd '$(1).native' && ./configure \ --disable-shared - $(MAKE) -C '$(1)/src' -j '$(JOBS)' file - cp '$(1)/src/file' '$(1)/src/file.local' + $(MAKE) -C '$(1).native/src' -j '$(JOBS)' file cd '$(1)' && ./configure \ --host='$(TARGET)' \ + --build="`config.guess`" \ --disable-shared \ --prefix='$(PREFIX)/$(TARGET)' - $(MAKE) -C '$(1)' clean - $(MAKE) -C '$(1)' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= + $(MAKE) -C '$(1)' -j '$(JOBS)' bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= man_MANS= FILE_COMPILE='$(1).native/src/file' + $(MAKE) -C '$(1)' -j 1 install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= man_MANS= + + '$(TARGET)-gcc' \ + -W -Wall -Werror -ansi -pedantic \ + '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-file.exe' \ + -lmagic -lgnurx -lshlwapi endef -- cgit v0.12