summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2012-03-13 12:49:42 (GMT)
committerTony Theodore <tonyt@logyst.com>2012-03-13 12:49:42 (GMT)
commit94aa65ad1a84b9ed00b98b3c446e1c4fa6ce1b9f (patch)
tree7e6b595e93de30699dd5d6b72afd6de6bb14ac87
parentc5a2e48f98ac993f345bd17848260ca8b1194268 (diff)
downloadmxe-94aa65ad1a84b9ed00b98b3c446e1c4fa6ce1b9f.zip
mxe-94aa65ad1a84b9ed00b98b3c446e1c4fa6ce1b9f.tar.gz
mxe-94aa65ad1a84b9ed00b98b3c446e1c4fa6ce1b9f.tar.bz2
package file: reorganise and add test program
-use separate native build dir -remove patch and use Make variable instead -add test program
-rw-r--r--src/file-1-fix-cross-compilation-detection.patch21
-rw-r--r--src/file-test.c14
-rw-r--r--src/file.mk16
3 files changed, 25 insertions, 26 deletions
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 <stdio.h>
+#include <magic.h>
+
+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