summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3ffb3d7c8557ce5ccceba7a796147740b2b56922 (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
# Maintainer: Edmund Lodewijks <e.lodewijks@gmail.com>
# Contributor: MayorBender <7480812+kingy9000@users.noreply.github.com>
# Contributor: Dan Beste <dan.ray.beste@gmail.com>
# Contributor: Justine Paul <jestine-paul@dsi.a-star.edu.sg>

pkgname='libcs50-git'
_gitname='libcs50'
pkgver=11.0.2.r0.g6d916ef
pkgrel=2
pkgdesc="CS50 Library for C (development version)"
arch=('x86_64' 'i686')
url="https://github.com/cs50/libcs50"
license=('GPL-3.0-only')
groups=('cs50')
makedepends=('git')
optdepends=('clang: compiler currently used in CS50x course (2023)')
provides=("${_gitname}")
conflicts=("${_gitname}")
source=(
  'git+https://github.com/cs50/libcs50.git#branch=main'
  'Makefile.patch'
)
sha256sums=(
  'SKIP'
  '4a10efd4f4f6b6bb18152a4f28497f7f8562aaa5aaf50c401d308827b922ef3f'
)
install=libcs50.install

pkgver() {
  cd "${_gitname}"

  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "${_gitname}"

  patch < "${srcdir}/Makefile.patch"
#  patch < "${srcdir}/Makefile-CFLAGS.patch"
}

build() {
  cd "${_gitname}"

  # TODO: Get this fixed upstream. We should not have to unset our $CFLAGS and
  #       $MAKEFLAGS.
  CFLAGS= MAKEFLAGS= make
  make
}

package() {
  cd "${_gitname}"

  # TODO: Get this fixed upstream. We should not have to unset our $CFLAGS and
  #       $MAKEFLAGS.
  CCFLAGS= MAKEFLAGS= DESTDIR="${pkgdir}/usr" make install
  DESTDIR="${pkgdir}/usr" make install

  rm "${pkgdir}/usr/src/cs50.c"
  install -d -m 755 "${pkgdir}/usr/src/libcs50"
  install -m 644 src/cs50.c src/cs50.h -t "${pkgdir}/usr/src/libcs50"
}

# vim: ts=2 sw=2 et: