Package Details: chibicc-git 20240805-1

Git Clone URL: https://aur.archlinux.org/chibicc-git.git (read-only, click to copy)
Package Base: chibicc-git
Description: Small C11 compiler
Upstream URL: https://github.com/rui314/chibicc
Licenses: MIT
Submitter: vinibali
Maintainer: vinibali
Last Packager: vinibali
Votes: 3
Popularity: 0.051273
First Submitted: 2020-12-02 21:29 (UTC)
Last Updated: 2024-08-05 19:17 (UTC)

Latest Comments

andreas_baumann commented on 2024-08-05 14:54 (UTC)

No hurry, works for me. :-)

vinibali commented on 2024-08-04 19:02 (UTC)

Thanks for the update, I'll get back to you at the next week!

andreas_baumann commented on 2024-08-01 08:49 (UTC) (edited on 2024-08-01 08:50 (UTC) by andreas_baumann)

The package cannot compile a test program. The header files are not installed.

The search path is argv[]/./include (which is fine for tests) and some standard pathes like /usr/include, /usr/local/include (all in main.c).

I added a patch to put the chibicc header files in a directory /usr/lib/chibicc/include:

PKGBUILD:

# Maintainer: Balazs Vinarz <vinibali1@gmail.com>

pkgname=chibicc-git
pkgver=$(date +"%Y%m%d")
pkgrel=1
pkgdesc='Small C11 compiler'
arch=(i686 x86_64 armv7h aarch64)
url='https://github.com/rui314/chibicc'
license=(MIT)
depends=(glibc)
makedepends=(git)
source=(https://github.com/rui314/chibicc/archive/main.zip
        chibicc-include-path.patch)
sha1sums=('SKIP' '56dd39961e9511081fbbdb0fa9fdd7b672d51b29')

prepare() {
  cd "${srcdir}"/"chibicc-main"
  patch -Np1 -i "$srcdir/chibicc-include-path.patch"
}

build() {
  cd "${srcdir}"/"chibicc-main"
  make
}

check() {
  cd "${srcdir}"/"chibicc-main"
  make test
}

package() {
  cd "${srcdir}"/"chibicc-main"

  install -Dm755 chibicc "$pkgdir/usr/bin/chibicc"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -dm755 "$pkgdir/usr/lib/chibicc/include"
  install -Dm755 include/* "$pkgdir/usr/lib/chibicc/include"
}

chibicc-include-path.patch:

diff -rauN chibicc-main/main.c chibicc-include-path-patch/main.c
--- chibicc-main/main.c 2020-12-07 04:00:06.000000000 +0100
+++ chibicc-include-path-patch/main.c   2024-08-01 10:38:28.167596211 +0200
@@ -55,6 +55,8 @@
   // to ./include relative to argv[0].
   strarray_push(&include_paths, format("%s/include", dirname(strdup(argv0))));

+  strarray_push(&include_paths, "/usr/lib/chibicc/include");
+
   // Add standard include paths.
   strarray_push(&include_paths, "/usr/local/include");
   strarray_push(&include_paths, "/usr/include/x86_64-linux-gnu");