summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2013-05-09 01:50:20 +0100
committerStephen Dolan <mu@netsoc.tcd.ie>2013-05-09 01:50:20 +0100
commit282667bbd408824af6c6fdac46cd16530f591983 (patch)
treee0d9e97c367765656961f1d21715cfa1aef0b378
parent63b689bf5430ba82bede270999371795a90a5f39 (diff)
downloadjq-282667bbd408824af6c6fdac46cd16530f591983.tar.gz
Script for cross-compiling jq binaries for other platforms.
-rw-r--r--Makefile.am6
-rw-r--r--Makefile.in5
-rwxr-xr-xbuild/compile31
3 files changed, 40 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 5825049..f6fe3a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,7 +22,7 @@ AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \
# header file creation so we'll use good old make
BUILT_SOURCES = lexer.h lexer.c parser.h parser.c
lexer.c: lexer.l
- flex -o lexer.c --header-file=lexer.h lexer.l
+ flex -o lexer.c --header-file=lexer.h $<
lexer.h: lexer.c
# Tell YACC (bison) autoconf macros that you want a header file created.
@@ -54,6 +54,10 @@ docs/site.yml: configure.ac
sed 's/^jq_version: .*/jq_version: $(VERSION)/' $@ > $@.new
mv $@.new $@
+install-binaries: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec
+
+
# setup is only used by distribution developers, not package developers.
# Still, as a matter of allowing patching, its not a bad idea to distribute
# the developer setup script in the tarball.
diff --git a/Makefile.in b/Makefile.in
index 692cca2..01e011f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1090,7 +1090,7 @@ uninstall-man: uninstall-man1
uninstall-man1
lexer.c: lexer.l
- flex -o lexer.c --header-file=lexer.h lexer.l
+ flex -o lexer.c --header-file=lexer.h $<
lexer.h: lexer.c
### Building the jq binary
@@ -1103,6 +1103,9 @@ docs/site.yml: configure.ac
sed 's/^jq_version: .*/jq_version: $(VERSION)/' $@ > $@.new
mv $@.new $@
+install-binaries: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec
+
jq.1 :
cd ${abs_srcdir}/docs; rake manpage > ${abs_builddir}/$@
diff --git a/build/compile b/build/compile
new file mode 100755
index 0000000..7cfa94d
--- /dev/null
+++ b/build/compile
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# This script is used to cross-compile binaries for
+# platforms other than the current one
+
+# Usage: $0 <platformname> <configure options>
+# <platformname> is arbitrary, it is the name
+# of the directory which will be created to contain
+# the output binaries.
+
+# e.g. $0 win32 --host=i686-w64-mingw32
+
+set -e
+cd `dirname "$0"`
+
+plat="$1"
+[ -z "$plat" ] && exit 1
+shift
+
+[ -d "$plat" ] || mkdir "$plat"
+rm -rf "$plat/tmp"
+mkdir "$plat/tmp"
+cd "$plat/tmp"
+mkdir install_other
+../../../configure \
+ --prefix="`pwd`/install_other" \
+ --bindir="`pwd`/.." \
+ "$@"
+make install-binaries
+cd ..
+rm -rf tmp \ No newline at end of file