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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
# Maintainer: dreieck
# Contributor: Vasco Costa <vasco dot costa at geekslot dot com>
# Contributor: jaro3
_USE_CCACHE=false
# _USE_CCACHE=true
_pkgname=wwwoffle
pkgname="${_pkgname}-svn"
epoch=1
# _pkgver=2.9j
pkgver=2.9j+svn2260.d20241022
pkgrel=1
pkgdesc="Simple caching proxy server with special features (request, recursive fetch, subscription, modify HTML, ...) for use with dial-up internet links. Includes startup scripts for OpenRC, System V init, systemd."
arch=(
'arm'
'arm64'
'i686'
'x86_64'
)
url="http://www.gedanken.org.uk/software/wwwoffle/"
license=('GPL2')
depends=(
'gnutls'
'libgcrypt'
'zlib'
)
optdepends=(
'openrc: For openrc iniscript.'
"systemd: For systemd init'script'."
'sysvinit: For system-V-style initscript.'
"perl: For 'scripts/README.CONF-html.pl' script which creates an HTML version of 'README.CONF'."
"ruby: For 'contrib/eregister/eregister' tool which indexes the cache."
)
makedepends=(
'subversion'
)
if "${_USE_CCACHE}"; then
makedepends+=('ccache')
options+=('ccache')
fi
provides=(
"${_pkgname}=${pkgver}"
"${_pkgname}-sysvinit=${pkgver}"
"${_pkgname}-openrc=${pkgver}"
"${_pkgname}-systemd=${pkgver}"
)
replaces=(
# Bugfixes are not really applied in the releases, so we explicitly replace the release.
"${_pkgname}<=${pkgver}"
)
conflicts=(
"${_pkgname}"
"${_pkgname}-sysvinit"
"${_pkgname}-openrc"
"${_pkgname}-systemd"
)
backup=(
'etc/conf.d/wwwoffle'
'etc/wwwoffle/wwwoffle.conf'
# 'etc/wwwoffle/wwwoffle.conf.template'
)
install="${_pkgname}.install"
options=('emptydirs')
_svnurl="http://gedanken.org.uk/svn/wwwoffle/trunk"
source=(
# "http://www.gedanken.org.uk/software/wwwoffle/download/${_pkgname}-${_pkgver}.tgz"
"${_pkgname}::svn+${_svnurl}"
'conf_d_wwwoffle'
'initscript_openrc'
'initscript_systemd'
'initscript_sysvinit'
"${install}"
)
sha256sums=(
# 'e6341a4ec2631dc22fd5209c7e5ffe628a5832ad191d444c56aebc3837eed2ae' # Main source, release
'SKIP' # Main source, SVN
'5491ffc23ae113db4b46167883594b5bcb6f1bbd0ce11432bc45047efbd635d2' # conf_d_wwwoffle
'd9451db92f979a6573cecbab23c26b6ca8ea026ef61b22ec4b61c0c9051142e9' # initscript_openrc
'03bebce87a0da1b383666ab7a95b9810e15f2a024c0954f09c959d342c5d9c87' # initscript_systemd
'0c43f92f81504838ad0c6ede968afe222b1d30312569676bf6952892d48724b3' # initscript_sysvinit
'106f4ce3de6d6ea020e8dcd8a4fd4f78ed2ae855e8a953a8783134e4d2cfba12' # ${install}
)
_svnlog='svn.log'
pkgver() {
cd "${srcdir}/${_pkgname}"
_pgmver() {
cd "${srcdir}/${_pkgname}"
# # Well, this _is_ useless use of cat, but to make it more clear to see in which order things are going on I do the cat first and then the grep.
# _ver="$(cat conf/wwwoffle.conf.template" | \
# grep -E '^#.*WWWOFFLE.*[Vv]ersion' | \
# head -n 1 | \
# sed 's|.* \([^ ]*\)$|\1|g' | \
# sed 's|\.$||g'
# )"
# Well, this _is_ useless use of cat, but to make it more clear to see in which order things are going on I do the cat first and then the grep.
_ver="$(cat "src/version.h" | \
grep -E '^[[:space:]]*#define[[:space:]]+WWWOFFLE_VERSION' | \
awk '{print $3}' | \
tr -d \'\" | \
awk -F+ '{print $1}'
)"
if [ -z "${_ver}" ]; then
return 1
else
printf '%s' "${_ver}"
fi
}
_ver="$(_pgmver)"
_rev="$(svn info | grep '^Revision' | cut -d' ' -f2)"
_date="$(svn info --show-item last-changed-date | awk -FT '{print $1}' | tr -d '-')"
if [ -z "${_ver}" ]; then
printf '%s\n' "$0: Error: Could not determine version." > /dev/stderr
printf '%s\n' "Aborting." > /dev/stderr
false
return 1
fi
if [ -z "${_rev}" ]; then
printf '%s\n' "$0: Error: Could not determine SVN revision." > /dev/stderr
printf '%s\n' "Aborting." > /dev/stderr
false
return 1
fi
if [ -z "${_date}" ]; then
printf '%s\n' "$0: Error: Could not determine latest commit date." > /dev/stderr
printf '%s\n' "Aborting." > /dev/stderr
false
return 1
fi
printf '%s' "${_ver}+svn${_rev}.d${_date}"
}
prepare() {
_unpackeddir="${srcdir}/${_pkgname}"
cd "${_unpackeddir}"
### Update version.h to the actual version + SVNrevision
msg2 "Updating version in src/version.h to ${pkgver} ..."
sed -i 's|^\([[:space:]]*#define[[:space:]]*WWWOFFLE_VERSION[[:space:]]*\).*$|/*+ +*/\n/*+ The following line was automatically upgraded by the Arch Linux PKGBUILD (package build script) +*/\n/*+ in order to match the version as in conf/wwwoffle.conf.template and the SVN revision. +*/\n\1"'"${pkgver}"'"|' \
"${_unpackeddir}/src/version.h"
msg2 "Generating svn commit messages file ..."
svn log > "${_svnlog}"
}
build() {
_unpackeddir="${srcdir}/${_pkgname}"
cd "${_unpackeddir}"
### Setting CFGLAGS.
CFLAGS+=' -Wno-error=unused-result'
export CFLAGS
msg2 "Using the following CFLAGS: '${CFLAGS}'"
### Make the ./configure-script.
# libtoolize --force
# aclocal
# autoheader
msg2 "Running 'autoconf' to generate './configure' from 'configure.in' ..."
autoconf -o configure -v configure.in
### Configure the Makefile.
msg2 "Running './configure' (with options) ..."
./configure \
--prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/bin \
--exec-prefix=/usr \
--with-zlib \
--with-gnutls \
--with-gcrypt \
--with-ipv6 \
--with-spooldir=/var/spool/wwwoffle \
--with-confdir=/etc/wwwoffle \
--with-default-language=en
### Build the software.
msg2 "Running 'make' ..."
make || return 1
}
package() {
_unpackeddir="${srcdir}/${_pkgname}"
cd "${_unpackeddir}"
### Install the software.
msg2 "Runnung 'make install' (with options) ..."
make DESTDIR="${pkgdir}" install
msg2 "Installing other files ..."
### Move documentation into the place we want it.
mkdir -p "${pkgdir}/usr/share"
mv -v "${pkgdir}/usr/doc" "${pkgdir}/usr/share/doc"
for _docfile in ChangeLog* "${_svnlog}"; do
install -v -D -m644 "${_docfile}" "${pkgdir}/usr/share/doc/wwwoffle/${_docfile}"
done
### Symlink the HTML-Documentation under wwwoffle's spool directory to the documentation directory. Note: The html documentation needs to stay at wwwoffle's spool directory, since it serves it from there when it's webinterface is accessed.
mkdir -p "${pkgdir}/usr/share/doc/wwwoffle/html"
ln -sv "/var/spool/wwwoffle/html"/{de,en,es,fr,it,nl,pl,ru} "${pkgdir}/usr/share/doc/wwwoffle/html/"
### Install startup scripts for different init systems.
install -D -m755 "${srcdir}/initscript_sysvinit" "${pkgdir}/etc/rc.d/wwwoffle"
install -D -m755 "${srcdir}/initscript_openrc" "${pkgdir}/etc/init.d/wwwoffle"
install -D -m644 "${srcdir}/initscript_systemd" "${pkgdir}/usr/lib/systemd/system/wwwoffle.service"
### Install a default initscript configuration file (for openrc and sysvinit only; for systemd user has to manually edit the systemd service file).
install -D -m644 "${srcdir}/conf_d_wwwoffle" "${pkgdir}/etc/conf.d/wwwoffle"
### Change config such that wwwoffle runs as user wwwoffle and group wwwoffle. (Adding user and group is handled by the ${install}-script.)
sed -i -e 's/^#run-uid.*/ run-uid = wwwoffle/' "${pkgdir}/etc/wwwoffle/wwwoffle.conf"
sed -i -e 's/^#run-gid.*/ run-gid = wwwoffle/' "${pkgdir}/etc/wwwoffle/wwwoffle.conf"
### Move config into final place (such that it is not automatically used, but user actually has to do some manual work).
mv "${pkgdir}/etc/wwwoffle/wwwoffle.conf" "${pkgdir}/etc/wwwoffle/wwwoffle.conf.template"
### Install contrib(uted) scripts and files for the user's disposal
cp -av "${srcdir}/${_pkgname}"/{contrib,contrib-win32,doc/scripts} "${pkgdir}/usr/share/doc/wwwoffle/"
### Set permissions of spool directory.
chmod -R ug=Xwr "${pkgdir}/var/spool/wwwoffle"
}
|