Apache Frontend/Backend buildscript
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. ## ############################################################################
  2. ## common targets:
  3. ## make apache-fe (worker, mod_proxy, mod_rewrite)
  4. ## make apache-be (prefork, mod_rpaf, php4)
  5. ##
  6. ## build-requirements:
  7. ## build-essential, bzip2
  8. ## libz-dev, libxml2-dev, libpng-dev, libjpeg-dev, libmysqlclient-dev, libfreetype6-dev
  9. DESTDIR=/opt
  10. MAKE_FLAGS=-j2
  11. ## ############################################################################
  12. WGET := /usr/bin/wget --passive-ftp -nd
  13. _SRCBASE=$(shell /bin/pwd)
  14. _DOWNLOADS=$(_SRCBASE)/download
  15. _SOURCES=$(_SRCBASE)/source
  16. ## ############################################################################
  17. VERSION_APACHE=2.2.14
  18. PACKAGE_APACHE=httpd-$(VERSION_APACHE).tar.bz2
  19. DOWNLOAD_APACHE=http://apache.speedbone.de/httpd/$(PACKAGE_APACHE)
  20. SOURCE_APACHE=$(_SOURCES)/httpd-$(VERSION_APACHE)
  21. VERSION_RPAF=0.5
  22. PACKAGE_RPAF=mod_rpaf-$(VERSION_RPAF).tar.gz
  23. DOWNLOAD_RPAF=http://stderr.net/apache/rpaf/download/$(PACKAGE_RPAF)
  24. SOURCE_RPAF=$(_SOURCES)/mod_rpaf-$(VERSION_RPAF)
  25. VERSION_PHP=5.2.12
  26. PACKAGE_PHP=php-$(VERSION_PHP).tar.bz2
  27. DOWNLOAD_PHP=http://de3.php.net/get/$(PACKAGE_PHP)/from/this/mirror
  28. SOURCE_PHP=$(_SOURCES)/php-$(VERSION_PHP)
  29. VERSION_EACCELERATOR=0.9.5.3
  30. PACKAGE_EACCELERATOR=eaccelerator-$(VERSION_EACCELERATOR).tar.bz2
  31. DOWNLOAD_EACCELERATOR=http://bart.eaccelerator.net/source/$(VERSION_EACCELERATOR)/$(PACKAGE_EACCELERATOR)
  32. SOURCE_EACCELERATOR=$(_SOURCES)/eaccelerator-$(VERSION_EACCELERATOR)
  33. ## ############################################################################
  34. all: apache-fe apache-dav apache-be
  35. fetch: $(_DOWNLOADS)/$(PACKAGE_APACHE) \
  36. $(_DOWNLOADS)/$(PACKAGE_RPAF) \
  37. $(_DOWNLOADS)/$(PACKAGE_PHP) \
  38. $(_DOWNLOADS)/$(PACKAGE_EACCELERATOR)
  39. $(_DOWNLOADS)/$(PACKAGE_APACHE):
  40. $(WGET) -P $(_DOWNLOADS) $(DOWNLOAD_APACHE)
  41. $(SOURCE_APACHE)/.unpacked: $(_DOWNLOADS)/$(PACKAGE_APACHE)
  42. mkdir -p $(SOURCE_APACHE)
  43. tar -C $(_SOURCES) -xjf $(_DOWNLOADS)/$(PACKAGE_APACHE)
  44. cat apache-layouts >> $(SOURCE_APACHE)/config.layout
  45. touch $@
  46. $(_DOWNLOADS)/$(PACKAGE_RPAF):
  47. $(WGET) -P $(_DOWNLOADS) $(DOWNLOAD_RPAF)
  48. $(SOURCE_RPAF)/.unpacked: $(_DOWNLOADS)/$(PACKAGE_RPAF)
  49. mkdir -p $(SOURCE_RPAF)
  50. tar -C $(_SOURCES) -xzf $(_DOWNLOADS)/$(PACKAGE_RPAF)
  51. touch $@
  52. $(_DOWNLOADS)/$(PACKAGE_PHP):
  53. $(WGET) -P $(_DOWNLOADS) $(DOWNLOAD_PHP)
  54. $(SOURCE_PHP)/.unpacked: $(_DOWNLOADS)/$(PACKAGE_PHP)
  55. mkdir -p $(SOURCE_PHP)
  56. tar -C $(_SOURCES) -xjf $(_DOWNLOADS)/$(PACKAGE_PHP)
  57. touch $@
  58. $(_DOWNLOADS)/$(PACKAGE_EACCELERATOR):
  59. $(WGET) -P $(_DOWNLOADS) $(DOWNLOAD_EACCELERATOR)
  60. $(SOURCE_EACCELERATOR)/.unpacked: $(_DOWNLOADS)/$(PACKAGE_EACCELERATOR)
  61. mkdir -p $(SOURCE_EACCELERATOR)
  62. tar -C $(_SOURCES) -xjf $(_DOWNLOADS)/$(PACKAGE_EACCELERATOR)
  63. touch $@
  64. ## ############################################################################
  65. _APACHE_DAV_BUILD=$(_SOURCES)/apache22-webdav
  66. _APACHE_DAV_DEST=$(DESTDIR)/apache22-webdav
  67. _APACHE_DAV_CONF=/etc/apache22-dav
  68. apache-dav: $(_APACHE_DAV_BUILD)/.installed
  69. $(_APACHE_DAV_BUILD)/.configured: $(SOURCE_APACHE)/.unpacked
  70. mkdir -p $(_APACHE_DAV_BUILD)
  71. ( cd $(_APACHE_DAV_BUILD); \
  72. $(SOURCE_APACHE)/configure \
  73. --enable-layout=Webdav \
  74. --with-mpm=worker \
  75. --enable-dav \
  76. --enable-dav-fs \
  77. );
  78. touch $@
  79. $(_APACHE_DAV_BUILD)/.compiled: $(_APACHE_DAV_BUILD)/.configured
  80. make $(MAKE_FLAGS) -C $(_APACHE_DAV_BUILD) all
  81. touch $@
  82. $(_APACHE_DAV_BUILD)/.installed: $(_APACHE_DAV_BUILD)/.compiled
  83. make -C $(_APACHE_DAV_BUILD) install
  84. rm -rf $(_APACHE_DAV_CONF)/original
  85. touch $@
  86. apache-dav-clean:
  87. rm -rf $(_APACHE_DAV_BUILD)
  88. ## ############################################################################
  89. _APACHE_FE_BUILD=$(_SOURCES)/apache22-frontend
  90. _APACHE_FE_DEST=$(DESTDIR)/apache22-frontend
  91. _APACHE_FE_CONF=/etc/apache22-fe
  92. apache-fe: $(_APACHE_FE_BUILD)/.installed
  93. $(_APACHE_FE_BUILD)/.configured: $(SOURCE_APACHE)/.unpacked
  94. mkdir -p $(_APACHE_FE_BUILD)
  95. ( cd $(_APACHE_FE_BUILD); \
  96. $(SOURCE_APACHE)/configure \
  97. --enable-layout=Frontend \
  98. --with-mpm=worker \
  99. --enable-proxy \
  100. --enable-proxy-http \
  101. --enable-proxy-balancer \
  102. --enable-rewrite \
  103. );
  104. touch $@
  105. $(_APACHE_FE_BUILD)/.compiled: $(_APACHE_FE_BUILD)/.configured
  106. make $(MAKE_FLAGS) -C $(_APACHE_FE_BUILD) all
  107. touch $@
  108. $(_APACHE_FE_BUILD)/.installed: $(_APACHE_FE_BUILD)/.compiled
  109. make -C $(_APACHE_FE_BUILD) install
  110. rm -rf $(_APACHE_FE_CONF)/original
  111. touch $@
  112. apache-fe-clean:
  113. rm -rf $(_APACHE_FE_BUILD)
  114. ## ############################################################################
  115. _APACHE_BE_BUILD=$(_SOURCES)/apache22-backend
  116. _APACHE_BE_DEST=$(DESTDIR)/apache22-backend
  117. _APACHE_BE_CONF=/etc/apache22-be
  118. _APACHE_BE_LOG=/var/log/apache22-be
  119. _PHP_BE_BUILD=$(_SOURCES)/apache22-backend-php
  120. _PHP_BE_DEST=$(DESTDIR)/apache22-backend-php
  121. _PHP_BE_CONF=/etc/apache22-be
  122. apache-be: $(_APACHE_BE_BUILD)/.installed \
  123. $(SOURCE_RPAF)/.installed \
  124. $(_PHP_BE_BUILD)/.installed \
  125. $(SOURCE_EACCELERATOR)/.installed
  126. $(_APACHE_BE_BUILD)/.configured: $(SOURCE_APACHE)/.unpacked
  127. mkdir -p $(_APACHE_BE_BUILD)
  128. ( cd $(_APACHE_BE_BUILD); \
  129. $(SOURCE_APACHE)/configure \
  130. --enable-layout=Backend \
  131. --with-mpm=prefork \
  132. --enable-so \
  133. );
  134. touch $@
  135. $(_APACHE_BE_BUILD)/.compiled: $(_APACHE_BE_BUILD)/.configured
  136. make $(MAKE_FLAGS) -C $(_APACHE_BE_BUILD) all
  137. touch $@
  138. $(_APACHE_BE_BUILD)/.installed: $(_APACHE_BE_BUILD)/.compiled
  139. make -C $(_APACHE_BE_BUILD) install
  140. rm -rf $(_APACHE_BE_CONF)/original
  141. touch $@
  142. $(SOURCE_RPAF)/.compiled: $(SOURCE_RPAF)/.unpacked $(_APACHE_BE_BUILD)/.installed
  143. make -C $(SOURCE_RPAF) APXS=$(_APACHE_BE_DEST)/bin/apxs rpaf-2.0
  144. touch $@
  145. $(SOURCE_RPAF)/.installed: $(SOURCE_RPAF)/.compiled
  146. make -C $(SOURCE_RPAF) APXS=$(_APACHE_BE_DEST)/bin/apxs install-2.0
  147. touch $@
  148. $(_PHP_BE_BUILD)/.configured: $(SOURCE_PHP)/.unpacked $(_APACHE_BE_BUILD)/.installed
  149. mkdir -p $(_PHP_BE_BUILD)
  150. ( cd $(_PHP_BE_BUILD); \
  151. $(SOURCE_PHP)/configure \
  152. --prefix=$(_PHP_BE_DEST) \
  153. --with-apxs2=$(_APACHE_BE_DEST)/bin/apxs \
  154. --with-config-file-path=$(_PHP_BE_CONF) \
  155. --disable-cgi \
  156. --with-layout=GNU \
  157. --disable-rpath \
  158. --disable-ipv6 \
  159. --disable-static \
  160. --enable-sockets \
  161. --enable-inline-optimization \
  162. --with-zlib \
  163. --with-regex=system \
  164. --with-gd \
  165. --with-png-dir=/usr \
  166. --with-jpeg-dir=/usr \
  167. --with-freetype-dir=/usr/include/freetype2 \
  168. --with-mysql=/usr \
  169. );
  170. touch $@
  171. $(_PHP_BE_BUILD)/.compiled: $(_PHP_BE_BUILD)/.configured
  172. make $(MAKE_FLAGS) -C $(_PHP_BE_BUILD) all
  173. touch $@
  174. $(_PHP_BE_BUILD)/.installed: $(_PHP_BE_BUILD)/.compiled
  175. make -C $(_PHP_BE_BUILD) install
  176. # copy default php.ini
  177. cp $(SOURCE_PHP)/php.ini-dist $(_PHP_BE_CONF)/php.ini.dist
  178. # set extension-dir
  179. sed -i $(_PHP_BE_CONF)/php.ini.dist \
  180. -e 's:^extension_dir.*$$:extension_dir = $(shell $(_PHP_BE_DEST)/bin/php-config --extension-dir):'
  181. touch $@
  182. $(SOURCE_EACCELERATOR)/.configured: $(SOURCE_EACCELERATOR)/.unpacked $(_PHP_BE_BUILD)/.installed
  183. ( cd $(SOURCE_EACCELERATOR); \
  184. $(_PHP_BE_DEST)/bin/phpize; \
  185. ./configure \
  186. --with-eaccelerator=shared \
  187. --with-php-config=$(_PHP_BE_DEST)/bin/php-config \
  188. );
  189. touch $@
  190. $(SOURCE_EACCELERATOR)/.compiled: $(SOURCE_EACCELERATOR)/.configured
  191. make $(MAKE_FLAGS) -C $(SOURCE_EACCELERATOR) all
  192. touch $@
  193. $(SOURCE_EACCELERATOR)/.installed: $(SOURCE_EACCELERATOR)/.compiled
  194. make -C $(SOURCE_EACCELERATOR) install
  195. # enable eaccelerator
  196. sed $(SOURCE_EACCELERATOR)/eaccelerator.ini \
  197. -e 's:^zend_extension:;zend_extension:' \
  198. -e 's:;extension="eaccelerator.so":extension="eaccelerator.so":' \
  199. -e 's:^eaccelerator.log_file.*$$:eaccelerator.log_file = "$(_APACHE_BE_LOG)/eaccelerator.log":' \
  200. >> $(_PHP_BE_CONF)/php.ini.dist
  201. touch $@
  202. apache-be-clean:
  203. rm -rf $(_APACHE_BE_BUILD)
  204. rm -rf $(SOURCE_RPAF)
  205. rm -rf $(_PHP_BE_BUILD)
  206. rm -rf $(SOURCE_EACCELERATOR)
  207. ## ############################################################################