aboutsummaryrefslogtreecommitdiff
path: root/network_daemons/apache/apache.build
blob: 5038f99416d95b6a7856d36d0e376b4da45ef683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=apache
VERSION=2.4.4
BUILD=2
DEPENDS=('apr >= 1.4.6-1' 'expat >= 2.1.0-1' 'pcre >= 8.32-1')
OPTDEPENDS=('file >= 5.14-1' 'openssl >= 1.0.1e-1' 'lua >= 5.2.2-1')

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: apache (The Apache HTTP Server)
${NAME}:
${NAME}: Apache is an HTTP server designed as a plug-in replacement for the
${NAME}: NCSA HTTP server. It fixes numerous bugs in the NCSA server and
${NAME}: includes many frequently requested new features, and has an API which
${NAME}: allows it to be extended to meet users' needs more easily.
${NAME}:
${NAME}: Apache is the most popular web server in the known universe; over
${NAME}: half of the servers on the Internet are running Apache or one of
${NAME}: its variants.
${NAME}:
EOF

cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh

config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
    # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

# If the apache user and group do not exist, add them

if grep "^apache:x:" etc/passwd 1> /dev/null 2> /dev/null ; then
  true
else
  echo "apache:x:80:80:Apache:/srv/www:/bin/false" >> etc/passwd
fi
if grep "^apache:x:" etc/group 1> /dev/null 2> /dev/null ; then
  true
else
  echo "apache:x:80:" >> etc/group
fi
if grep "^apache:" etc/shadow 1> /dev/null 2> /dev/null ; then
  true
else
  echo "apache:*:9797:0:::::" >> etc/shadow
fi

# Create apache's run directory if it isn't there

if [ ! -d run/apache ]; then
  install -m 0755 -d run/apache
fi

config etc/rc.d/rc.httpd.new
config etc/logrotate.d/apache.new

# Now copy the Apache config files into place if there are not existing copies:

for cfgfile in httpd.conf magic mime.types; do
   if [ ! -f etc/apache/\${cfgfile} ]; then
      cp -a etc/apache/\${cfgfile}.default etc/apache/\${cfgfile}
   fi
done
EOF

# Sources

SRCNAME[0]=httpd
SRCVERS[0]=${VERSION}
SRCPACK[0]=http://www.apache.org/dist/httpd/${SRCNAME[0]}-${SRCVERS[0]}.tar.bz2

configure()
{
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --enable-so \
 --with-mpm=worker \
 --enable-layout=Slackware \
 --enable-mpms-shared=all \
 --enable-mods-shared=all \
 --enable-modules=all \
 --enable-pie \
 --enable-ssl \
 --enable-dbd \
 --enable-cgi \
 --enable-cgid \
 --enable-deflate \
 --enable-rewrite \
 --enable-vhost-alias \
 --enable-proxy \
 --enable-proxy-http \
 --enable-proxy-ftp \
 --enable-proxy-connect \
 --enable-cache \
 --enable-mem-cache \
 --enable-file-cache \
 --enable-disk-cache \
 --enable-authn-anon \
 --enable-authn-dbd \
 --enable-authn-dbm \
 --enable-authz-dbd \
 --enable-authz-dbm \
 --enable-dav-fs \
 --disable-ldap \
 --with-libxml2 \
 --with-pcre="${SYS_DIR[usr]}"
 ${*}
 # --enable-ldap \
 # --enable-authnz-ldap \
 # --enable-lua \
 # --enable-luajit \
}

build0()
{
sed -e 's|User daemon|User apache|g' \
    -e 's|Group daemon|Group apache|g' \
    -i docs/conf/httpd.conf.in
configure
make ${JOBS}
make install DESTDIR="${PKG}"
doc ABOUT_APACHE README
changelog CHANGES
license LICENSE
install.dir ${PKG}${SYS_DIR[etc]}/{rc.d,tmpfiles.d,logrotate.d}
install.bin rc.httpd.new ${PKG}${SYS_DIR[etc]}/rc.d
install.cfg apache.conf.tmpfiles ${PKG}${SYS_DIR[etc]}/tmpfiles.d/apache.conf
install.cfg apache.logrotate ${PKG}${SYS_DIR[etc]}/logrotate.d/apache.new
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.cfg apache.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
mv \
 ${PKG}${SYS_DIR[etc]}/apache/httpd.conf \
 ${PKG}${SYS_DIR[etc]}/apache/httpd.conf.default
mv \
 ${PKG}${SYS_DIR[etc]}/apache/mime.types \
 ${PKG}${SYS_DIR[etc]}/apache/mime.types.default
mv \
 ${PKG}${SYS_DIR[etc]}/apache/magic \
 ${PKG}${SYS_DIR[etc]}/apache/magic.default
rm -rf \
 ${PKG}${SYS_DIR[run]}
sed \
    -e 's|#\(LoadModule negotiation_module \)|\1|' \
    -e 's|#\(LoadModule include_module \)|\1|' \
    -e 's|#\(LoadModule userdir_module \)|\1|' \
    -e 's|#\(LoadModule slotmem_shm_module \)|\1|' \
    -e 's|#\(Include /etc/apache/extra/httpd-multilang-errordoc.conf\)|\1|' \
    -e 's|#\(Include /etc/apache/extra/httpd-autoindex.conf\)|\1|' \
    -e 's|#\(Include /etc/apache/extra/httpd-languages.conf\)|\1|' \
    -e 's|#\(Include /etc/apache/extra/httpd-userdir.conf\)|\1|' \
    -e 's|#\(Include /etc/apache/extra/httpd-default.conf\)|\1|' \
    -e 's|#\(Include /etc/apache/extra/httpd-mpm.conf\)|\1|' \
    -i ${PKG}${SYS_DIR[etc]}/apache/httpd.conf.default
}