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

pkgbase='cse2-git'
pkgname=('cse2-english-git' 'cse2-japanese-git')
pkgver=2.2.portable.r42.gb9d9d33
pkgrel=1
pkgdesc="Decompilation of Cave Story"
arch=('i686' 'x86_64')
url='https://github.com/gameblabla/CSE2'
license=('MIT')
makedepends=(
  'cmake'
  'git'
  'ttf-dejavu'
  'ttf-hanazono'
)
depends=(
  'freetype2'
  'glfw'
  'hicolor-icon-theme'
  'sdl2'
)
source=("${pkgbase}::git+https://github.com/gameblabla/CSE2.git"
        'cse2-english-config.desktop'
        'cse2-english.desktop'
        'cse2-japanese-config.desktop'
        'cse2-japanese.desktop'
        'path_fix.patch'
)
sha256sums=('SKIP'
            '1116039b58de5dc1408baa9cb03954ada49bf998effc1878e18226e84259a60c'
            'ef673a2fa3fb49efa4f891ac2a56aff99091a08da814db3a8f4561e07592cff5'
            '0b89785327c2a3246672cd8030963488d35b24463c1429cf6a376fe77d79fd81'
            '8d5807af588dbc24548b150ef90d1ec6d9e0bc69c294ae7a10d931507de995c5'
            'd44e9d5e7bbefd905531dfe5ba77154445958e5974074fae601c3c614bb6e3d5'
)

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

prepare() {
  patch -d "${pkgbase}" -Np1 < path_fix.patch
}

build() {
  export LDFLAGS

  # English
  cmake -B build -S "${pkgbase}" \
    -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS} -Wno-error=format-security" \
    -DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
    -DFIX_BUGS:BOOL=ON \
    -DFREETYPE_FONTS:BOOL=ON \
    -DLANCZOS_RESAMPLER:BOOL=ON \
    -Wno-dev
  cmake --build build

  # Japanese
  cmake -B build -S "${pkgbase}" \
    -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS} -Wno-error=format-security" \
    -DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
    -DFIX_BUGS:BOOL=ON \
    -DFREETYPE_FONTS:BOOL=ON \
    -DJAPANESE:BOOL=ON \
    -DLANCZOS_RESAMPLER:BOOL=ON \
    -Wno-dev
  cmake --build build
}

package_cse2-english-git() {
  conflicts=('cse2-english')
  provides=('cse2-english')
  depends+=('ttf-dejavu')

  pushd "${srcdir}"/"${pkgbase}"/game_english || return
  find data -type f -exec install -Dm644 {} "${pkgdir}"/usr/share/cse2/english/{} \;
  rm -rf "${pkgdir}"/usr/share/cse2/english/data/Font/*
  ln -s /usr/share/fonts/TTF/DejaVuSansMono.ttf "${pkgdir}"/usr/share/cse2/english/data/Font/font

  install -Dm755 "${srcdir}"/"${pkgbase}"/game_english/CSE2 "${pkgdir}"/usr/bin/cse2-english
  install -Dm755 "${srcdir}"/"${pkgbase}"/game_english/DoConfig "${pkgdir}"/usr/bin/cse2-english-config

  # Desktop files
  install -Dm755 "${srcdir}"/cse2-english.desktop "${pkgdir}"/usr/share/applications/cse2-english.desktop
  install -Dm755 "${srcdir}"/cse2-english-config.desktop "${pkgdir}"/usr/share/applications/cse2-english-config.desktop

  # Icon
  install -Dm644 "${srcdir}"/"${pkgbase}"/assets/resources/ICON/ICON_MINI.png "${pkgdir}"/usr/share/icons/hicolor/64x64/apps/cse2-english.png

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

package_cse2-japanese-git() {
  conflicts=('cse2-japanese')
  provides=('cse2-japanese')
  depends+=('ttf-hanazono')

  pushd "${srcdir}"/"${pkgbase}"/game_japanese || return
  find data -type f -exec install -Dm644 {} "${pkgdir}"/usr/share/cse2/japanese/{} \;
  rm -rf "${pkgdir}"/usr/share/cse2/japanese/data/Font/*
  ln -s /usr/share/fonts/TTF/HanaMinA.ttf "${pkgdir}"/usr/share/cse2/japanese/data/Font/font

  install -Dm755 "${srcdir}"/"${pkgbase}"/game_japanese/CSE2 "${pkgdir}"/usr/bin/cse2-japanese
  install -Dm755 "${srcdir}"/"${pkgbase}"/game_japanese/DoConfig "${pkgdir}"/usr/bin/cse2-japanese-config

  # Desktop files
  install -Dm755 "${srcdir}"/cse2-japanese.desktop "${pkgdir}"/usr/share/applications/cse2-japanese.desktop
  install -Dm755 "${srcdir}"/cse2-japanese-config.desktop "${pkgdir}"/usr/share/applications/cse2-japanese-config.desktop

  # Icon
  install -Dm644 "${srcdir}"/"${pkgbase}"/assets/resources/ICON/ICON_MINI.png "${pkgdir}"/usr/share/icons/hicolor/64x64/apps/cse2-japanese.png

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