summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5c1b633a4d675bc9681ef6f7997afa8f13d6183d (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
179
180
181
182
183
184
185
186
# Maintainer:  dreieck

pkgbase=isdnutils
pkgname=(
  "isdnutils"
)
_debianver=dfsg1
_debianrel=10
_upstreamver=3.25
pkgver="${_upstreamver}+${_debianver}.${_debianrel}"
pkgrel=1
pkgdesc=""
url="https://www.isdn4linux.de/"
arch=(
  "x86_64"
  "i686"
)
license=(
  "GPL-2.0-only"
  "LGPL-2.1-only"
)
depends=(
  "glibc"
  "libcapi"
)
makedepends=(
  "autoconf"
  "automake"
  "coreutils"
  "gcc"
  "groff"           # for 'troff'.
  "imake"           # for 'xmkmf'.
  "linuxdoc-tools"  # for 'sgml2html' and 'sgml2txt'.
  "make"
  "ncurses"
  "perl"
  "tcl"
)
optdepends=(
  "bash: For 'vboxmail' and 'vboxplay'"${pkgdir}/usr/man/man${_manno}"."
  "libxcrypt: For 'vbox'."
  "ncurses: For 'vbox'."
  "perl: For 'isdn_cause'."
  "tcl: For 'vboxgetty'."
)
source=(
  "http://deb.debian.org/debian/pool/main/i/isdnutils/isdnutils_${_upstreamver}+${_debianver}.orig.tar.bz2"
  "http://deb.debian.org/debian/pool/main/i/isdnutils/isdnutils_${_upstreamver}+${_debianver}-${_debianrel}.debian.tar.xz"
  "01_adapt-for-y2025.patch"
  "config.in"  # Tries to activate as many features as possible. Some do not build (needs old linux ISDN headers, or some other older software).
)
sha256sums=(
  "f9b534d32ff3729e2254f380f64894bf04d51a49a5e9ab32bc8f9fa9cce6abf8" # Upstream source
  "96d2b8e22eaded6d4a4bd06893d9c31ee2743132996d232929143e1eda5be530" # Debian patches
  "e3ae5011c25eefefcbd963779fe5ef075e6ec24910082c948fadfd606a007b12" # 01_adapt-for-y2025.patch
  "80d1c87d676932683ff978c33ba960378ef15eeaeb229059dc42fe8bfc3d6cec" # config.in
)
backup=(
  "etc/isdn/isdn.conf"
  "etc/isdn/caller.conf"
  "etc/isdnlog/isdnlog.conf"
  "etc/vbox/vboxd.conf"
  "etc/vbox/vboxgetty.conf"
)
options+=('!lto' 'emptydirs')

_CFLAGSADDITIONS="-std=gnu11 -w -Wno-error=implicit-int -Wno-error=implicit-function-declaration -Wno-error=int-to-pointer-cast -Wno-error=int-conversion -Wno-error=incompatible-pointer-types"

prepare() {
  cd "${srcdir}"

  CFLAGS+=" ${_CFLAGSADDITIONS}"
  CXXFLAGS+=" ${_CFLAGSADDITIONS}"
  export CFLAGS
  export CXXFLAGS
  MAKEFLAGS="-j1"
  export MAKEFLAGS

  _tclver="$(pacman -Qqi tcl | grep -E '^Version[[:space:]]*:' | awk -F: '{print $2}' | tr -d '[:space:]' | awk -F. '{print $1"."$2}')"
  sed "s|%%TCLVER%%|${_tclver}|g" config.in > config

  cd "${srcdir}/${pkgbase}-${_upstreamver}"

  cat "${srcdir}/debian/patches/series" | while read _patch; do
    printf '%s\n' "   > Applying patch '${_patch}' ..."
    patch -Np1 --follow-symlinks -i "${srcdir}/debian/patches/${_patch}"
  done

  for _patch in 01_adapt-for-y2025.patch; do
    printf '%s\n' "   > Applying patch '${_patch}' ..."
    patch -Np1 --follow-symlinks -i "${srcdir}/${_patch}"
  done

  cd eurofile
  ln -sv ../gpl-2.0.txt COPYING.authlib # 'COPYING.authlib' needs to be present, otherwise eurofile configuration aborts with missing source file 'COPYING.authlib'.
  cd "${srcdir}/${pkgbase}-${_upstreamver}"

  cp "${srcdir}/config" .config

  echo "e" | make config # Pipe "e" to stdin to exit the dialogue automatically and continue configuration.

  cd capiinfo
  printf '%s\n' "   > Fixing things in '$(basename "`pwd`")' ..."
  aclocal
  automake --add-missing
  cd "${srcdir}/${pkgbase}-${_upstreamver}"

  cd vbox
  printf '%s\n' "   > Fixing things in '$(basename "`pwd`")' ..."
  aclocal
  automake --add-missing
  autoreconf -f
  ./configure
  cd "${srcdir}/${pkgbase}-${_upstreamver}"

  cd rcapid
  printf '%s\n' "   > Fixing things in '$(basename "`pwd`")' ..."
  aclocal
  automake --add-missing
  cd "${srcdir}/${pkgbase}-${_upstreamver}"

  cd capifax
  printf '%s\n' "   > Fixing things in '$(basename "`pwd`")' ..."
  aclocal
  automake --add-missing
  autoreconf -f
  ./configure
  cd "${srcdir}/${pkgbase}-${_upstreamver}"
}

build() {
  cd "${srcdir}/${pkgbase}-${_upstreamver}"

  CFLAGS+=" ${_CFLAGSADDITIONS}"
  CXXFLAGS+=" ${_CFLAGSADDITIONS}"
  export CFLAGS
  export CXXFLAGS
  MAKEFLAGS="-j1"
  export MAKEFLAGS

  make -C vbox || true # Might fail on the first runs.
  make -C vbox || true # Might fail on the first runs.
  make -C vbox || true # Might fail on the first runs.
  make

  make -C Mini-FAQ
}

package_isdnutils() {
  cd "${srcdir}/${pkgbase}-${_upstreamver}"

  CFLAGS+=" ${_CFLAGSADDITIONS}"
  CXXFLAGS+=" ${_CFLAGSADDITIONS}"
  export CFLAGS
  export CXXFLAGS
  MAKEFLAGS="-j1"
  export MAKEFLAGS

  install -dvm755 "${pkgdir}/usr/sbin" # Need to create this manually for the next step, other 'vbox' installation fails.
  make DESTDIR="${pkgdir}" install
  install -Dvm755 scripts/isdncause "${pkgdir}/usr/bin/isdn_cause"
  install -Dvm755 -t "${pkgdir}/usr/share/doc/isdn4linux/Mini-FAQ" Mini-FAQ/isdn-faq.{txt,html}

  ## Fixup stuff:
  for _manbin in "vbox" "vboxcnvt" "vboxctrl" "vboxplay" "vboxbeep" "autovbox" "rmdtovbox" "vboxmode" "vboxtoau"; do
    mv -v "${pkgdir}/usr/man/${_manbin}" "${pkgdir}/usr/bin"/
  done
  for _manno in 1 5 8; do
    install -dvm755 "${pkgdir}/usr/share/man/man${_manno}"
    mv -v "${pkgdir}/usr/man/man${_manno}"/* "${pkgdir}/usr/share/man/man${_manno}"/
    rmdir "${pkgdir}/usr/man/man${_manno}"
  done
  rmdir "${pkgdir}/usr/man"
  mv -v "${pkgdir}/usr/sbin"/* "${pkgdir}/usr/bin"/
  rmdir "${pkgdir}/usr/sbin"
  chmod 0644 "${pkgdir}/etc/vbox"/{vboxd.conf,vboxgetty.conf}
  chmod 0755 "${pkgdir}/usr/bin"/{divertctrl,iprofd,isdnctrl,vboxbeep,vboxd,vboxgetty}
  install -dvm755 "${pkgdir}/usr/share/doc/isdn4linux/isdnutils"
  mv -v "${pkgdir}/usr/share/doc/vbox" "${pkgdir}/usr/share/doc/isdn4linux/isdnutils"/
  rmdir "${pkgdir}/var/run" # Already provided by package 'filesystem'

  install -Dvm644 -t "${pkgdir}/usr/share/doc/isdn4linux/isdnutils"     NEWS README
  install -Dvm644 -t "${pkgdir}/usr/share/licenses/${pkgname}"          gpl-2.0.txt lgpl-2.1.txt
  # install -Dvm644 -t "${pkgdir}/usr/share/licenses/${pkgname}"          LEGAL.ipppcomp      # 'ipppcomp' is not built or installed, so no license note for it needed.
  # install -Dvm644 -t "${pkgdir}/usr/share/licenses/${pkgname}/ipppcomp" ipppcomp/README.LZS # 'ipppcomp' is not built or installed, so no license note for it needed.
}