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