usr/src/lib/curl/Makefile.sfw
changeset 0 b34509ac961f
child 9 502b128296a2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/curl/Makefile.sfw	Wed Oct 21 17:43:30 2009 +0200
@@ -0,0 +1,235 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"@(#)Makefile.sfw	1.9	09/08/24 SMI"
+#
+# This makefile builds both 32 and 64 bit versions of the library.
+# Builds occur in separate directories.
+#
+
+VER=curl-7.19.5
+VER64=$(VER)-64
+
+LARGEFILES=	-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+PREFIX = /usr
+
+# We need to do this because libtool adds wrong paths to RPATH.
+LDFLAGS += -L$(PREFIX)/lib -R$(PREFIX)/lib
+LDFLAGS += -L$(ROOT)/usr/lib
+LDFLAGS += -lgss
+
+EXTRA_LDFLAGS64 += -L$(PREFIX)/lib/$(MACH64)
+EXTRA_LDFLAGS64 += -L$(ROOT)/lib/$(MACH64)
+EXTRA_LDFLAGS64 += -R$(PREFIX)/lib/$(MACH64) 
+EXTRA_LDFLAGS64 += -lgss
+
+LD_OPTIONS = -M $(SRC)/cmd/mapfile_noexstk -z ignore
+LD_OPTIONS += -lsocket -lresolv -lnsl -lgen
+
+include ../Makefile.lib
+
+CONFIGURE_OPTIONS = --localstatedir=/var --enable-shared
+CONFIGURE_OPTIONS += --disable-static --enable-http --enable-ftp
+CONFIGURE_OPTIONS += --enable-file --enable-dict
+CONFIGURE_OPTIONS += --enable-telnet --enable-tftp
+CONFIGURE_OPTIONS += --enable-manual --disable-libgcc
+CONFIGURE_OPTIONS += --enable-ipv6 --enable-nonblocking
+CONFIGURE_OPTIONS += --enable-thread --enable-verbose
+CONFIGURE_OPTIONS += --disable-sspi --enable-crypto-auth
+CONFIGURE_OPTIONS += --enable-cookies --disable-hidden-symbols
+CONFIGURE_OPTIONS += --disable-soname-bump
+CONFIGURE_OPTIONS += --enable-ldap --with-random=/dev/urandom
+CONFIGURE_OPTIONS += --with-ssl --with-ldap-lib=ldap
+CONFIGURE_OPTIONS += --with-lber-lib=sldap
+CONFIGURE_OPTIONS += --with-gssapi-includes=/usr/include/gssapi
+CONFIGURE_OPTIONS += --with-gssapi-libs=/usr/lib
+CONFIGURE_OPTIONS += --with-gssapi=/usr --with-ca-bundle=/etc/curl/curlCA
+CONFIGURE_OPTIONS += --with-zlib=/usr --with-libidn=/usr
+CONFIGURE_OPTIONS += --with-pic
+
+all: real-all
+
+all32: $(VER)/config.status
+	(cd $(VER); env - "CFLAGS=$(CFLAGS) $(XREGSFLAG) $(LARGEFILES)" \
+	    "LD_OPTIONS=$(LD_OPTIONS)" \
+	    "LDFLAGS=$(LDFLAGS)" \
+	    PATH=$(SFW_PATH) \
+	    "MAKE=$(CCSMAKE)" $(CCSMAKE) -e) 
+
+# if we do not add $($(MACH64)_XARCH), CXX will assume that it's linking
+# 32-bit, and linking will fail.
+all64: $(VER64)/config.status
+	(cd $(VER64); env - "CFLAGS=$(CFLAGS64) $(XREGSFLAG64) $(LARGEFILES)" \
+	    "LD_OPTIONS=$(LD_OPTIONS)" \
+	    "LDFLAGS=$(EXTRA_LDFLAGS64) $($(MACH64)_XARCH)" \
+	    PATH=$(SFW_PATH) \
+	    "MAKE=$(CCSMAKE)" $(CCSMAKE) -e) 
+
+COMPAT_VERSION=	5
+
+# We need to add this because idn's includes and libraries should be
+# picked up from the shadow build area (for now)
+CPPFLAGS += -I$(ROOT)/usr/include/idn
+
+# We want a thread-safe curl
+CFLAGS += -mt -D_REENTRANT -D__EXTENSIONS__
+CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS += -D_XPG6 -D_XOPEN_SOURCE=600 -D_POSIX_PTHREAD_SEMANTICS
+CFLAGS += -D_POSIX_C_SOURCE=200112L -D__XOPEN_OR_POSIX
+CPPFLAGS += -D_THREAD_SAFE -D_REENTRANT -D__EXTENSIONS__
+CPPFLAGS += -D_LARGEFILE_SOURCE
+CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_XPG6 -D_XOPEN_SOURCE=600
+CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_POSIX_C_SOURCE=200112L
+CPPFLAGS +=  -D__XOPEN_OR_POSIX 
+
+# lint stuff
+LIBRARY=libcurl.a
+LINTOUT=        lint.out
+LINTFLAGS= 	-I./include -I. -Xc99=%all $(CCBITS32) $(LARGEFILES)
+LINTFLAGS64= 	-I./include -I. -Xc99=%all $(CCBITS64) $(LARGEFILES)
+
+install: all
+	$(SH) ./install-sfw
+	 MACH64=$(MACH64) $(SH) ./install-sfw-64
+
+real-all: all32 all64 lint32 lint64
+
+test: test32 test64
+
+# We need to use a different method for correcting the pkgconfig *.pc
+# files generated by libtool for curl. The contents of these files is,
+# by default, wrong. It includes the entire LDFLAGS, and it does not
+# include the correct -L directive for 64-bit builds. This is done 
+# by maintaining a correct set of libcurl.pc and libcurl-64.pc files,
+# and determining at make time the appropriate 64-bit ISA on which
+# the build is run.
+
+$(VER)/config.status: $(VER)/configure
+	( cd $(VER); \
+	    env - "CC=$(CC)" \
+	    "CPPFLAGS=$(CPPFLAGS)" \
+	    "CFLAGS=$(CPPFLAGS) $(CFLAGS)" \
+	    "CPP=$(CC) $(CFLAGS) $(CPPFLAGS) -E" \
+	    "CXX=$(CCC)" "CXXFLAGS=$(CPPFLAGS) $(CCFLAGS)" \
+	    "CXXCPP=$(CCC) $(CPPFLAGS) $(CCFLAGS) -E" \
+	    "LDFLAGS=$(LDFLAGS)" \
+	    "LD_OPTIONS=$(LD_OPTIONS)" \
+	    "CXXLDFLAGS=$(LDFLAGS)" \
+	    "CXXLD=$(CCC) $(LDFLAGS)" \
+	    PATH=$(SFW_PATH) \
+	    "INSTALL=$(GINSTALL)" \
+	    "MAKE=$(CCSMAKE)" \
+	    ./configure --prefix=$(PREFIX) \
+	    --bindir=$(PREFIX)/bin \
+	    --sbindir=$(PREFIX)/sbin \
+	    --libdir=$(PREFIX)/lib \
+	    --libexecdir=$(PREFIX)/libexec \
+	    $(CONFIGURE_OPTIONS) ; \
+	    rm -f curl-config; \
+	    cp -p ../Solaris/curl-config .; \
+	    touch -acm curl-config; \
+	    rm -f libcurl.pc; \
+	    cp -p ../Solaris/libcurl.pc .; \
+	    touch -acm libcurl.pc)
+
+$(VER64)/config.status: $(VER64)/configure
+	( cd $(VER64); \
+	    env - "CC=$(CC64)" \
+	    "CPPFLAGS=$(CPPFLAGS)" \
+	    "CFLAGS=$(CPPFLAGS) $(CFLAGS64)" \
+	    "CPP=$(CC64) $(CFLAGS64) $(CPPFLAGS) -E" \
+	    "CXX=$(CCC64)" "CXXFLAGS=$(CPPFLAGS) $(CCFLAGS64)" \
+	    "CXXCPP=$(CCC64) $(CPPFLAGS) $(CCFLAGS64) -E" \
+	    "LDFLAGS=$(EXTRA_LDFLAGS64) $($(MACH64)_XARCH)" \
+	    "LD_OPTIONS=$(LD_OPTIONS)" \
+	    "CXXLDFLAGS=$(EXTRA_LDFLAGS64) $($(MACH64)_XARCH)" \
+	    "CXXLD=$(CCC64) $(EXTRA_LDFLAGS64) $($(MACH64)_XARCH)" \
+	    "CXXLINKLIB=$(CCC64) $(EXTRA_LDFLAGS64) $($(MACH64)_XARCH)" \
+	    "MACH64=$(MACH64)" \
+	    PATH=$(SFW_PATH) \
+	    "INSTALL=$(GINSTALL)" \
+	    "MAKE=$(CCSMAKE)" \
+	    ./configure --prefix=$(PREFIX) \
+	    --bindir=$(PREFIX)/bin/$(MACH64) \
+	    --sbindir=$(PREFIX)/sbin/$(MACH64) \
+	    --libdir=$(PREFIX)/lib/$(MACH64) \
+	    --libexecdir=$(PREFIX)/libexec/$(MACH64) \
+	    $(CONFIGURE_OPTIONS) ; \
+	    rm -f curl-config; \
+	    cp -p ../Solaris/curl-config-64 curl-config; \
+	    touch -acm curl-config; \
+	    rm -f libcurl.pc; \
+	    cp -p ../Solaris/libcurl.pc .; \
+	    /bin/ksh ../postprocess-pkgconfig-64 libcurl.pc )
+
+$(VER)/configure: $(VER).tar.gz
+	mkdir -p tmp; gzip -dc $(VER).tar.gz | (cd tmp; tar xopf -)
+	mv tmp/$(VER) $(VER); rmdir tmp
+	( cd $(VER) ; \
+	    gpatch -p1 <../Solaris/diffs/configure.0.diff ; \
+	    gpatch -p1 <../Solaris/diffs/Makefile.in.1.diff ; \
+	    gpatch -p1 <../Solaris/diffs/curlbuild.h.2.diff ; \
+	    gpatch -p1 <../Solaris/diffs/Makefile.in.3.diff ; \
+	    gpatch -p1 < ../Solaris/diffs/curl-7.19.5-CVE-2009-2417.patch ; \
+	    gpatch -p1 < ../Solaris/diffs/curl-multi-crash-2.patch ; \
+	    touch -acm configure ; \
+	    touch -acm include/curl/curlbuild.h ; \
+	    chmod 0755 configure )
+
+$(VER64)/configure: $(VER).tar.gz
+	mkdir -p tmp; gzip -dc $(VER).tar.gz | (cd tmp; tar xopf -)
+	mv tmp/$(VER) $(VER64); rmdir tmp
+	( cd $(VER64) ; \
+	    gpatch -p1 <../Solaris/diffs/configure.0.diff ; \
+	    gpatch -p1 <../Solaris/diffs/Makefile.in.1.diff ; \
+	    gpatch -p1 <../Solaris/diffs/curlbuild.h.2.diff ; \
+	    gpatch -p1 <../Solaris/diffs/Makefile.in.3.diff ; \
+	    gpatch -p1 < ../Solaris/diffs/curl-7.19.5-CVE-2009-2417.patch ; \
+	    gpatch -p1 < ../Solaris/diffs/curl-multi-crash-2.patch ; \
+	    touch -acm configure ; \
+	    touch -acm include/curl/curlbuild.h ; \
+	    chmod 0755 configure )
+clean:
+	-rm -rf $(VER)
+	-rm -rf $(VER64)
+
+lint32: $(VER)/config.status
+	(cd $(VER); \
+		$(LINT.c) -o $(LIBNAME) ../llib-lcurl > $(LINTOUT) 2>&1)
+
+lint64: $(VER64)/config.status
+	(cd $(VER64); \
+		$(LINT64.c) -o $(LIBNAME) ../llib-lcurl > $(LINTOUT) 2>&1)
+
+test32: $(VER)/config.status
+	( cd $(VER) ; \
+	    $(GMAKE) check > $(SRC)/lib/curl/test-results-$(MACH).out 2>&1 )
+
+test64: $(VER64)/config.status
+	( cd $(VER64) ; \
+	    $(GMAKE) check > $(SRC)/lib/curl/test-results-$(MACH64).out 2>&1 )
+
+install_h:
+
+include ../Makefile.targ