Permalink
Browse files

Look at the archs in the dylibs we use and only build for the common …

…subset.

git-svn-id: https://svn.macosforge.org/repository/darwinbuild/trunk@493 10a61168-4876-4dac-953b-31e694342555
  • Loading branch information...
wsiegrist@apple.com
wsiegrist@apple.com committed Mar 20, 2009
1 parent e65680f commit d47bd92fc4630de5b8c5704861971dd891a5512b
Showing with 33 additions and 1 deletion.
  1. +31 −0 archs.sh
  2. +2 −1 common.mk
@@ -0,0 +1,31 @@
#!/bin/sh

#
# Detect which arches we should build for
#

CRYPTO_ARCHS=`lipo -info /usr/lib/libcrypto.dylib | cut -d : -f 3`
SQLITE_ARCHS=`lipo -info /usr/lib/libsqlite3.dylib | cut -d : -f 3`
TCL_ARCHS=`lipo -info /usr/lib/libtcl.dylib | cut -d : -f 3`
SYSTEM_ARCHS=`lipo -info /usr/lib/libSystem.dylib | cut -d : -f 3`

# start with one set of archs
FINAL_ARCHS=$SYSTEM_ARCHS

for ARCH in $SYSTEM_ARCHS;
do
# crosscheck against the remaining sets...
for ALIST in "$CRYPTO_ARCHS" "$SQLITE_ARCHS" "$TCL_ARCHS";
do
# see if ARCH is not in ALIST
if [[ ${ALIST/$ARCH} == $ALIST ]];
then
# ARCH was not found, so remove from final archs
FINAL_ARCHS="${FINAL_ARCHS/$ARCH}";
fi
done;
done;

# print what is left over
echo $FINAL_ARCHS

@@ -5,6 +5,7 @@ PREFIX?=/usr/local
DESTDIR?=$(DSTROOT)

### makefile variables normally set by XBS
SRCROOT?=.
OBJROOT?=.
SYMROOT?=.

@@ -20,6 +21,6 @@ INSTALL_DOC_FLAGS=-m 0644 -o root -g wheel

SED=/usr/bin/sed

RC_CFLAGS?=$(shell lipo -info /usr/lib/libSystem.dylib | cut -d : -f 3 | sed 's/ppc7400/ppc/' | awk '{ ORS=" "; for(i=1;i<=NF;i++) print "-arch", $$i}')
RC_CFLAGS?=$(shell ../archs.sh | awk '{ ORS=" "; for(i=1;i<=NF;i++) print "-arch", $$i}')
CFLAGS+=$(RC_CFLAGS)

0 comments on commit d47bd92

Please sign in to comment.