wok-next view apache/receipt @ rev 21094

Apply "force-arch" for selected dev packages
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Dec 31 17:23:40 2018 +0200 (2018-12-31)
parents d5aab818505e
children 2fe1301d05e5
line source
1 # SliTaz package receipt v2.
3 PACKAGE="apache"
4 VERSION="2.4.28"
5 CATEGORY="network"
6 SHORT_DESC="Secure, efficient and extensible HTTP server"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="Apache"
9 WEB_SITE="http://www.apache.org/"
11 TARBALL="httpd-$VERSION.tar.bz2"
12 WGET_URL="http://www.apache.org/dist/httpd/$TARBALL"
14 BUILD_DEPENDS="apr-util-dev apr-dev openssl-dev sed expat-dev zlib-dev \
15 util-linux-uuid-dev openldap-dev bash pcre-dev"
16 SPLIT="$PACKAGE-dev $PACKAGE-doc $PACKAGE"
18 COOKOPTS="force-arch" # different configs in dev
20 compile_rules() {
21 grep -q Slitaz config.layout || \
22 cat $stuff/slitaz.layout >> config.layout
23 sed -i 's|mkdir |mkdir -p |' build/mkdir.sh
25 ./configure \
26 --mandir=/usr/share/man \
27 --enable-mods-shared=all \
28 --enable-proxy \
29 --enable-ssl \
30 --enable-layout=Slitaz \
31 $CONFIGURE_ARGS &&
32 make $MAKEFLAGS &&
33 make DESTDIR=$install install || return 1
35 install -Dm755 $stuff/apache $install/etc/init.d/apache
37 mkdir -p $install/etc/apache/extra/
38 cp -a $stuff/fix-range-CVE-2011-3192.conf $install/etc/apache/extra/
40 sed -i \
41 -e 's|User daemon|User www|' \
42 -e 's|Group daemon|Group www|' \
43 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
44 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
45 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
46 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
47 -e 's|#LoadModule ssl_module|LoadModule ssl_module|' \
48 $install/etc/apache/httpd.conf \
49 $install/etc/apache/extra/httpd-ssl.conf
51 echo "Include /etc/apache/conf.d" >> $install/etc/apache/httpd.conf
52 sed -i 's/^SSLSessionCache /#&/' $install/etc/apache/extra/httpd-ssl.conf
53 cat >> $install/etc/apache/extra/httpd-ssl.conf <<EOT
55 # Unsafe, see CVE-2014-3566 POODLE
56 SSLProtocol All -SSLv2 -SSLv3
57 EOT
59 chown -R root:root $install
60 }
62 genpkg_rules() {
63 case $PACKAGE in
64 apache-dev)
65 copy @dev apxs /usr/share/apache/build/
66 rm -r $fs/usr/share/apache/error/ # here folder 'include'
67 ;;
68 apache-doc)
69 copy /usr/share/doc/
70 CAT="development|documentation"
71 ;;
72 apache)
73 copy @std @rm /usr/share/apache/error/include/
74 rm -rf $fs/etc/apache/original/
75 CONFIG_FILES="/etc/apache/ /var/www/ /etc/ssl/apache/"
76 TAZPANEL_DAEMON="edit::/etc/apache/httpd.conf|web::$WEB_SITE"
77 PROVIDE="lighttpd"
78 TAGS="webserver http server"
79 DEPENDS="apr apr-util libldap libpcre openssl zlib"
80 ;;
81 esac
82 }
84 # We stop the server by default in case of upgarde.
85 pre_install_apache() {
86 [ -n "$1" ] ||
87 for i in httpd lighttpd ngnix cherokee $PACKAGE; do
88 [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
89 done
90 }
92 post_install_apache() {
93 local lang=$(. $1/etc/locale.conf 2>/dev/null; echo ${LANG#*_})
94 local tz=$(cat $1/etc/TZ 2>/dev/null)
95 local hostname=$(cat $1/etc/hostname 2>/dev/null)
97 # Just in case.
98 chown www.www "$1/var/log/$PACKAGE"
100 ping -c 2 $(hostname) >/dev/null 2>&1 ||
101 sed -i "s/localhost/$(hostname) localhost/" "$1/etc/hosts"
103 sed -i -e "s/^#\(LoadModule.*slotmem_shm.*\)$/\1/" \
104 -e "s/.*ServerName www.example.*/ServerName ${hostname:-slitaz}/" \
105 $1/etc/apache/httpd.conf $1/etc/apache/extra/httpd-ssl.conf
107 grep -qs Apache $1/var/www/index.html &&
108 sed -i 's|^LighTTPD.*|&\nApache configs : /etc/apache|' \
109 $1/var/www/index.html
111 [ -s "$1/etc/ssl/apache/apache.pem" ] ||
112 openssl req -new -x509 -keyout "$1/etc/ssl/apache/apache.pem" \
113 -out "$1/etc/ssl/apache/apache.pem" -days 3650 -nodes <<EOT
114 ${lang:-US}
115 ${tz:-Somewhere}
119 ${hostname:-slitaz}
121 EOT
123 [ -z "$quiet" ] && echo # Start new line
124 ( cd "$1/$INSTALLED/"; grep -l /etc/apache/conf.d/ */receipt ) | \
125 while read file; do
126 pkg=$(dirname $file)
127 [ "$pkg" = "$PACKAGE" ] && continue
128 [ -z "$quiet" ] && echo "Reconfiguring $pkg for $PACKAGE..."
129 tazpkg reconfigure $pkg
130 done
131 [ -f "$1/etc/php.ini" ] && tazpkg get-install php-apache --root="$1"
132 [ "$1" ] || netstat -ltn 2> /dev/null | grep -q :80 ||
133 /etc/init.d/$PACKAGE start
134 }