#
# 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.35 09/12/14 SMI"
#
# This Makefile builds both 32 and 64 bit versions of 2 of the popular
# MPMs - prefork and worker - of the Apache HTTP server.
# Builds occur in separate directories (4 in total)
# Order is important at the various stages in the build.
# 1. 32-bit worker
# 2. 32-bit prefork
# 3. 64-bit worker
# 4. 64-bit prefork
include $(SRC)/cmd/apr/apr-1.3/apr.build.env
include $(SRC)/cmd/apr-util/apr-util-1.3/apr-util.build.env
include apache.build.env
MOD_AUTH_GSS=mod_auth_gss
AUTH_GSS_MODULE=$(MOD_AUTH_GSS)/.libs/$(MOD_AUTH_GSS).so
MOD_AUTH_GSS64=$(MOD_AUTH_GSS)-64
AUTH_GSS_MODULE64=$(MOD_AUTH_GSS64)/.libs/$(MOD_AUTH_GSS).so
PERLPATH=/usr/perl5/bin
PERL=$(PERLPATH)/perl
TMP_HDR_DIR32= Solaris/32/include
TMP_HDR_DIR64= Solaris/64/include
TMP_HDR_DIR=Solaris/include
HTTPD_COMMON_CONFIGURE_OPTIONS=\
--prefix=${APACHE_USR_PREFIX} \
--enable-layout=${APACHE_LAYOUT} \
--enable-mods-shared=all \
--enable-so \
--enable-suexec \
--with-suexec-caller=webservd \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-ftp \
--enable-proxy-http \
--enable-proxy-ajp \
--enable-proxy-balancer \
--enable-cache \
--enable-file-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-deflate \
--enable-cgid \
--enable-cgi \
--enable-authnz-ldap \
--enable-ldap \
--enable-ssl \
--enable-exception-hook
MAPFILE_NOEXSTK=$(SRC)/cmd/mapfile_noexstk
CFLAGS_COMMON=-DSSL_EXPERIMENTAL -DSSL_ENGINE -xO4
ENV_COMMON=\
LD_OPTIONS="-M $(MAPFILE_NOEXSTK)" \
MAKE=$(CCSMAKE) \
DESTDIR=$(ROOT) \
INSTALL=/usr/ucb/install \
PATH=$(SFW_PATH) \
PERL=$(PERL) \
CXXFLAGS="-norunpath"
ENV_32=\
$(ENV_COMMON) \
CC="$(CC) $(CCBITS32)" \
CXX="$(CCC) $(CCBITS32)" \
CFLAGS="$(CFLAGS) $(CFLAGS_COMMON)" \
LDFLAGS="$(LDFLAGS) -L/usr/sfw/lib $(LDLIBS)"
ENV_64=\
$(ENV_COMMON) \
CC="$(CC64) $(CCBITS64)" \
CXX="$(CCC64) $(CCBITS64)" \
CFLAGS="$(CFLAGS64) $(CFLAGS_COMMON)" \
LDFLAGS="$(LDFLAGS64) -L/usr/sfw/lib/$(MACH64) $(LDLIBS64)"
INSTALL_ENV_COMMON=\
SPRO_VROOT=$(SPRO_VROOT) \
MAPFILE_NOEXSTK=$(MAPFILE_NOEXSTK) \
GPATCH=$(GPATCH) \
GPATCH_FLAGS=$(GPATCH_FLAGS)
COMMON_PATCH_FILES=\
../patches/*.patch
PATCH_FILES_32=\
../patches/*.patch.32 \
../patches/32/*.patch
PATCH_FILES_64=\
../patches/*.patch.64 \
../patches/64/*.patch
apply_patch_32=\
for i in $(COMMON_PATCH_FILES) $(PATCH_FILES_32); do \
echo "patching... $$i"; \
$(GPATCH) $(GPATCH_FLAGS) -i $$i; \
done
apply_patch_64=\
for i in $(COMMON_PATCH_FILES) $(PATCH_FILES_64); do \
echo "patching... $$i"; \
$(GPATCH) $(GPATCH_FLAGS) -i $$i; \
done
all: create_solaris_patches all32 all64
create_solaris_patches:
(for a in ./patches/template ./Solaris/template; do \
(cd $$a; \
mkdir -p ../32 ../64; \
for i in `ls *`; do \
if test -f $$i; then \
sed -e 's/::ISAINFO:://g' \
-e 's/::BITNESS::/32/g' \
-e 's!::APR_PREFIX::!$(APR_USR_PREFIX)!g' \
-e 's!::APU_PREFIX::!$(APR_UTIL_USR_PREFIX)!g' \
< $$i \
> ../32/$$i; \
sed -e 's/::ISAINFO::/\/$(MACH64)/g' \
-e 's/::BITNESS::/64/g' \
-e 's!::APR_PREFIX::!$(APR_USR_PREFIX)!g' \
-e 's!::APU_PREFIX::!$(APR_UTIL_USR_PREFIX)!g' \
< $$i \
> ../64/$$i; \
fi; \
done;) \
done)
all32: $(APACHE_WORKER_DIR)/config.status $(APACHE_PREFORK_DIR)/config.status $(AUTH_GSS_MODULE)
(cd $(APACHE_WORKER_DIR); env - \
$(ENV_32) \
$(CCSMAKE) -e)
(cd $(APACHE_PREFORK_DIR); env - \
$(ENV_32) \
$(CCSMAKE) -e)
$(AUTH_GSS_MODULE):
(cd $(MOD_AUTH_GSS); $(CCSMAKE) all)
$(APACHE_PREFORK_DIR)/config.status: $(APACHE_PREFORK_DIR)/configure
(cd $(APACHE_PREFORK_DIR); env - \
$(ENV_32) \
./configure $(HTTPD_COMMON_CONFIGURE_OPTIONS) \
--with-apr=$(SRC)/cmd/apr/apr-1.3/$(APR_DIR32) \
--with-apr-util=$(SRC)/cmd/apr-util/apr-util-1.3/$(APR_UTIL_DIR32) \
--with-mpm=prefork)
$(APACHE_PREFORK_DIR)/configure: $(APACHE_DIR).tar.gz
mkdir -p tmp; gzip -dc $(APACHE_DIR).tar.gz | (cd tmp; tar xopf -)
mv tmp/$(APACHE_DIR) $(APACHE_PREFORK_DIR); rmdir tmp
(cd $(APACHE_PREFORK_DIR); $(apply_patch_32))
touch $(APACHE_PREFORK_DIR)/configure
$(APACHE_WORKER_DIR)/config.status: $(APACHE_WORKER_DIR)/configure
(cd $(APACHE_WORKER_DIR); env - \
$(ENV_32) \
./configure $(HTTPD_COMMON_CONFIGURE_OPTIONS) \
--with-apr=$(SRC)/cmd/apr/apr-1.3/$(APR_DIR32) \
--with-apr-util=$(SRC)/cmd/apr-util/apr-util-1.3/$(APR_UTIL_DIR32) \
--with-mpm=worker)
$(APACHE_WORKER_DIR)/configure: $(APACHE_DIR).tar.gz
mkdir -p tmp; gzip -dc $(APACHE_DIR).tar.gz | (cd tmp; tar xopf -)
mv tmp/$(APACHE_DIR) $(APACHE_WORKER_DIR); rmdir tmp
(cd $(APACHE_WORKER_DIR); $(apply_patch_32))
touch $(APACHE_WORKER_DIR)/configure
# 64-bit targets
all64: $(APACHE_WORKER_DIR64)/config.status $(APACHE_PREFORK_DIR64)/config.status $(AUTH_GSS_MODULE64)
(cd $(APACHE_WORKER_DIR64); env - \
$(ENV_64) \
$(CCSMAKE) -e)
(cd $(APACHE_PREFORK_DIR64); env - \
$(ENV_64) \
$(CCSMAKE) -e)
$(AUTH_GSS_MODULE64): $(MOD_AUTH_GSS64)/Makefile
(cd $(MOD_AUTH_GSS64); $(CCSMAKE) all)
$(MOD_AUTH_GSS64)/Makefile: $(MOD_AUTH_GSS)/Makefile
(mkdir -p $(MOD_AUTH_GSS64); \
cd $(MOD_AUTH_GSS); \
cp Makefile *.c *.html README ../$(MOD_AUTH_GSS64))
(cd $(MOD_AUTH_GSS64); \
$(GPATCH) $(GPATCH_FLAGS) -i ../patches/mod_auth_gss_Makefile.module_patch.64)
$(APACHE_PREFORK_DIR64)/config.status: $(APACHE_PREFORK_DIR64)/configure
(cd $(APACHE_PREFORK_DIR64); env - \
$(ENV_64) \
./configure $(HTTPD_COMMON_CONFIGURE_OPTIONS) \
--with-apr=$(SRC)/cmd/apr/apr-1.3/$(APR_DIR64) \
--with-apr-util=$(SRC)/cmd/apr-util/apr-util-1.3/$(APR_UTIL_DIR64) \
--with-mpm=prefork)
$(APACHE_PREFORK_DIR64)/configure: $(APACHE_DIR).tar.gz
mkdir -p tmp; gzip -dc $(APACHE_DIR).tar.gz | (cd tmp; tar xopf -)
mv tmp/$(APACHE_DIR) $(APACHE_PREFORK_DIR64); rmdir tmp
(cd $(APACHE_PREFORK_DIR64); $(apply_patch_64))
touch $(APACHE_PREFORK_DIR64)/configure
$(APACHE_WORKER_DIR64)/config.status: $(APACHE_WORKER_DIR64)/configure
(cd $(APACHE_WORKER_DIR64); env - \
$(ENV_64) \
./configure $(HTTPD_COMMON_CONFIGURE_OPTIONS) \
--with-apr=$(SRC)/cmd/apr/apr-1.3/$(APR_DIR64) \
--with-apr-util=$(SRC)/cmd/apr-util/apr-util-1.3/$(APR_UTIL_DIR64) \
--with-mpm=worker)
$(APACHE_WORKER_DIR64)/configure: $(APACHE_DIR).tar.gz
mkdir -p tmp; gzip -dc $(APACHE_DIR).tar.gz | (cd tmp; tar xopf -)
mv tmp/$(APACHE_DIR) $(APACHE_WORKER_DIR64); rmdir tmp
(cd $(APACHE_WORKER_DIR64); $(apply_patch_64))
touch $(APACHE_WORKER_DIR64)/configure
install: real-install install-headers install-modules
real-install: all
chmod -R u+w $(ROOT)$(APACHE_USR_PREFIX)
chmod -R u+w $(ROOT)$(APACHE_VAR_PREFIX)
chmod -R u+w $(ROOT)$(APACHE_ETC_PREFIX)
(cd $(APACHE_WORKER_DIR); env - \
$(ENV_32) \
$(CCSMAKE) -e install)
mkdir -p $(TMP_HDR_DIR32)
cp $(ROOT)$(APACHE_USR_PREFIX)/include/ap_config_layout.h $(TMP_HDR_DIR32)
(cd $(APACHE_WORKER_DIR64); env - \
$(ENV_64) \
$(CCSMAKE) -e install)
mkdir -p $(TMP_HDR_DIR64)
cp $(ROOT)$(APACHE_USR_PREFIX)/include/ap_config_layout.h $(TMP_HDR_DIR64)
(cd $(APACHE_PREFORK_DIR); env - \
$(ENV_32) \
$(CCSMAKE) -e install)
cp $(ROOT)$(APACHE_ETC_PREFIX)/original/httpd.conf Solaris/32
(cd $(APACHE_PREFORK_DIR64); env - \
$(ENV_64) \
$(CCSMAKE) -e install)
cp $(ROOT)$(APACHE_ETC_PREFIX)/original/httpd.conf Solaris/64
(env $(INSTALL_ENV_COMMON) \
MACH64=$(MACH64) \
$(SHELL) ./install-apache2-64)
(env $(INSTALL_ENV_COMMON) \
$(SHELL) ./install-apache2)
# Rules to merge those 32/64 bit header files that differ
HDRS=ap_config_layout.h
MERGED_HDRS = $(HDRS:%=$(TMP_HDR_DIR)/%)
$(MERGED_HDRS) := FILEMODE= 0644
install-headers: pre-merge merge-headers
pre-merge:
mkdir -p $(TMP_HDR_DIR)
merge-headers: $(MERGED_HDRS)
# We use a custom install sequence here to unify 32bit and 64bit includes
# since we can only ship one set of includes. Therefore we use
# "/usr/bin/diff -D <64bit>" (and for some exceptions a manual path) to
# generate an unified version of the include files (and add a boilerplate text
# which explains the interface stability status).
# Define the symbol used to distinguish between 32bit and 64bit parts of the
# include file. We cannot use |_LP64| here because not every compiler (like
# Studio 10/11/12) sets it by default (this doesn't harm because the AST
# includes are OS- and platform-specific anyway) and we can't rely on the
# system includes like <sys/isa_defs.h> because "/usr/bin/diff -D<symbol>"
# adds the "#ifdef <symbol>" before any other content and "injecting" an
# "#include <sys/isa_defs.h>" will alter the behaviour of the AST code
# in unpredictable ways (e.g. the resulting code will not longer work).
# Sun-Bug #6524070 ("RFE: Please set |_LP64| for 64bit platforms by default
# (like gcc does)") has been filed against the Sun Studio compiler as RFE
# to set |_LP64| for 64bit targets.
# (INTEL_BLD is '#' for a Sparc build and SPARC_BLD is '#' for an Intel build)
SPARC_64BITCPPSYMBOL = __sparcv9
INTEL_64BITCPPSYMBOL = __amd64
# ToDo: Rewrite this in ksh93 to simplify the boilerplate generation
$(TMP_HDR_DIR)/%: $(TMP_HDR_DIR32)/% $(TMP_HDR_DIR64)/%
( \
if [ -z "$(SPARC_BLD)" ]; then \
set +e; /usr/bin/diff -D $(SPARC_64BITCPPSYMBOL) $(TMP_HDR_DIR32)/$(@F) $(TMP_HDR_DIR64)/$(@F); true; \
else \
set +e; /usr/bin/diff -D $(INTEL_64BITCPPSYMBOL) $(TMP_HDR_DIR32)/$(@F) $(TMP_HDR_DIR64)/$(@F); true; \
fi; \
) > $(TMP_HDR_DIR)/$*
cp $(TMP_HDR_DIR)/$* $(ROOT)$(APACHE_USR_PREFIX)/include
test: # there aren't any
include ../Makefile.cmd
clean: clean-modules
(cd $(MOD_AUTH_GSS); rm -f .deps *.o *.so *.lo *.slo *.la; rm -rf .libs)
-rm -rf $(APACHE_PREFORK_DIR) $(APACHE_WORKER_DIR) $(APACHE_PREFORK_DIR64) \
$(APACHE_WORKER_DIR64) $(MOD_AUTH_GSS64) Solaris/32 Solaris/64 \
Solaris/include patches/32 patches/64
install-modules:
(cd modules && $(MAKE) -f Makefile.sfw install)
all-modules:
(cd modules && $(MAKE) -f Makefile.sfw all)
clean-modules:
(cd modules && $(MAKE) -f Makefile.sfw clean)
# augment the target to check check METADATA files in the modules directory too.
meta-check::
@(cd modules && $(MAKE) -f Makefile.sfw meta-checks)
include ../Makefile.targ