summaryrefslogtreecommitdiff
path: root/libre/icu-compat/PKGBUILD
blob: d0ec9fa9690b44b756e134a5bf2b772f573c7986 (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
# Maintainer (arch:icu): Andreas Radke <andyrtr@archlinux.org>
# Contributor: Art Gramlich <art@gramlich-net.com>
# Contributor: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: bill-auger <bill-auger@programmer.net>
# Maintainer: Parabola Hackers <dev@lists.parabola.nu>
# Maintainer (archarm:icu): Kevin Mihelich <kevin@archlinuxarm.org>


# parabola changes and rationale:
# - remove all files other than libicu*.so.*
# - depend on icu; this is needed because if the package is installed on its
#   own, ldconfig will create un-tracked symlinks which were supposed to be
#   installed by the icu package.
# archarm changes and rationale:
#  - patch to fix icudata library linking on ARM
#  - remove check for clang in configure - picks up distcc


# NOTE:
#
# Several Parabola packages depends on 'icu', and the 'icu' "sonames" change
# frequently. If we don't rebuild all of the Parabola packages which depend on
# 'icu', as soon as the new ArchLinux, ArchLinux32, and ArchLinuxARM 'icu'
# packages are synchronized into the Parabola repositories, we have a problem.
# The repo server synchronizes with the upstream repos un-attended; so this is
# a wonderful surprise each time. We must hustle to make the system sane
# again. We could watch the upstream testing and staging repos of each upstream,
# and start re-building everything in a Parabola staging repo; but that could
# result in discarded work, if those exact versions are not the ones which are
# eventually released into the main repos.
#
# At first nothing was done to fix or workaround that issue. In practice, once
# a new 'icu' was synchronized, many users were upgrading before the Parabola
# packages had the time to be rebuilt. For such users, it broke all the
# installed Parabola packages that were depending on the old 'icu'. This means
# that users had to find a way to downgrade packages manually or wait until
# the package maintainers would finally have rebuilt all of the broken packages.
#
# Then such packages were modified to make them depend on the exact version of
# the 'icu' packages they were built against. This way, once the new 'icu'
# package is synchronized, the upgrade and the resulting breakage is suppressed,
# if packages needing rebuild against the new 'icu' package are installed.
# However this workaround also prevents installing packages that depends on the
# new 'icu'.
#
# An alternate fix would be to automatically build all packages, instead
# of relying on the upstreams. Still, new staging repos would be required to hold
# the new packages, until they all can be released together sanely. However we
# don't have the tooling to run an automatic builder for all packages yet.
#
# In the meantime, this version of 'icu' exists for Parabola packages to link
# against at runtime. In this way, Parabola packages can depend only on the
# shared-object dependencies (aka: "sodeps", eg: libicu*.so) exposed by 'icu',
# which is usually provided by the upstream's 'icu'; but may fall-back on this
# package, if the dependent package has yet to be rebuilt.
#
# It is inspired by the awkward hack of carrying multiple versions of library
# dependencies, commonly used temporarily, for extraordinary cases (e.g. in
# ArchLinux32 and the AUR as 'icu65', in ArchLinux as 'electronNN', etc).
# The awkwardness is superficial though. This "rolling" fall-back scales
# elegantly to Parabola's needs, without consuming increasing resources.
#
# 'icu-compat' will usually be one major version behind core/icu. Dependent
# PKGBUILDs of 'icu' can simply add the following "sodep" dependency:
#
#   depends=('libicui18n.so')
#
# or whichever libicu*.so.* linkage is reported by:
#
#   $ readelf -d /path/to/compiled/ELF/file | grep libicu
#
# Then, each time the upstream distribution upgrades 'icu', upgrade this package
# as well, ensuring that it is always at the immediately preceding upstream
# version. If some dependent is not yet re-built when it's 'icu' sodep becomes
# more than one version behind upstream, this PKGBUILD could be renamed/re-built
# as 'icu-compat-NN'. Of course, it would still be better to rebuild the
# dependent(s) instead; but sometimes (especially for i686) the dependent may
# have other problems, preventing rebuild.
#
# Though pacman will pull in the appropriate package automatically as needed, the
# general recommendation is for all Parabola users to keep this package installed
# always, as a catch-all for any dependent lacking the appropriate sodep.
#
# This works well for 'icu', even for packages which link to both the older and
# newer versions of libicu*.so, since 'icu' uses versioned symbols as reported by:
#
#   $ nm -D --demangle --with-symbol-versions /path/to/library
#
# However, caution must be taken before implementing the same hack for other
# libraries. Currently, 'icu' is the only one which changes so often, has so
# many dependents, _and_ supports this hack robustly.


pkgname=icu-compat
pkgver=73.2
pkgrel=2
pkgdesc="International Components for Unicode library"
pkgdesc+=" (compatibility libraries for the previous release)"
arch=(x86_64)
arch+=(armv7h i686)
url="https://icu.unicode.org"
license=('custom:icu')
depends=('gcc-libs' 'glibc' 'sh')
depends+=("icu>${pkgver}")
makedepends=('python')
provides=(libicu{data,i18n,io,test,tu,uc}.so)
conflicts=("icu<=${pkgver}" icu${pkgver%%.*})
options=('debug')
source=(https://github.com/unicode-org/icu/releases/download/release-${pkgver//./-}/icu4c-${pkgver//./_}-src.tgz{,.asc}
        ICU-22132.patch)
source_armv7h=(icudata-stdlibs.patch)
# https://github.com/unicode-org/icu/releases/download/release-73-2/SHASUM512.txt
sha512sums=('76dd782db6205833f289d7eb68b60860dddfa3f614f0ba03fe7ec13117077f82109f0dc1becabcdf4c8a9c628b94478ab0a46134bdb06f4302be55f74027ce62'
            'SKIP'
            '1178062ccfcf7ecc698c64132b3612e73f9c4b0bbfaa668ae2039f3eb4cb2722d0b08a9f45b057da10def7a308d5c8d14c0c644892e7f11092c9cc488c850ab7')
sha512sums_armv7h=('8f13898c2b2d69ef516ee0831a73e5865676795716e7becac4457e208642bfdffb42f2a9280e99dcc10303ad721f5dc2e10ef83c633bd723044e98cc72c6bc7b')
#validpgpkeys=('BA90283A60D67BA0DD910A893932080F4FB419E3') #  "Steven R. Loomis (filfla-signing) <srloomis@us.ibm.com>" 
#validpgpkeys+=('9731166CD8E23A83BEE7C6D3ACA5DBE1FD8FABF1') #  "Steven R. Loomis (ICU Project) <srl@icu-project.org>" 
#validpgpkeys+=('FFA9129A180D765B7A5BEA1C9B432B27D1BA20D7') # "Fredrik Roubert <fredrik@roubert.name>"
#validpgpkeys+=('E4098B78AFC94394F3F49AA903996C7C83F12F11') # "keybase.io/srl295 <srl295@keybase.io>"
#validpgpkeys+=('4569BBC09DA846FC91CBD21CE1BBA44593CF2AE0') # "Steven R. Loomis (codesign-qormi) <srloomis@us.ibm.com>"
#validpgpkeys=('0E51E7F06EF719FBD072782A5F56E5AFA63CCD33') #"Craig Cornelius (For use with ICU releases) <ccornelius@google.com>"
validpgpkeys=('3DA35301A7C330257B8755754058F67406EAA6AB') # Craig Cornelius <ccornelius@google.com>


prepare() {
  cd icu/source
  patch -Np1 < "../../ICU-22132.patch"


  ## arch-specific patching ##

  case "${CARCH}" in
  armv7h)
    # ../../bin/genrb: error while loading shared libraries: ../../lib/libicudata.so.70: internal error
    patch -p2 -i ${srcdir}/icudata-stdlibs.patch
    sed -r -i 's/(for ac_prog in )clang(\+\+)? /\1/g' configure
    ;;
  esac
}

build() {
  cd icu/source
  ./configure --prefix=/usr \
  --sysconfdir=/etc \
  --mandir=/usr/share/man \
  --sbindir=/usr/bin
  make
}

check() {
  # v71 - 'iotest' test fails on armv7h
  # v72 - 'intltest' test fails on armv7h
  # v73 - 'intltest' test fails on x86_64
  [[ "${CARCH}" != x86_64 ]] || return 0

  cd icu/source
  make -k check
}

package() {
  cd icu/source
  make -j1 DESTDIR="${pkgdir}" install

  # Install license
  install -Dm644 "${srcdir}"/icu/LICENSE "${pkgdir}"/usr/share/licenses/icu/LICENSE
  mv "${pkgdir}"/usr/share/licenses/{icu,${pkgname}}

  # icu-compat - to avoid conflicts against the preferred 'icu' package,
  #              we remove all files except the actual shared libraries
  rm -r "${pkgdir}"/usr/{bin,include,lib/{icu,pkgconfig},share}
  rm "${pkgdir}"/usr/lib/*.so
}