Print this page
7170 ENABLE_PERL64 multiarch builds
reviewed by: Andrew Stormont <andyjstormont@gmail.com>
reviewed by: Lauri Tirkkonen <lotheac@iki.fi>

@@ -11,41 +11,70 @@
 #
 # Copyright (c) 2014 Racktop Systems.
 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
 #
 
-# Link against libc as perl solaris specs
+# Link against libc as per solaris specs
 $(PERLEXT):= LDLIBS += -lc
+$(PERLEXT64):= LDLIBS += -lc
 
 # Allow for undefined symbols satisfied by perl
 $(PERLEXT):= ZDEFS =
+$(PERLEXT64):= ZDEFS =
 
 $(ROOTPERLEXT) := FILEMODE = 0555
 $(ROOTPERLMOD) := FILEMODE = 0444
+$(ROOTPERLEXT64) := FILEMODE = 0555
+$(ROOTPERLMOD64) := FILEMODE = 0444
 
 # CFLAGS for perl, specifically.
 PCFLAGS= -DPERL_EUPXS_ALWAYS_EXPORT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
         -DPERL_USE_SAFE_PUTENV -D_TS_ERRNO
+PCFLAGS64= -m64 -DPERL_EUPXS_ALWAYS_EXPORT -D_LARGEFILE64_SOURCE \
+        -DPERL_USE_SAFE_PUTENV -D_TS_ERRNO
 
-$(MACH):
+$(MACH) $(MACH64):
         $(INS.dir)
 
+# Sorry about this...
+# BUILD.SO doesn't have distinct versions like COMPILE.c/COMPILE64.c does.
+# To that end - we're defining BUILD64.SO here.
+BUILD64.SO=       $(CC) $(CFLAGS64) -o $@ $(GSHARED) $(DYNFLAGS) \
+                $(PICS) $(EXTPICS) -L $(ROOTLIBDIR64) $(LDLIBS)
+
 $(PERLEXT): $(MACH)/$(MODULE).o
         $(BUILD.SO) $(MACH)/$(MODULE).o
 
+$(PERLEXT64): $(MACH64)/$(MODULE).o
+        $(BUILD64.SO) $(MACH64)/$(MODULE).o
+
+# NOTE: With later version of Perl, we need to define PERL_EUPXS_ALWAYS_EXPORT
+# which is a backward-compatibility definition for the assumes-5.10 stuff here.
 $(MACH)/$(MODULE).o: $(MACH)/$(MODULE).c
         $(COMPILE.c) $(PCFLAGS) $(C_PICFLAGS) -I$(PERLINCDIR) $< -o $@
 
+$(MACH64)/$(MODULE).o: $(MACH64)/$(MODULE).c
+        $(COMPILE64.c) $(PCFLAGS64) $(C_PICFLAGS) -I$(PERLINCDIR64) $< -o $@
+
 $(MACH)/$(MODULE).c: $(MACH) $(MODULE).xs 
-        $(PERLDIR)/bin/xsubpp $(XSUBPPFLAGS) $(MODULE).xs >$@
+        ISALIST=$(MACH) $(XSUBPP) $(XSUBPPFLAGS) $(MODULE).xs >$@
 
-$(ROOTPERLMODDIR):
+$(MACH64)/$(MODULE).c: $(MACH64) $(MODULE).xs
+        ISALIST=$(MACH64) $(XSUBPP) $(XSUBPPFLAGS) $(MODULE).xs >$@
+
+$(ROOTPERLMODDIR) $(ROOTPERLMODDIR64):
         $(INS.dir)
 
 $(ROOTPERLMOD): $(ROOTPERLMODDIR) $(MODULE).pm
         $(RM) $@; $(INS) -s -m $(FILEMODE) -f $^
 
-$(ROOTPERLEXTDIR):
+$(ROOTPERLMOD64): $(ROOTPERLMODDIR64) $(MODULE).pm
+        $(RM) $@; $(INS) -s -m $(FILEMODE) -f $^
+
+$(ROOTPERLEXTDIR) $(ROOTPERLEXTDIR64):
         $(INS.dir)
 
 $(ROOTPERLEXT): $(ROOTPERLEXTDIR) $(MACH)/$(MODULE).so
+        $(RM) $@; $(INS) -s -m $(FILEMODE) -f $^
+
+$(ROOTPERLEXT64): $(ROOTPERLEXTDIR64) $(MACH64)/$(MODULE).so
         $(RM) $@; $(INS) -s -m $(FILEMODE) -f $^