Home | History | Annotate | Download | only in apache2
      1 #
      2 # CDDL HEADER START
      3 #
      4 # The contents of this file are subject to the terms of the
      5 # Common Development and Distribution License (the "License").
      6 # You may not use this file except in compliance with the License.
      7 #
      8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9 # or http://www.opensolaris.org/os/licensing.
     10 # See the License for the specific language governing permissions
     11 # and limitations under the License.
     12 #
     13 # When distributing Covered Code, include this CDDL HEADER in each
     14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15 # If applicable, add the following below this CDDL HEADER, with the
     16 # fields enclosed by brackets "[]" replaced with your own identifying
     17 # information: Portions Copyright [yyyy] [name of copyright owner]
     18 #
     19 # CDDL HEADER END
     20 #
     21 
     22 #
     23 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 #ident	"@(#)Makefile.sfw	1.34	09/09/01 SMI"	
     27 #
     28 
     29 # This Makefile builds both 32 and 64 bit versions of 2 of the popular 
     30 # MPMs - prefork and worker - of the Apache HTTP server.
     31 # Builds occur in separate directories (4 in total)
     32 # Order is important at the various stages in the build.
     33 #   1. 32-bit worker
     34 #   2. 32-bit prefork
     35 #   3. 64-bit worker
     36 #   4. 64-bit prefork
     37 
     38 include $(SRC)/cmd/apr/apr-1.3/apr.build.env
     39 include $(SRC)/cmd/apr-util/apr-util-1.3/apr-util.build.env
     40 include apache.build.env
     41 
     42 MOD_AUTH_GSS=mod_auth_gss
     43 AUTH_GSS_MODULE=$(MOD_AUTH_GSS)/.libs/$(MOD_AUTH_GSS).so
     44 
     45 MOD_AUTH_GSS64=$(MOD_AUTH_GSS)-64
     46 AUTH_GSS_MODULE64=$(MOD_AUTH_GSS64)/.libs/$(MOD_AUTH_GSS).so
     47 
     48 PERLPATH=/usr/perl5/bin
     49 PERL=$(PERLPATH)/perl
     50 
     51 TMP_HDR_DIR32= Solaris/32/include
     52 TMP_HDR_DIR64= Solaris/64/include
     53 TMP_HDR_DIR=Solaris/include
     54 
     55 HTTPD_COMMON_CONFIGURE_OPTIONS=\
     56     --prefix=${APACHE_USR_PREFIX} \
     57     --enable-layout=${APACHE_LAYOUT} \
     58     --enable-mods-shared=all \
     59     --enable-so \
     60     --enable-suexec \
     61     --with-suexec-caller=webservd \
     62     --enable-proxy \
     63     --enable-proxy-connect \
     64     --enable-proxy-ftp \
     65     --enable-proxy-http \
     66     --enable-proxy-ajp \
     67     --enable-proxy-balancer \
     68     --enable-cache \
     69     --enable-file-cache \
     70     --enable-disk-cache \
     71     --enable-mem-cache \
     72     --enable-deflate \
     73     --enable-cgid \
     74     --enable-cgi \
     75     --enable-authnz-ldap \
     76     --enable-ldap \
     77     --enable-ssl \
     78     --enable-exception-hook
     79 
     80 MAPFILE_NOEXSTK=$(SRC)/cmd/mapfile_noexstk
     81 CFLAGS_COMMON=-DSSL_EXPERIMENTAL -DSSL_ENGINE -xO4
     82 
     83 ENV_COMMON=\
     84 LD_OPTIONS="-M $(MAPFILE_NOEXSTK)" \
     85 MAKE=$(CCSMAKE) \
     86 DESTDIR=$(ROOT) \
     87 INSTALL=/usr/ucb/install \
     88 PATH=$(SFW_PATH) \
     89 PERL=$(PERL) \
     90 CXXFLAGS="-norunpath"
     91 
     92 ENV_32=\
     93 $(ENV_COMMON) \
     94 CC="$(CC) $(CCBITS32)" \
     95 CXX="$(CCC) $(CCBITS32)" \
     96 CFLAGS="$(CFLAGS) $(CFLAGS_COMMON)" \
     97 LDFLAGS="$(LDFLAGS) -L/usr/sfw/lib $(LDLIBS)"
     98 
     99 ENV_64=\
    100 $(ENV_COMMON) \
    101 CC="$(CC64) $(CCBITS64)" \
    102 CXX="$(CCC64) $(CCBITS64)" \
    103 CFLAGS="$(CFLAGS64) $(CFLAGS_COMMON)" \
    104 LDFLAGS="$(LDFLAGS64) -L/usr/sfw/lib/$(MACH64) $(LDLIBS64)"
    105 
    106 INSTALL_ENV_COMMON=\
    107 SPRO_VROOT=$(SPRO_VROOT) \
    108 MAPFILE_NOEXSTK=$(MAPFILE_NOEXSTK) \
    109 GPATCH=$(GPATCH) \
    110 GPATCH_FLAGS=$(GPATCH_FLAGS)
    111 
    112 COMMON_PATCH_FILES=\
    113     ../patches/*.patch
    114 
    115 PATCH_FILES_32=\
    116     ../patches/*.patch.32 \
    117     ../patches/32/*.patch
    118 
    119 PATCH_FILES_64=\
    120     ../patches/*.patch.64 \
    121     ../patches/64/*.patch
    122 
    123 apply_patch_32=\
    124 	for i in $(COMMON_PATCH_FILES) $(PATCH_FILES_32); do \
    125 	  echo "patching...  $$i"; \
    126 	  $(GPATCH) $(GPATCH_FLAGS) -i $$i; \
    127 	done
    128 
    129 apply_patch_64=\
    130 	for i in $(COMMON_PATCH_FILES) $(PATCH_FILES_64); do \
    131 	  echo "patching...  $$i"; \
    132 	  $(GPATCH) $(GPATCH_FLAGS) -i $$i; \
    133 	done
    134 
    135 all: create_solaris_patches all32 all64
    136 
    137 create_solaris_patches:
    138 	(for a in ./patches/template ./Solaris/template; do \
    139 	  (cd $$a; \
    140 	  mkdir -p ../32 ../64; \
    141 	  for i in `ls *`; do \
    142 	    if test -f $$i; then \
    143 	      sed -e 's/::ISAINFO:://g' \
    144 	          -e 's/::BITNESS::/32/g' \
    145 	          -e 's!::APR_PREFIX::!$(APR_USR_PREFIX)!g' \
    146 	          -e 's!::APU_PREFIX::!$(APR_UTIL_USR_PREFIX)!g' \
    147 	      < $$i \
    148 	      > ../32/$$i; \
    149 	      sed -e 's/::ISAINFO::/\/$(MACH64)/g' \
    150 	          -e 's/::BITNESS::/64/g' \
    151 	          -e 's!::APR_PREFIX::!$(APR_USR_PREFIX)!g' \
    152 	          -e 's!::APU_PREFIX::!$(APR_UTIL_USR_PREFIX)!g' \
    153 	      < $$i \
    154 	      > ../64/$$i; \
    155 	    fi; \
    156 	  done;) \
    157 	done)
    158 
    159 all32: $(APACHE_WORKER_DIR)/config.status $(APACHE_PREFORK_DIR)/config.status $(AUTH_GSS_MODULE)
    160 	(cd $(APACHE_WORKER_DIR); env - \
    161 	    $(ENV_32) \
    162 	    $(CCSMAKE) -e)
    163 	(cd $(APACHE_PREFORK_DIR); env - \
    164 	    $(ENV_32) \
    165 	    $(CCSMAKE) -e)
    166 
    167 $(AUTH_GSS_MODULE):
    168 	(cd $(MOD_AUTH_GSS); $(CCSMAKE) all)
    169 
    170 $(APACHE_PREFORK_DIR)/config.status: $(APACHE_PREFORK_DIR)/configure
    171 	(cd $(APACHE_PREFORK_DIR); env - \
    172 	    $(ENV_32) \
    173 	    ./configure $(HTTPD_COMMON_CONFIGURE_OPTIONS) \
    174 		--with-apr=$(SRC)/cmd/apr/apr-1.3/$(APR_DIR32) \
    175 		--with-apr-util=$(SRC)/cmd/apr-util/apr-util-1.3/$(APR_UTIL_DIR32) \
    176 		--with-mpm=prefork) 
    177 
    178 $(APACHE_PREFORK_DIR)/configure: $(APACHE_DIR).tar.gz
    179 	mkdir -p tmp; gzip -dc $(APACHE_DIR).tar.gz | (cd tmp; tar xopf -)
    180 	mv tmp/$(APACHE_DIR) $(APACHE_PREFORK_DIR); rmdir tmp
    181 	(cd $(APACHE_PREFORK_DIR); $(apply_patch_32))
    182 	touch $(APACHE_PREFORK_DIR)/configure
    183 
    184 $(APACHE_WORKER_DIR)/config.status: $(APACHE_WORKER_DIR)/configure
    185 	(cd $(APACHE_WORKER_DIR); env - \
    186 	    $(ENV_32) \
    187 	    ./configure $(HTTPD_COMMON_CONFIGURE_OPTIONS) \
    188 		--with-apr=$(SRC)/cmd/apr/apr-1.3/$(APR_DIR32) \
    189 		--with-apr-util=$(SRC)/cmd/apr-util/apr-util-1.3/$(APR_UTIL_DIR32) \
    190 		--with-mpm=worker) 
    191 
    192 $(APACHE_WORKER_DIR)/configure: $(APACHE_DIR).tar.gz
    193 	mkdir -p tmp; gzip -dc $(APACHE_DIR).tar.gz | (cd tmp; tar xopf -)
    194 	mv tmp/$(APACHE_DIR) $(APACHE_WORKER_DIR); rmdir tmp
    195 	(cd $(APACHE_WORKER_DIR); $(apply_patch_32))
    196 	touch $(APACHE_WORKER_DIR)/configure
    197 
    198 # 64-bit targets
    199 
    200 all64: $(APACHE_WORKER_DIR64)/config.status $(APACHE_PREFORK_DIR64)/config.status $(AUTH_GSS_MODULE64)
    201 	(cd $(APACHE_WORKER_DIR64); env - \
    202 	    $(ENV_64) \
    203 	    $(CCSMAKE) -e)
    204 	(cd $(APACHE_PREFORK_DIR64); env - \
    205 	    $(ENV_64) \
    206 	    $(CCSMAKE) -e)
    207 
    208 $(AUTH_GSS_MODULE64): $(MOD_AUTH_GSS64)/Makefile
    209 	(cd $(MOD_AUTH_GSS64); $(CCSMAKE) all)
    210 
    211 $(MOD_AUTH_GSS64)/Makefile: $(MOD_AUTH_GSS)/Makefile
    212 	(mkdir -p $(MOD_AUTH_GSS64); \
    213 	 cd $(MOD_AUTH_GSS); \
    214 	 cp Makefile *.c *.html README ../$(MOD_AUTH_GSS64))
    215 	(cd $(MOD_AUTH_GSS64); \
    216 	 $(GPATCH) $(GPATCH_FLAGS) -i ../patches/mod_auth_gss_Makefile.module_patch.64)
    217 
    218 $(APACHE_PREFORK_DIR64)/config.status: $(APACHE_PREFORK_DIR64)/configure
    219 	(cd $(APACHE_PREFORK_DIR64); env - \
    220 	    $(ENV_64) \
    221 	    ./configure $(HTTPD_COMMON_CONFIGURE_OPTIONS) \
    222 		--with-apr=$(SRC)/cmd/apr/apr-1.3/$(APR_DIR64) \
    223 		--with-apr-util=$(SRC)/cmd/apr-util/apr-util-1.3/$(APR_UTIL_DIR64) \
    224 		--with-mpm=prefork) 
    225 
    226 $(APACHE_PREFORK_DIR64)/configure: $(APACHE_DIR).tar.gz
    227 	mkdir -p tmp; gzip -dc $(APACHE_DIR).tar.gz | (cd tmp; tar xopf -)
    228 	mv tmp/$(APACHE_DIR) $(APACHE_PREFORK_DIR64); rmdir tmp
    229 	(cd $(APACHE_PREFORK_DIR64); $(apply_patch_64))
    230 	touch $(APACHE_PREFORK_DIR64)/configure
    231 
    232 $(APACHE_WORKER_DIR64)/config.status: $(APACHE_WORKER_DIR64)/configure
    233 	(cd $(APACHE_WORKER_DIR64); env - \
    234 	    $(ENV_64) \
    235 	    ./configure $(HTTPD_COMMON_CONFIGURE_OPTIONS) \
    236 		--with-apr=$(SRC)/cmd/apr/apr-1.3/$(APR_DIR64) \
    237 		--with-apr-util=$(SRC)/cmd/apr-util/apr-util-1.3/$(APR_UTIL_DIR64) \
    238 		--with-mpm=worker) 
    239 
    240 $(APACHE_WORKER_DIR64)/configure: $(APACHE_DIR).tar.gz
    241 	mkdir -p tmp; gzip -dc $(APACHE_DIR).tar.gz | (cd tmp; tar xopf -)
    242 	mv tmp/$(APACHE_DIR) $(APACHE_WORKER_DIR64); rmdir tmp
    243 	(cd $(APACHE_WORKER_DIR64); $(apply_patch_64))
    244 	touch $(APACHE_WORKER_DIR64)/configure
    245 
    246 
    247 install: real-install install-headers install-modules
    248 
    249 real-install: all
    250 	chmod -R u+w $(ROOT)$(APACHE_USR_PREFIX)
    251 	chmod -R u+w $(ROOT)$(APACHE_VAR_PREFIX)
    252 	chmod -R u+w $(ROOT)$(APACHE_ETC_PREFIX)
    253 	(cd $(APACHE_WORKER_DIR); env - \
    254 	    $(ENV_32) \
    255 	    $(CCSMAKE) -e install)
    256 	mkdir -p $(TMP_HDR_DIR32)
    257 	cp $(ROOT)$(APACHE_USR_PREFIX)/include/ap_config_layout.h $(TMP_HDR_DIR32)
    258 	(cd $(APACHE_WORKER_DIR64); env - \
    259 	    $(ENV_64) \
    260 	    $(CCSMAKE) -e install)
    261 	mkdir -p $(TMP_HDR_DIR64)
    262 	cp $(ROOT)$(APACHE_USR_PREFIX)/include/ap_config_layout.h $(TMP_HDR_DIR64)
    263 	(cd $(APACHE_PREFORK_DIR); env - \
    264 	    $(ENV_32) \
    265 	    $(CCSMAKE) -e install)
    266 	cp $(ROOT)$(APACHE_ETC_PREFIX)/original/httpd.conf Solaris/32
    267 	(cd $(APACHE_PREFORK_DIR64); env - \
    268 	    $(ENV_64) \
    269 	    $(CCSMAKE) -e install)
    270 	cp $(ROOT)$(APACHE_ETC_PREFIX)/original/httpd.conf Solaris/64
    271 	(env $(INSTALL_ENV_COMMON) \
    272 	     MACH64=$(MACH64) \
    273 	     $(SHELL) ./install-apache2-64)
    274 	(env $(INSTALL_ENV_COMMON) \
    275 	     $(SHELL) ./install-apache2)
    276 
    277 # Rules to merge those 32/64 bit header files that differ
    278 
    279 
    280 HDRS=ap_config_layout.h
    281 
    282 MERGED_HDRS = $(HDRS:%=$(TMP_HDR_DIR)/%)
    283 
    284 $(MERGED_HDRS) := FILEMODE= 0644
    285 
    286 install-headers: pre-merge merge-headers
    287 
    288 pre-merge:
    289 	mkdir -p $(TMP_HDR_DIR)
    290 
    291 merge-headers: $(MERGED_HDRS)
    292 
    293 # We use a custom install sequence here to unify 32bit and 64bit includes
    294 # since we can only ship one set of includes. Therefore we use
    295 # "/usr/bin/diff -D <64bit>" (and for some exceptions a manual path) to
    296 # generate an unified version of the include files (and add a boilerplate text
    297 # which explains the interface stability status).
    298 # Define the symbol used to distinguish between 32bit and 64bit parts of the
    299 # include file. We cannot use |_LP64| here because not every compiler (like
    300 # Studio 10/11/12) sets it by default (this doesn't harm because the AST
    301 # includes are OS- and platform-specific anyway) and we can't rely on the
    302 # system includes like <sys/isa_defs.h> because "/usr/bin/diff -D<symbol>"
    303 # adds the "#ifdef <symbol>" before any other content and "injecting" an
    304 # "#include <sys/isa_defs.h>" will alter the behaviour of the AST code
    305 # in unpredictable ways (e.g. the resulting code will not longer work).
    306 # Sun-Bug #6524070 ("RFE: Please set |_LP64| for 64bit platforms by default
    307 # (like gcc does)") has been filed against the Sun Studio compiler as RFE
    308 # to set |_LP64| for 64bit targets.
    309 # (INTEL_BLD is '#' for a Sparc build and SPARC_BLD is '#' for an Intel build)
    310 SPARC_64BITCPPSYMBOL = __sparcv9
    311 INTEL_64BITCPPSYMBOL = __amd64
    312 
    313 # ToDo: Rewrite this in ksh93 to simplify the boilerplate generation
    314 $(TMP_HDR_DIR)/%: $(TMP_HDR_DIR32)/% $(TMP_HDR_DIR64)/%
    315 	( \
    316 	if [ -z "$(SPARC_BLD)" ]; then \
    317 		set +e; /usr/bin/diff -D $(SPARC_64BITCPPSYMBOL) $(TMP_HDR_DIR32)/$(@F) $(TMP_HDR_DIR64)/$(@F); true; \
    318 	else \
    319 		set +e; /usr/bin/diff -D $(INTEL_64BITCPPSYMBOL) $(TMP_HDR_DIR32)/$(@F) $(TMP_HDR_DIR64)/$(@F); true; \
    320 	fi; \
    321 	) > $(TMP_HDR_DIR)/$*
    322 	cp $(TMP_HDR_DIR)/$* $(ROOT)$(APACHE_USR_PREFIX)/include
    323 
    324 test:	# there aren't any
    325 
    326 include ../Makefile.cmd
    327 
    328 clean: clean-modules
    329 	(cd $(MOD_AUTH_GSS); rm -f .deps *.o *.so *.lo *.slo *.la; rm -rf .libs)
    330 	-rm -rf $(APACHE_PREFORK_DIR) $(APACHE_WORKER_DIR) $(APACHE_PREFORK_DIR64) \
    331 	        $(APACHE_WORKER_DIR64) $(MOD_AUTH_GSS64) Solaris/32 Solaris/64 \
    332 	        Solaris/include patches/32 patches/64
    333 
    334 install-modules:
    335 	(cd modules && $(MAKE) -f Makefile.sfw install)
    336 
    337 all-modules:
    338 	(cd modules && $(MAKE) -f Makefile.sfw all)
    339 
    340 clean-modules:
    341 	(cd modules && $(MAKE) -f Makefile.sfw clean)
    342 
    343 
    344 include ../Makefile.targ
    345