Print this page
3900 illumos will not build against gcc compiled perl

@@ -18,10 +18,11 @@
 #
 # CDDL HEADER END
 #
 #
 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013 Racktop Systems.
 #
 
 include ../../Makefile.cmd
 
 # To turn KEEP_STATE off the following two environment variables must be unset.

@@ -31,16 +32,29 @@
 # staging area to postprocess and install the result to $(ROOT)
 STAGE = $(SRC)/cmd/perl/$(PERL_VERSION)/staging
 
 PERL=/usr/perl5/$(PERL_VERSION)/bin/perl
 
-PERL_MM_ARGS = INSTALLDIRS=perl CC='$(CC)' LD='$(CC)'
+PERL_MM_ARGS = CC='$(CC)' LD='$(CC)'
 
 # Prefix for Solaris-specific extensions that are maintained by
 # Sun/Oracle.
 SUN_SOLARIS = Sun/Solaris
 
+# When building with gcc we don't bother with cw.  Intead we use PerlGcc to
+# make sure the Makefile contains options that the compiler will understand.
+# The version on the host could be incomplete so use the one we're building.
+PERL5LIB =
+$(__GNUC)PERL5LIB= \
+    $(SRC)/cmd/perl/$(PERL_VERSION)/$(SUN_SOLARIS)/PerlGcc
+
+$(__GNUC)PERL_MM_ARGS = \
+    CC='$(GCC_ROOT)/bin/gcc' \
+    LD='$(GCC_ROOT)/bin/gcc'
+
+PERL_MM_ARGS += INSTALLDIRS=perl
+
 # Add any XS extensions here.
 PERL_DYNAMIC_EXT = \
     $(SUN_SOLARIS)/Utils \
     $(SUN_SOLARIS)/Kstat \
     $(SUN_SOLARIS)/Intrs \

@@ -58,10 +72,13 @@
     $(SUN_SOLARIS)/Pg
 
 PERL_EXT = $(PERL_DYNAMIC_EXT) $(PERL_NONXS_EXT)
 PERL_EXT_MAKEFILES = $(PERL_EXT:%=%/Makefile)
 
+# When doing a gcc build we need to build PerGcc before the dynamic extenions.
+$(__GNUC)$(PERL_DYNAMIC_EXT:%=%/Makefile): $(SUN_SOLARIS)/PerlGcc/Makefile
+
 all: copy_contrib $(PERL_EXT_MAKEFILES) $(PERL_EXT)
 
 .PARALLEL: $(PERL_EXT_MAKEFILES) $(PERL_EXT)
 
 install: all

@@ -112,11 +129,12 @@
 #
 # Ensure that the extension's makefile is built before
 # trying to build the extension
 #
 %/Makefile: %/Makefile.PL $(PERL_CONFIGDEP)
-        @ cd $(@D); pwd; $(PERL) $(<F) $(PERL_MM_ARGS) 2>&1 /dev/null
+        @ cd $(@D); pwd; PERL5LIB=$(PERL5LIB) \
+                $(PERL) $(<F) $(PERL_MM_ARGS) 2>&1 /dev/null
 
 # Pattern-matching rule for extensions.
 $(SUN_SOLARIS)/%: $(SUN_SOLARIS)/%/Makefile FRC
         @ cd $@; pwd; $(KEEP_STATE_OFF) ; \
                 $(PERL_MM_ARGS) $(MAKE) DESTDIR=$(STAGE) all