summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Perez de Castro2019-07-08 15:02:43 +0300
committerAdrian Perez de Castro2019-07-08 15:02:43 +0300
commitc044396d8330940b4d2f8361dc4e127725afc59b (patch)
tree68a93875ea27da3e2457d95b5f5d33b9efcb6592
downloadaur-c044396d8330940b4d2f8361dc4e127725afc59b.tar.gz
Initial import
-rw-r--r--.SRCINFO16
-rw-r--r--.gitignore4
-rw-r--r--PKGBUILD80
3 files changed, 100 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..33f8c7e186e1
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = cproc-git
+ pkgdesc = Small C11 compiler using QBE as backend
+ pkgver = r352.f2e5c6f
+ pkgrel = 1
+ url = https://git.sr.ht/~mcf/cproc
+ arch = x86_64
+ license = custom
+ makedepends = git
+ depends = gcc
+ source = cproc-git::git+https://git.sr.ht/~mcf/cproc
+ source = cproc-git-qbe::git+https://git.sr.ht/~mcf/qbe
+ sha512sums = SKIP
+ sha512sums = SKIP
+
+pkgname = cproc-git
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..218620e2fb38
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*
+!/PKGBUILD
+!/.SRCINFO
+!/.gitignore
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..5b5a7672a736
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,80 @@
+# Maintainer: Adrian Perez de Castro <aperez@igalia.com>
+pkgname=cproc-git
+pkgdesc='Small C11 compiler using QBE as backend'
+pkgver=r352.f2e5c6f
+pkgrel=1
+url='https://git.sr.ht/~mcf/cproc'
+makedepends=(git)
+arch=(x86_64)
+depends=(gcc)
+license=(custom)
+source=("${pkgname}::git+${url}"
+ "${pkgname}-qbe::git+https://git.sr.ht/~mcf/qbe")
+sha512sums=(SKIP
+ SKIP)
+
+pkgver ()
+{
+ cd "${pkgname}"
+ (
+ set -o pipefail
+ git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+ )
+}
+
+prepare ()
+{
+ cd "${pkgname}"
+ git submodule init
+ git config submodule.qbe "${srcdir}/${pkgname}-qbe"
+ git submodule update
+}
+
+build ()
+{
+ cd "${pkgname}"
+
+ local ldso_option
+ case ${CARCH} in
+ x84_64) ldso_option='--with-ldso=/lib/ld-linux-x86-64.so.2' ;;
+ i686) ldso_option='--with-ldso=/lib/ld-linux.so.2' ;;
+ *) msg2 'Letting cproc choose the dynamic linker path' ;;
+ esac
+
+ # cproc needs a version of qbe with a few fixes, which gets built
+ # first and installed as cproc-qbe-backend. This needs to be available
+ # also during bootstrap.
+ msg2 'Building qbe...'
+ make -C qbe LDFLAGS='-s'
+ ln -nf qbe/obj/qbe cproc-qbe-backend
+
+ msg2 'Cleaning cproc...'
+ make clean
+
+ msg2 'Building cproc...'
+ ./configure \
+ --with-cpp=cpp \
+ --with-qbe=cproc-qbe-backend \
+ --with-as=as \
+ --with-ld=ld \
+ ${ldso_option}
+
+ PATH="$(pwd):${PATH}" make bootstrap CFLAGS='' LDFLAGS='-s'
+}
+
+package ()
+{
+ cd "${pkgname}"
+ install -Dm755 stage3/cproc "${pkgdir}/usr/bin/cproc"
+ install -Dm755 stage3/cproc-qbe "${pkgdir}/usr/bin/cproc-qbe"
+ install -Dm755 qbe/obj/qbe "${pkgdir}/usr/bin/cproc-qbe-backend"
+
+ install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.cproc"
+ install -Dm644 qbe/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.qbe"
+
+ for filename in README.md doc/*.md ; do
+ install -Dm644 README.md \
+ "${pkgdir}/usr/share/doc/${pkgname}/${filename##*/}"
+ done
+}