tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

clang support (was: [HEADS-UP] Freeze in Preparation for pkgsrc-2010Q4 Branch)



> This is just a quick heads-up that we plan to have a (shorter than
> usual) freeze in pkgsrc for new functionality in preparation for the
> new pkgsrc-2010Q4 branch.
I've stumbled over a bunch of problems trying to build with (native Xcode) 
clang on Mac OS 10.6. Could these be fixed for 2011Q1 or should they be 
postponed for the next release?

adam@ already fixed (or at least proposed fixes for) some of them.

1. Bootstrap

Bootstrapping unconditionaly sets CC to gcc. I think this should be possible to 
override:

Index: bootstrap/bootstrap
===================================================================
RCS file: /cvsroot/pkgsrc/bootstrap/bootstrap,v
retrieving revision 1.159
diff -u -r1.159 bootstrap
--- bootstrap/bootstrap 30 Aug 2010 06:21:49 -0000      1.159
+++ bootstrap/bootstrap 25 Dec 2010 16:35:35 -0000
@@ -472,7 +472,7 @@
        set_opsys=no
        [ -z "$fetch_cmd" ] && fetch_cmd="/usr/bin/ftp"
        machine_arch=`uname -p`
-       CC="gcc -isystem /usr/include"; export CC
+       CC=${CC:-"gcc -isystem /usr/include"}; export CC
        osrev=`uname -r`
        macosx_version=`echo $osrev | awk -F . '{ print "10."$1-4; }'`
        case "$macosx_version" in

2. ABI

In bsd.prefs.mk, there is commented-out logic for Snow Leopard to autodetect 
32/64Bit API. Could this be enables?

The value of ABI dosn't actually reflect the ABI clang generates. The following 
patch to mk/compiler/clang.mk (by adam@) fixes this:

--- mk/compiler/clang.mk        3 Nov 2010 18:05:05 -0000       1.3
+++ mk/compiler/clang.mk        24 Dec 2010 19:14:32 -0000
@@ -49,6 +49,8 @@
CC_VERSION?=            clang
.endif

+_COMPILER_ABI_FLAG.32= -m32
+_COMPILER_ABI_FLAG.64= -m64
_COMPILER_LD_FLAG=      -Wl,
_LINKER_RPATH_FLAG=     -rpath
_COMPILER_RPATH_FLAG=   ${_COMPILER_LD_FLAG}${_LINKER_RPATH_FLAG},

3. Autoconf

Several package's configure scripts decide that cpp was /lib/cpp and in turn 
fail to recognize each and every standard header file. adam@ fixed jpeginfo and 
recode. math/gap needs "make configure.out" in the "cnf" subdirectory.

4. More Autoconf

Worse than 3., cross/avr-{gcc,binutils} not only have broken configure scripts, 
but also insist on autoconf 2.59. Any auto* experts around knowing how to fix 
this?

5. Libtool tag

Several package's makefiles fail to pass a --tag value to libtool

Index: devel/libusb/patches/patch-ae
===================================================================
RCS file: /cvsroot/pkgsrc/devel/libusb/patches/patch-ae,v
retrieving revision 1.2
diff -u -r1.2 patch-ae
--- devel/libusb/patches/patch-ae       11 Mar 2006 08:34:13 -0000      1.2
+++ devel/libusb/patches/patch-ae       25 Dec 2010 16:35:59 -0000
@@ -1,8 +1,30 @@
-$NetBSD: patch-ae,v 1.2 2006/03/11 08:34:13 adam Exp $
-
 --- Makefile.in.orig   2006-03-04 03:54:03.000000000 +0100
-+++ Makefile.in
-@@ -295,7 +295,7 @@ libusbpp_la_LDFLAGS = \
++++ Makefile.in        2010-12-19 16:24:50.000000000 +0100
+@@ -86,19 +86,19 @@
+ @AMDEP_TRUE@  ./$(DEPDIR)/usbpp.Plo
+ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
++LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
++LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+-LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
++LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CXXFLAGS) $(CXXFLAGS)
+ CXXLD = $(CXX)
+-CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
++CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) 
$(CXXFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ SOURCES = $(libusb_la_SOURCES) $(libusbpp_la_SOURCES)
+ DIST_SOURCES = $(am__libusb_la_SOURCES_DIST) $(libusbpp_la_SOURCES)
+@@ -295,7 +295,7 @@
        -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
        -release $(LT_RELEASE) \
        -export-dynamic \

Index: devel/readline/patches/patch-ae
===================================================================
RCS file: /cvsroot/pkgsrc/devel/readline/patches/patch-ae,v
retrieving revision 1.14
diff -u -r1.14 patch-ae
--- devel/readline/patches/patch-ae     23 Feb 2009 12:35:46 -0000      1.14
+++ devel/readline/patches/patch-ae     25 Dec 2010 16:36:10 -0000
@@ -27,7 +27,7 @@
 +.SUFFIXES: .lo
 +.c.lo:
 +      ${RM} $@
-+      $(LIBTOOL) --mode=compile $(CC) -c $(CCFLAGS) $<
++      $(LIBTOOL) --mode=compile --tag=CC $(CC) -c $(CCFLAGS) $<
 +
  # The name of the main library target.
  LIBRARY_NAME = libreadline.a
@@ -51,7 +51,7 @@
  
 +libreadline.la: $(OBJECTS:.o=.lo)
 +      $(LIBTOOL) --mode=clean $(RM) $@
-+      $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS:.o=.lo) $(TERMCAP_LIB) \
++      $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@ $(OBJECTS:.o=.lo) 
$(TERMCAP_LIB) \
 +              -rpath $(libdir) -version-info $(SHLIB_MAJOR):$(SHLIB_MINOR) \
 +              $(LDFLAGS)
 +
@@ -62,7 +62,7 @@
  
 +libhistory.la: $(HISTOBJ:.o=.lo) xmalloc.lo
 +      $(LIBTOOL) --mode=clean $(RM) $@
-+      $(LIBTOOL) --mode=link $(CC) -o $@ $(HISTOBJ:.o=.lo) xmalloc.lo \
++      $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@ $(HISTOBJ:.o=.lo) 
xmalloc.lo \
 +              -rpath $(libdir) -version-info $(SHLIB_MAJOR):$(SHLIB_MINOR) \
 +              $(LDFLAGS)
 +
@@ -74,7 +74,7 @@
  
 +tilde.lo:     tilde.c
 +      $(LIBTOOL) --mode=clean rm -f $@
-+      $(LIBTOOL) --mode=compile $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -c 
$(srcdir)/tilde.c
++      $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CCFLAGS) -DREADLINE_LIBRARY 
-c $(srcdir)/tilde.c
 +
  readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a
        $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -o $@ $(top_srcdir)/examples/rl.c 
./libreadline.a ${TERMCAP_LIB}

6. etc

libusb uses incorrect printf formats:

Index: devel/libusb/patches/patch-af
===================================================================
RCS file: /cvsroot/pkgsrc/devel/libusb/patches/patch-af,v
retrieving revision 1.1
diff -u -r1.1 patch-af
--- devel/libusb/patches/patch-af       20 Feb 2010 22:42:02 -0000      1.1
+++ devel/libusb/patches/patch-af       25 Dec 2010 16:35:59 -0000
@@ -1,7 +1,7 @@
-$NetBSD: patch-af,v 1.1 2010/02/20 22:42:02 schwarz Exp $
+$NetBSD: patch-af $
 
---- darwin.c.orig      2010-02-20 23:22:35.000000000 +0100
-+++ darwin.c   2010-02-20 23:36:10.000000000 +0100
+--- darwin.c.orig      2006-03-04 03:52:46.000000000 +0100
++++ darwin.c   2010-12-19 16:18:33.000000000 +0100
 @@ -254,7 +254,7 @@
    
    result = IOCreatePlugInInterfaceForService(usbDevice, 
kIOUSBDeviceUserClientTypeID,
@@ -41,3 +41,21 @@
    rw_arg->result  = result;
  
    CFRunLoopStop(rw_arg->cf_loop);
+@@ -1064,7 +1064,7 @@
+     result = (*(device))->GetDeviceAddress(device, (USBDeviceAddress 
*)&address);
+ 
+     if (usb_debug >= 2)
+-      fprintf(stderr, "usb_os_find_devices: Found USB device at location 
0x%08lx\n", location);
++      fprintf(stderr, "usb_os_find_devices: Found USB device at location 
0x%08x\n", location);
+ 
+     /* first byte of location appears to be associated with the device's bus 
*/
+     if (location >> 24 == bus_loc >> 24) {
+@@ -1091,7 +1091,7 @@
+       LIST_ADD(fdev, dev);
+ 
+       if (usb_debug >= 2)
+-      fprintf(stderr, "usb_os_find_devices: Found %s on %s at location 
0x%08lx\n",
++      fprintf(stderr, "usb_os_find_devices: Found %s on %s at location 
0x%08x\n",
+               dev->filename, bus->dirname, location);
+     }
+ 

luatex uses a CFLAGS quoting style that fails with clang:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/print/luatex/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile    13 Sep 2010 04:11:52 -0000      1.7
+++ Makefile    25 Dec 2010 17:10:45 -0000
@@ -94,7 +94,7 @@
                --with-zlib-libdir=${BUILDLINK_PREFIX.zlib}/lib
 CONFIGURE_DIRS+=. ./texk/web2c
 MAKE_FLAGS+=   LIBTOOL=${LIBTOOL:Q}
-CFLAGS+=       -DLUA_ROOT=\"${PREFIX}/\"
+CFLAGS+=       -DLUA_ROOT="\"${PREFIX}/\""
 
 INSTALLATION_DIRS+=    bin
 
Thanks.


Home | Main Index | Thread Index | Old Index