package file: reorganise and add test program

-use separate native build dir
-remove patch and use Make variable instead
-add test program
This commit is contained in:
Tony Theodore 2012-03-13 23:49:42 +11:00
parent c5a2e48f98
commit 94aa65ad1a
3 changed files with 25 additions and 26 deletions

View File

@ -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

14
src/file-test.c Normal file
View File

@ -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;
}

View File

@ -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