# HG changeset patch # User Tony Theodore # Date 1331642982 -39600 # Node ID 104e9e22453b984728344cdaba2868a3a8357c07 # Parent 8601be96cfa1901cdc1d6a5ead0f9ed8baed49f4 package file: reorganise and add test program -use separate native build dir -remove patch and use Make variable instead -add test program diff -r 8601be96cfa1 -r 104e9e22453b src/file-1-fix-cross-compilation-detection.patch --- a/src/file-1-fix-cross-compilation-detection.patch Tue Mar 13 03:01:04 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -r 8601be96cfa1 -r 104e9e22453b src/file-test.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/file-test.c Tue Mar 13 23:49:42 2012 +1100 @@ -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 -r 8601be96cfa1 -r 104e9e22453b src/file.mk --- a/src/file.mk Tue Mar 13 03:01:04 2012 +0100 +++ b/src/file.mk Tue Mar 13 23:49:42 2012 +1100 @@ -24,15 +24,21 @@ # 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