summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cf98c266aeca2417540d385007f29d8a91d62f97 (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
# Maintainer: Frederik Leonhardt <frederik at leonhardt dot co dot nz>
# Contributor: Brian Bidulock <bidulock@openss7.org>
# Contributor: Jesse Jaara <jesse.jaara@gmail.com>

pkgname=ldraw-parts-library
pkgver=20240701
pkgrel=1
pkgdesc="A collection of LDraw-format CAD files representing many of LEGO bricks produced"
arch=(any)
url="https://library.ldraw.org/updates"
license=('CCPL: cc-by-2.0')
options=(!strip)
source=("$pkgname-$pkgver.zip::https://library.ldraw.org/library/updates/complete.zip"
        "$pkgname.sh"
        "license")
sha256sums=('d320918996ce203570befb51acc13c7f56cdd9a2b4c1e7fcbd02961af6c12d28'
            '7cbd598861cc678e86ce07da220e97d0f9d27f2b8d0d03b794400b999fd6fc42'
            '783990d0de8daf6b0e18b1c06578438f7d70e106a1a351686872d8d6eeeba7ac')

xpkgver() {
  local version=$(grep -oP '^0 !LDRAW_ORG Configuration UPDATE \K.+$' "$srcdir/ldraw/LDConfig.ldr")
  echo ${version//[^0-9]/}
}

package() {
  cd "${srcdir}/ldraw/"

  # Install data
  mkdir -p                      "${pkgdir}/usr/share/ldraw"
  mv LDConfig.ldr               "${pkgdir}/usr/share/ldraw/"
  mv p                          "${pkgdir}/usr/share/ldraw/"
  mv parts                      "${pkgdir}/usr/share/ldraw/"

  # Fix permissions
  find "${pkgdir}/usr/share/ldraw" -type f -exec chmod 644 {} +
  find "${pkgdir}/usr/share/ldraw" -type d -exec chmod 755 {} +

  # Install the old version 2.0 CC-by license
  install -D -m644 ../license                "${pkgdir}/usr/share/licenses/${pkgname}/license"

  install -D -m755 ../ldraw-parts-library.sh "${pkgdir}/etc/profile.d/ldraw-parts-library.sh"
}