archrelease: copy trunk to extra-x86_64
[arch-packages.git] / tomcat9 / trunk / PKGBUILD
blob4ec42039eda1ac028a20bd27846902a25aef00fd
1 # Maintainer: Maxime Gauduin <alucryd@archlinux.org>
2 # Contributor: Olli <olli@suruatoel.xyz>
4 pkgname=tomcat9
5 pkgver=9.0.75
6 pkgrel=1
7 pkgdesc='Open source implementation of the Java Servlet 4.0 and JavaServer Pages 2.3 technologies'
8 arch=(any)
9 url=https://tomcat.apache.org/
10 license=(APACHE)
11 depends=(
12   'java-runtime>=8'
13   java-jsvc
14   java-commons-daemon
15   eclipse-ecj
17 makedepends=(
18   ant
19   git
20   java-environment=8
22 optdepends=('tomcat-native: to allow optimal performance in production environments')
23 backup=(
24   etc/tomcat9/catalina.policy
25   etc/tomcat9/catalina.properties
26   etc/tomcat9/context.xml
27   etc/tomcat9/logging.properties
28   etc/tomcat9/server.xml
29   etc/tomcat9/tomcat-users.xml
30   etc/tomcat9/web.xml
32 install=tomcat9.install
33 _tag=2f528c02a9b54cc210897f75492a2bb6eac326b5
34 source=(
35   git+https://github.com/apache/tomcat.git#tag=${_tag}
36   tomcat9.service
37   tomcat9.sysusers
38   tomcat9.tmpfiles
40 b2sums=('SKIP'
41         '54b745cefdb9dbe5993b0b2ca08fae8d453a7610ffdeb2795b766d3ce321c267d570f6a1f5bd197f4c8053df3ab46ff68363f9d5ea1d96ddf96d19b84c075d21'
42         'b5206f649229ed67e8f9bfbd942d2fcdeb4056633e47b6a0cbbd813220c74a708a418fb09fe2e5a3c6fb17e271f268e2326bc3d26cdfd0e54c4f0eb9eeba3413'
43         '85a0dc807d3398856046e1450578e8f3a81ee34435eba119a883231ecd0e09ed32c97bf1747b20a253270df8a6e918d3823e6273ec52c01afd9a34a042e9dfcf')
45 _gid_log=19
46 _gid_tomcat=58
47 _uid_tomcat=58
49 pkgver() {
50   cd tomcat
51   _pkgver=$(git describe --tags)
52   if [[ ${_pkgver} != 9.* ]]; then
53     exit 1
54   fi
55   echo ${_pkgver}
58 prepare() {
59   cd tomcat
60   cp build.properties.default build.properties
61   sed "/^base\.path=/c\base\.path=${srcdir}" -i build.properties
62   sed "/^compile.debug=/c\compile.debug=false" -i build.properties
63   sed "/^trydownload.httpusecaches=/c\trydownload.httpusecaches=false" -i build.properties
66 build() {
67   cd tomcat
68   export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
69   export PATH="$JAVA_HOME/bin:$PATH"
70   ant
73 package() {
74   cd tomcat/output/build
76   # Tomcat general files
77   install -dm 755 "${pkgdir}"/usr/share/tomcat9/bin
78   install -m 755  bin/* -t "${pkgdir}"/usr/share/tomcat9/bin/
79   # commons-daemon is packaged on its own
80   rm "${pkgdir}"/usr/share/tomcat9/bin/{*.bat,commons-daemon*}
81   ln -s /usr/share/java/commons-daemon.jar "${pkgdir}"/usr/share/tomcat9/bin/commons-daemon.jar
83   install -dm 755 "${pkgdir}"/usr/share/java/tomcat9
84   install -m 644 lib/* -t "${pkgdir}"/usr/share/java/tomcat9/
85   # eclipse-ecj is packaged on its own
86   rm "${pkgdir}"/usr/share/java/tomcat9/ecj-*.jar
87   ln -s ../eclipse-ecj.jar "${pkgdir}"/usr/share/java/tomcat9/ecj.jar
89   ln -s /usr/share/java/tomcat9 "${pkgdir}"/usr/share/tomcat9/lib
91   # We log through systemd but this would still be required for stock Tomcat logging
92   install -dm 775 -o ${_uid_tomcat} -g ${_gid_log} "${pkgdir}"/var/log/tomcat9
93   ln -s /var/log/tomcat9 "${pkgdir}"/usr/share/tomcat9/logs
94   touch "${pkgdir}"/var/log/tomcat9/catalina.{out,err}
95   chgrp ${_gid_log} "${pkgdir}"/var/log/tomcat9/catalina.{out,err}
97   install -dm 775 "${pkgdir}"/etc/tomcat9
98   install -m 640 -g ${_gid_tomcat} conf/* -t "${pkgdir}"/etc/tomcat9/
100   install -dm 775 -g ${_gid_tomcat} "${pkgdir}"/etc/tomcat9/Catalina
101   ln -s /etc/tomcat9 "${pkgdir}"/usr/share/tomcat9/conf
103   install -dm 775 "${pkgdir}"/var/lib/tomcat9
104   cp -dr --no-preserve=ownership webapps "${pkgdir}"/var/lib/tomcat9/
105   chown -R ${_uid_tomcat}:${_gid_tomcat} "${pkgdir}"/var/lib/tomcat9
106   chmod 775 "${pkgdir}"/var/lib/tomcat9/webapps
107   ln -s /var/lib/tomcat9/webapps "${pkgdir}"/usr/share/tomcat9/webapps
109   install -dm 1777 "${pkgdir}"/var/tmp
110   install -dm 775 -o ${_uid_tomcat} -g ${_gid_tomcat} "${pkgdir}"/var/tmp/tomcat9/{temp,work}
111   ln -s /var/tmp/tomcat9/temp "${pkgdir}"/usr/share/tomcat9/temp
112   ln -s /var/tmp/tomcat9/work "${pkgdir}"/usr/share/tomcat9/work
114   install -Dm 644 ../../../tomcat9.service -t "${pkgdir}"/usr/lib/systemd/system/
115   install -Dm 644 ../../../tomcat9.sysusers "${pkgdir}"/usr/lib/sysusers.d/tomcat9.conf
116   install -Dm 644 ../../../tomcat9.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/tomcat9.conf
119 # vim: ts=2 sw=2 et: