summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 22833cf98a24d4d8a6a11fa10d8e31339a6f48ee (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
# Maintainer: David Hummel <hummeltech@sherpaguru.com>

pkgname='openjkdf2-git'
pkgver=0.9.1.r20.gfbdb01b
pkgrel=4
pkgdesc="A function-by-function reimplementation of DF2 (Dark Forces 2) in C."
arch=('i686' 'x86_64')
url='https://github.com/shinyquagsire23/OpenJKDF2'
license=('0BSD')
makedepends=(
  'at-spi2-core'
  'cairo'
  'clang'
  'cmake'
  'gdk-pixbuf2'
  'git'
  'harfbuzz'
  'pango'
  'python-cogapp'
  'zlib'
)
depends=(
  'curl'
  'gamenetworkingsockets'
  'glib2'
  'gtk3'
  'hicolor-icon-theme'
  'libglvnd'
  'openal'
)
conflicts=('openjkdf2')
options=(!lto)
provides=('openjkdf2')
source=("${pkgname}::git+https://github.com/shinyquagsire23/OpenJKDF2.git"
        'git+https://github.com/FreeGLUTProject/freeglut.git'
        'glew::git+https://github.com/Perlmint/glew-cmake.git'
        'git+https://github.com/madler/zlib.git'
        'git+https://github.com/icculus/physfs.git'
        'git+https://github.com/ValveSoftware/GameNetworkingSockets.git'
        'git+https://github.com/protocolbuffers/protobuf.git'
        'git+https://github.com/glennrp/libpng.git'
        'git+https://github.com/libsdl-org/SDL.git'
        'git+https://github.com/libsdl-org/SDL_mixer.git'
)
sha512sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
)

pkgver() {
  cd "${pkgname}" || exit
  git describe --abbrev=7 --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "${pkgname}" || exit

  git submodule init lib/freeglut
  git submodule init lib/glew
  git submodule init lib/zlib
  git submodule init lib/physfs
  git submodule init lib/GameNetworkingSockets
  git submodule init lib/protobuf
  git submodule init lib/libpng
  git submodule init lib/SDL
  git submodule init lib/SDL_mixer

  git config submodule.freeglut.url "${srcdir}"/freeglut
  git config submodule.glew.url "${srcdir}"/glew
  git config submodule.zlib.url "${srcdir}"/zlib
  git config submodule.physfs.url "${srcdir}"/physfs
  git config submodule.GameNetworkingSockets.url "${srcdir}"/GameNetworkingSockets
  git config submodule.protobuf.url "${srcdir}"/protobuf
  git config submodule.libpng.url "${srcdir}"/libpng
  git config submodule.SDL.url "${srcdir}"/SDL
  git config submodule.SDL_mixer.url "${srcdir}"/SDL_mixer

  git -c protocol.file.allow=always submodule update --init lib/freeglut
  git -c protocol.file.allow=always submodule update --init lib/glew
  git -c protocol.file.allow=always submodule update --init lib/zlib
  git -c protocol.file.allow=always submodule update --init lib/physfs
  git -c protocol.file.allow=always submodule update --init lib/GameNetworkingSockets
  git -c protocol.file.allow=always submodule update --init lib/protobuf
  git -c protocol.file.allow=always submodule update --init lib/libpng
  git -c protocol.file.allow=always submodule update --init lib/SDL
  git -c protocol.file.allow=always submodule update --init lib/SDL_mixer

  export LDFLAGS
  cmake -B ../"${pkgname}"-build -S . \
    -DCMAKE_CXX_COMPILER:STRING=clang++ \
    -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \
    -DCMAKE_C_COMPILER:STRING=clang \
    -DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
    -DCMAKE_SKIP_RPATH=ON \
    -Wno-dev
}

build() {
  cmake --build "${pkgname}"-build
}

package() {
  install -Dm755 "${srcdir}"/"${pkgname}"-build/openjkdf2 "${pkgdir}"/usr/bin/openjkdf2

  # Desktop file
  install -Dm755 "${srcdir}"/"${pkgname}"/packaging/flatpak/org.openjkdf2.OpenJKDF2.desktop "${pkgdir}"/usr/share/applications/org.openjkdf2.OpenJKDF2.desktop

  # Icons
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/16.png "${pkgdir}"/usr/share/icons/hicolor/16x16/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/24.png "${pkgdir}"/usr/share/icons/hicolor/24x24/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/32.png "${pkgdir}"/usr/share/icons/hicolor/32x32/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/48.png "${pkgdir}"/usr/share/icons/hicolor/48x48/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/64.png "${pkgdir}"/usr/share/icons/hicolor/64x64/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/96.png "${pkgdir}"/usr/share/icons/hicolor/96x96/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/128.png "${pkgdir}"/usr/share/icons/hicolor/128x128/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/192.png "${pkgdir}"/usr/share/icons/hicolor/192x192/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/256.png "${pkgdir}"/usr/share/icons/hicolor/256x256/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/384.png "${pkgdir}"/usr/share/icons/hicolor/384x384/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/flatpak/icons/512.png "${pkgdir}"/usr/share/icons/hicolor/512x512/apps/org.openjkdf2.OpenJKDF2.png
  install -Dm644 "${srcdir}"/"${pkgname}"/packaging/icon.png "${pkgdir}"/usr/share/icons/hicolor/1024x1024/apps/org.openjkdf2.OpenJKDF2.png

  # License
  install -Dm644 "${srcdir}"/"${pkgname}"/LICENSE.md "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
}