summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4e4025cf1648a47560bf13766d5a2cf00146e2cf (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
# Maintainer: Samueru-sama <xdglawyer@outlook.com>
# Contributor: Daniel Bermond <dbermond@archlinux.org>

pkgbase=libjxl-noglycin
pkgname=('libjxl-noglycin' 'libjxl-noglycin-doc')
pkgver=0.11.2
pkgrel=2
pkgdesc='JPEG XL image format reference implementation, for gdk-pixbuf2-noglycin'
arch=('x86_64' 'aarch64')
url='https://jpeg.org/jpegxl/'
license=('BSD-3-Clause')
makedepends=(
    'add-determinism'
    'asciidoc'
    'brotli'
    'cmake'
    'doxygen'
    'gdk-pixbuf2-noglycin'
    'giflib'
    'git'
    'gperftools'
    'graphviz'
    'gtest'
    'highway'
    'java-environment'
    'libjpeg-turbo'
    'libpng'
    'python'
    'xdg-utils')
source=("git+https://github.com/libjxl/libjxl.git#tag=v${pkgver}"
        'git+https://github.com/mm2/Little-CMS.git'
        'git+https://github.com/webmproject/sjpeg.git'
        'git+https://skia.googlesource.com/skcms.git'
        'libjxl-testdata'::'git+https://github.com/libjxl/testdata.git'
        'git+https://github.com/libjpeg-turbo/libjpeg-turbo.git')
sha256sums=('0d1a459ef8390a8d991f8e6501c0292cc5f443a7663aeedf0922df855a61f9a2'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

prepare() {
    git -C libjxl submodule init

    local _submodule

    for _submodule in libjpeg-turbo sjpeg skcms
    do
        git -C libjxl config --local "submodule.third_party/${_submodule}.url" "${srcdir}/${_submodule}"
    done

    for _submodule in brotli googletest highway libpng zlib
    do
        git -C libjxl config --local "submodule.third_party/${_submodule}.update" none
    done

    git -C libjxl config --local submodule.third_party/lcms.url "${srcdir}/Little-CMS"
    git -C libjxl config --local submodule.third_party/testdata.url "${srcdir}/libjxl-testdata"
    git -C libjxl -c protocol.file.allow='always' submodule update
}

build() {
    export CFLAGS+=' -DNDEBUG -ffat-lto-objects'
    export CXXFLAGS+=' -DNDEBUG -ffat-lto-objects'
    cmake -B build -S libjxl \
        -G 'Unix Makefiles' \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -DCMAKE_POLICY_VERSION_MINIMUM:STRING='3.5.0' \
        -DJPEGXL_BUNDLE_LIBPNG:BOOL='false' \
        -DJPEGXL_ENABLE_AVX512:BOOL='true' \
        -DJPEGXL_ENABLE_BENCHMARK:BOOL='false' \
        -DJPEGXL_ENABLE_EXAMPLES:BOOL='false' \
        -DJPEGXL_ENABLE_FUZZERS:BOOL='false' \
        -DJPEGXL_ENABLE_OPENEXR:BOOL='false' \
        -DJPEGXL_ENABLE_PLUGIN_GDKPIXBUF:BOOL='true' \
        -DJPEGXL_ENABLE_PLUGINS:BOOL='true' \
        -DJPEGXL_ENABLE_VIEWERS:BOOL='false' \
        -DJPEGXL_FORCE_SYSTEM_BROTLI:BOOL='true' \
        -DJPEGXL_FORCE_SYSTEM_GTEST:BOOL='true' \
        -DJPEGXL_FORCE_SYSTEM_HWY:BOOL='true' \
        -DJPEGXL_INSTALL_JARDIR:STRING='/usr/share/java' \
        -DJPEGXL_ENABLE_PLUGIN_GDKPIXBUF:BOOL='YES' \
        -Wno-dev
    cmake --build build
    make -C build doc
}

# test are disabled since they take way too long
#check() {
#    ctest --test-dir build --output-on-failure
#}

package_libjxl-noglycin() {
    conflicts=(
        libjxl
    )
    depends=(
        'brotli'
        'giflib'
        'glibc'
        'gperftools'
        'libgcc'
        'highway'
        'libjpeg-turbo'
        'libpng'
        'libstdc++')
    optdepends=(
        'java-runtime: for JNI bindings'
        'gdk-pixbuf2-noglycin: for gdk-pixbuf loader')
    provides=(
        'libjxl'
        'libjxl.so'
        'libjxl_cms.so'
        'libjxl_threads.so')

    DESTDIR="$pkgdir" cmake --install build
    install -D -m644 libjxl/{LICENSE,PATENTS} -t "${pkgdir}/usr/share/licenses/${pkgname}"
    mv "${pkgdir}/usr/share/java"/{org.jpeg.jpegxl,jpegxl}.jar

    # Clamp timestamps to SOURCE_DATE_EPOCH and strip other metadata, to make
    # the package reproducible.
    add-det "${pkgdir}/usr/share/java"/jpegxl.jar
}

package_libjxl-noglycin-doc() {
    pkgdesc+=' (documentation)'
    conflicts=(
        libjxl-docs
    )
    provides=(
        libjxl-docs
    )
    install -d -m755 "${pkgdir}/usr/share/doc"
    install -D -m644 libjxl/{LICENSE,PATENTS} -t "${pkgdir}/usr/share/licenses/${pkgname}"
    cp -dr --no-preserve='ownership' build/html "${pkgdir}/usr/share/doc/libjxl"
}