ports/121834: [patch] split AR into AR/ARFLAGS (for cross build override of AR)
John Hein
jhein at timing.com
Tue Mar 18 16:10:01 UTC 2008
>Number: 121834
>Category: ports
>Synopsis: [patch] split AR into AR/ARFLAGS (for cross build override of AR)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Mar 18 16:10:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: John Hein
>Release: FreeBSD ports
>Organization:
>Environment:
ports/lang/lua as of 20080318
>Description:
The lang/lua port has a Makefile in the distribution that _almost_ works
for cross compiles (e.g., to arm). But AR is defined as 'AR=ar rcu'.
Normally one overrides compile tools (CC, AR, RANLIB, etc.) with
cross versions of the tool (e.g., CC=arm-cc or similar). It's
hard to override AR for lua since its definition includes the
flags to AR. This is a deviation from the way things are normally
done and it breaks when one passes in AR=arm-ar (since the flags
will be missing when it comes time to run $(AR)).
see also discussion at http://marc.info/?l=lua-l&m=120468996914376&w=2
The reaction to the patch shown in the thread (and below) was all
positive (although there was some digression into conversation about
cross building in general and whether lua should use autoconf). But I
don't know if it made it in to lua's repo since that is private.
>How-To-Repeat:
Build cross tools for you favorite platform.
Try to cross build lua with the common technique of overriding
the build tools, like so (just make sym links named foo-* to the real tools
for purposes of testing)...
make MAKE_ARGS='CC=foo-cc AR=foo-ar' MAKE_ENV=STRIPBIN=foo-strip
See it fail when it gets to the ar line...
.
.
.
foo-cc -O2 -fno-strict-aliasing -pipe -O2 -Wall -DLUA_USE_POSIX -DLUA_USE_DLOPEN -c loadlib.c
foo-cc -O2 -fno-strict-aliasing -pipe -O2 -Wall -DLUA_USE_POSIX -DLUA_USE_DLOPEN -c linit.c
foo-ar liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o
foo-ar: illegal option -- .
Usage: foo-ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...
.
.
.
>Fix:
Add following patch file to lang/lua port. With this patch
I can cross build and use lua (tested on arm).
[Note: this is still needed in the most recent lua port, 5.1.3,
that was released in Jan 2008]
Index: ports/lang/lua/files/patch-src-Makefile
===================================================================
RCS file: ports/lang/lua/files/patch-src-Makefile
diff -N ports/lang/lua/files/patch-src-Makefile
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ports/lang/lua/files/patch-src-Makefile 18 Mar 2008 15:41:16 -0000
@@ -0,0 +1,21 @@
+--- src/Makefile.orig 2006-03-21 17:41:49.000000000 -0700
++++ src/Makefile 2008-03-18 09:41:01.000000000 -0600
+@@ -9,7 +9,8 @@
+
+ CC= gcc
+ CFLAGS= -O2 -Wall $(MYCFLAGS)
+-AR= ar rcu
++ARFLAGS= rcu
++AR= ar
+ RANLIB= ranlib
+ RM= rm -f
+ LIBS= -lm $(MYLIBS)
+@@ -48,7 +49,7 @@
+ a: $(ALL_A)
+
+ $(LUA_A): $(CORE_O) $(LIB_O)
+- $(AR) $@ $?
++ $(AR) $(ARFLAGS) $@ $?
+ $(RANLIB) $@
+
+ $(LUA_T): $(LUA_O) $(LUA_A)
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list