1Project    = httpd
2
3include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make
4
5Version    = 2.4.9
6Sources    = $(SRCROOT)/$(Project)
7
8Patch_List = patch-config.layout \
9             patch-configure \
10             PR-3921505.diff \
11             PR-5432464.diff_httpd.conf \
12             PR-16019492.diff \
13             PR-5957348.diff \
14             patch-docs__conf__httpd.conf.in \
15             PR-10154185.diff \
16             apachectl.diff \
17             patch-docs__conf__extra__httpd-mpm.conf.in \
18             patch-docs__conf__mime.types \
19             patch-docs__conf__extra__httpd-userdir.conf.in \
20             PR-15976165-ulimit.diff \
21             PR-17754441-sbin.diff \
22             PR-16019357-apxs.diff \
23             mod_proxy_balancer-partialfix.diff
24
25Configure_Flags = --prefix=/usr \
26                  --enable-layout=Darwin \
27                  --with-apr=/usr \
28                  --with-apr-util=/usr \
29                  --with-pcre=$(SRCROOT)/$(Project)/../\
30                  --enable-mods-shared=all \
31                  --enable-ssl \
32                  --enable-cache \
33                  --enable-mem-cache \
34                  --enable-proxy-balancer \
35                  --enable-proxy \
36                  --enable-proxy-http \
37                  --enable-disk-cache \
38                  --with-mpm=prefork \
39                  --enable-imagemap \
40                  --enable-negotiation \
41                  --enable-slotmem-shm
42
43Post_Install_Targets = module-setup module-disable module-enable recopy-httpd-conf \
44                       post-install strip-modules
45
46# Extract the source.
47install_source::
48	$(TAR) -C $(SRCROOT) -jxf $(SRCROOT)/$(Project)-$(Version).tar.bz2
49	$(RMDIR) $(Sources)
50	$(MV) $(SRCROOT)/$(Project)-$(Version) $(Sources)
51	for patch in $(Patch_List); do \
52		(cd $(Sources) && patch -p0 -i $(SRCROOT)/patches/$${patch}) || exit 1; \
53	done
54
55build::
56	$(MKDIR) $(OBJROOT)
57	cd $(BuildDirectory) && $(Sources)/configure $(Configure_Flags)
58	cd $(BuildDirectory) && make EXTRA_CFLAGS="$(RC_CFLAGS) -D_FORTIFY_SOURCE=2"
59
60install::
61	cd $(BuildDirectory) && make install DESTDIR=$(DSTROOT)
62	$(_v) $(MAKE) $(Post_Install_Targets)
63
64APXS = perl $(OBJROOT)/support/apxs
65SYSCONFDIR = /private/etc/apache2
66SYSCONFDIR_OTHER = $(SYSCONFDIR)/other
67
68## XXX: external modules should install their own config files
69module-setup:
70	$(MKDIR) $(DSTROOT)$(SYSCONFDIR_OTHER)
71	$(INSTALL_FILE) $(SRCROOT)/conf/*.conf $(DSTROOT)$(SYSCONFDIR_OTHER)
72	$(RM) $(DSTROOT)$(SYSCONFDIR)/httpd.conf.bak
73
74# 4831254
75module-disable:
76	sed -i '' -e '/unique_id_module/s/^/#/' $(DSTROOT)$(SYSCONFDIR)/httpd.conf
77	sed -i '' -e '/lbmethod_heartbeat_module/s/^/#/' $(DSTROOT)$(SYSCONFDIR)/httpd.conf
78
79# enable negotiation_module for Multiviews on files: .en, .de, .fr, etc
80module-enable:
81	sed -i '' -e '/negotiation_module/s/^#//' $(DSTROOT)$(SYSCONFDIR)/httpd.conf
82
83# 6927748: This needs to run after we're done processing httpd.conf (and anything in extra)
84recopy-httpd-conf:
85	cp $(DSTROOT)$(SYSCONFDIR)/httpd.conf $(DSTROOT)$(SYSCONFDIR)/original/httpd.conf
86
87post-install:
88	$(MKDIR) $(DSTROOT)$(SYSCONFDIR)/users
89	$(RMDIR) $(DSTROOT)/private/var/run
90	$(RMDIR) $(DSTROOT)/usr/bin
91	$(RM) $(DSTROOT)/Library/WebServer/CGI-Executables/printenv
92	$(RM) $(DSTROOT)/Library/WebServer/CGI-Executables/test-cgi
93	$(INSTALL_FILE) $(SRCROOT)/checkgid.8 $(DSTROOT)/usr/share/man/man8
94	$(INSTALL_FILE) $(SRCROOT)/httxt2dbm.8 $(DSTROOT)/usr/share/man/man8
95	$(CHOWN) -R $(Install_User):$(Install_Group) \
96		$(DSTROOT)/usr/share/httpd \
97		$(DSTROOT)/usr/share/man
98	$(MV) $(DSTROOT)/Library/WebServer/Documents/index.html $(DSTROOT)/Library/WebServer/Documents/index.html.en
99	$(INSTALL_FILE) $(SRCROOT)/PoweredByMacOSX*.gif $(DSTROOT)/Library/WebServer/Documents
100	$(MKDIR) $(DSTROOT)/System/Library/LaunchDaemons
101	$(INSTALL_SCRIPT) $(SRCROOT)/webpromotion.rb $(DSTROOT)/usr/sbin/webpromotion
102	$(INSTALL_FILE) $(SRCROOT)/org.apache.httpd.plist $(DSTROOT)/System/Library/LaunchDaemons
103	$(MKDIR) $(DSTROOT)/usr/local/OpenSourceVersions $(DSTROOT)/usr/local/OpenSourceLicenses
104	$(INSTALL_FILE) $(SRCROOT)/apache.plist $(DSTROOT)/usr/local/OpenSourceVersions/apache.plist
105	$(INSTALL_FILE) $(Sources)/LICENSE $(DSTROOT)/usr/local/OpenSourceLicenses/apache.txt
106
107strip-modules:
108	$(CP) $(DSTROOT)/usr/libexec/apache2/*.so $(SYMROOT)
109	$(STRIP) -S $(DSTROOT)/usr/libexec/apache2/*.so
110