1 # 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License (the "License"). 7 # You may not use this file except in compliance with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 # Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 # Use is subject to license terms. 24 # 25 #ident "@(#)Makefile.sfw 1.21 09/10/20 SMI" 26 27 VER=$(COMPONENT_NAME:sh)-$(COMPONENT_VERSION:sh) 28 29 PERL=/usr/perl5/bin/perl 30 31 # Since mod_perl 2.x doesn't have any easy way to compile in 32 # the path to the apache perl stuff that should be added to 33 # @INC, we take advantage of default 1.x behavior and put 34 # our stuff under $SERVERROOT/lib/perl. If you change ServerRoot 35 # in httpd.conf-example, you need to change it here too. 36 37 include ../apache2/apache.build.env 38 39 AP_PERL5LIB=$(APACHE_USR_PREFIX)/lib/perl 40 AP_PERL5BIN=$(APACHE_USR_PREFIX)/bin 41 42 PERLMAN=$(APACHE_USR_PREFIX)/man 43 44 include ../Makefile.cmd 45 46 SFW_PATH="$(SPRO_VROOT)/bin:/usr/perl5/bin:$(PATH)" 47 48 all: $(VER)/Makefile 49 $(INCREFIXUP) $(VER) 50 (cd $(VER); env \ 51 LD_OPTIONS="-M $(SRC)/cmd/mapfile_noexstk" \ 52 CC=$(CC) CXX=$(CCC) \ 53 "CFLAGS=$(CFLAGS)" \ 54 PATH=$(SFW_PATH) \ 55 MAKE=$(CCSMAKE) \ 56 PERL=/usr/perl5/bin/perl \ 57 DESTDIR=$(ROOT) \ 58 INSTALL=/usr/ucb/install \ 59 $(CCSMAKE) -e) 60 @find . -name core -type f -exec rm -f {} \; 61 62 test: # execute directly in mod_perl source dir with make test 63 64 install: all 65 if [ -d $(ROOT)$(APACHE_USR_PREFIX)/lib/perl/auto/mod_perl2 ]; then \ 66 chmod -R u+w $(ROOT)$(APACHE_USR_PREFIX)/lib/perl/auto/mod_perl2; \ 67 fi 68 if [ -f $(ROOT)$(APACHE_USR_PREFIX)/lib/perl/perllocal.pod ]; then \ 69 chmod u+w $(ROOT)$(APACHE_USR_PREFIX)/lib/perl/perllocal.pod; \ 70 fi 71 if [ -f $(ROOT)$(APACHE_USR_PREFIX)/libexec/mod_perl.so ]; then \ 72 chmod u+w $(ROOT)$(APACHE_USR_PREFIX)/libexec/mod_perl.so; \ 73 fi 74 (cd $(VER); env \ 75 LD_OPTIONS="-M $(SRC)/cmd/mapfile_noexstk" \ 76 CC=$(CC) CXX=$(CCC) \ 77 "CFLAGS=$(CFLAGS)" \ 78 PATH=$(SFW_PATH) \ 79 MAKE=$(CCSMAKE) \ 80 DESTDIR=$(ROOT) \ 81 MODPERL_AP_INCLUDEDIR=$(APACHE_USR_PREFIX)/include \ 82 MODPERL_AP_LIBEXECDIR=$(APACHE_USR_PREFIX)/libexec \ 83 PERL=/usr/perl5/bin/perl \ 84 INSTALL=/usr/ucb/install \ 85 $(CCSMAKE) -e install) 86 sh ./install-sfw 87 88 # Please note second sed command which enables us to compile working mod_perl 89 # even when we don't have on build machine installed Apache2 compiled with 90 # large file support options (-D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64). 91 92 $(VER)/Makefile: $(VER)/Makefile.PL 93 (cd $(VER); env \ 94 CC=$(CC) CXX=$(CCC) \ 95 "CFLAGS=$(CFLAGS)" \ 96 PATH=$(SFW_PATH) \ 97 MAKE=$(CCSMAKE) \ 98 PERL=/usr/perl5/bin/perl \ 99 DESTDIR=$(ROOT) \ 100 INSTALL=/usr/ucb/install \ 101 perl Makefile.PL \ 102 MP_APU_CONFIG=$(ROOT)/usr/apr-util/1.3/bin/apu-1-config \ 103 MP_APR_CONFIG=$(ROOT)/usr/apr/1.3/bin/apr-1-config \ 104 MP_APXS=$(ROOT)$(APACHE_USR_PREFIX)/bin/apxs \ 105 INSTALLDIRS=perl \ 106 INSTALLSITELIB=$(AP_PERL5LIB) \ 107 INSTALLARCHLIB=$(AP_PERL5LIB) \ 108 INSTALLSITEARCH=$(AP_PERL5LIB) \ 109 INSTALLPRIVLIB=$(AP_PERL5LIB) \ 110 SITEARCHEXP=$(AP_PERL5LIB) \ 111 SITELIBEXP=$(AP_PERL5LIB) \ 112 INSTALLMAN1DIR=$(PERLMAN)/man1 \ 113 INSTALLMAN3DIR=$(PERLMAN)/man3 \ 114 INSTALLSCRIPT=$(AP_PERL5BIN); \ 115 for i in `find . -name Makefile` ; \ 116 do \ 117 sed -e '/^CC/s;CC = cc;CC = $(CC);' \ 118 -e '/^LD =/s;LD = cc;LD = $(CC);' \ 119 -e '/^CCFLAGS/s;CCFLAGS = ;CCFLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64;' \ 120 -e '/^MODPERL_CCOPTS/s;MODPERL_CCOPTS = ;MODPERL_CCOPTS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64;' \ 121 -e '/^MODPERL_INC/s;-I'$(APACHE_USR_PREFIX)'/include;-I'$(ROOT)$(APACHE_USR_PREFIX)'/include;g' \ 122 -e '/^MODPERL_AP_INCLUDEDIR =/s;'$(ROOT)$(APACHE_USR_PREFIX)';'$(APACHE_USR_PREFIX)';g' \ 123 -e '/^MODPERL_AP_LIBEXECDIR =/s;'$(ROOT)$(APACHE_USR_PREFIX)';'$(APACHE_USR_PREFIX)';g' \ 124 -e '/^INC/s;-I$(APACHE_USR_PREFIX)/include;-I'$(ROOT)$(APACHE_USR_PREFIX)'/include;g' \ 125 -e '/^LDDLFLAGS =/s;-[LR]'$(ROOT)$(APACHE_USR_PREFIX)'/lib;;g;s; \( *\); ;g' \ 126 -e '/^LDDLFLAGS =/s;-R'$(ROOT)'/usr/apr/1.3/lib;-R/usr/apr/1.3/lib;g;s; \( *\); ;g' \ 127 -e '/^LDDLFLAGS =/s;-R'$(ROOT)'/usr/apr-util/1.3/lib;-R/usr/apr-util/1.3/lib;g;s; \( *\); ;g' \ 128 -e '/^LD_RUN_PATH =/s;'$(ROOT)$(APACHE_USR_PREFIX)'/lib\(:*\);;g;s; \( *\); ;g' \ 129 -e '/^LD_RUN_PATH =/s;'$(ROOT)'/usr/apr/1.3/lib;/usr/apr/1.3/lib:/usr/apr-util/1.3/lib;g;s; \( *\); ;g' \ 130 -e '/^EXTRALIBS =/s;-R'$(ROOT)'/usr/apr/1.3/lib;-R/usr/apr/1.3/lib -L'$(ROOT)'/usr/apr-util/1.3/lib -R/usr/apr-util/1.3/lib;g;s; \( *\); ;g' \ 131 $$i > $$i.1; \ 132 mv $$i.1 $$i; \ 133 done; \ 134 grep D_LARGEFILE_SOURCE Makefile || for i in `find . -name Makefile` ; \ 135 do \ 136 sed -e '/^MODPERL_CCOPTS/s;MODPERL_CCOPTS = ;MODPERL_CCOPTS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64;' \ 137 -e '/^CCFLAGS/s;CCFLAGS = ;CCFLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64;' \ 138 -e '/^MODPERL_INC/s;-I'$(APACHE_USR_PREFIX)'/include;-I'$(ROOT)$(APACHE_USR_PREFIX)'/include;g' \ 139 -e '/^INC/s;-I$(APACHE_USR_PREFIX)/include;-I$(ROOT)$(APACHE_USR_PREFIX)/include;g' \ 140 $$i > $$i.1; \ 141 mv $$i.1 $$i; \ 142 done) 143 144 $(VER)/Makefile.PL: $(VER).tar.gz 145 gzip -dc $(VER).tar.gz | tar xopf - 146 (cd $(VER); gpatch -p1 --no-backup-if-mismatch < ../CVE-2009-0796.patch) 147 touch $(VER)/lib/Apache2/Reload.pm 148 gpatch -p0 < Reload.patch 149 touch $(VER)/Makefile.PL 150 151 clean: 152 -rm -rf $(VER) 153 154 include ../Makefile.targ 155