[vala] Host parvala in git
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Host parvala in git
- Date: Sat, 11 Sep 2010 18:14:57 +0000 (UTC)
commit f873e355a2ee830a397fda4e70c4c04652c14238
Author: Ryan Lortie <desrt desrt ca>
Date: Sat Sep 11 14:14:31 2010 -0400
Host parvala in git
contrib/parvala/parvala | 55 ++++++++++++++++++++++++++++++++++++++++++++
contrib/parvala/parvala.mk | 30 ++++++++++++++++++++++++
2 files changed, 85 insertions(+), 0 deletions(-)
---
diff --git a/contrib/parvala/parvala b/contrib/parvala/parvala
new file mode 100755
index 0000000..db53b8f
--- /dev/null
+++ b/contrib/parvala/parvala
@@ -0,0 +1,55 @@
+#!/bin/sh -e
+
+VALAC=valac
+JOBS=10
+
+####
+
+
+VALAFLAGS=''
+makeflags=''
+
+while test -n "$*"; do
+ case "$1" in
+ --version) echo -n par; exec ${VALAC} --version;;
+ --disable-version-header) VALAFLAGS="${VALAFLAGS} $1";;
+ --vapidir) shift; VALAFLAGS="${VALAFLAGS} --vapidir $1";;
+ --pkg) shift; VALAFLAGS="${VALAFLAGS} --pkg $1";;
+ *.vala) valafiles="${valafiles} $1";;
+ --library) shift; vapi_file="$1";;
+ --directory=*) VALAFLAGS="${VALAFLAGS} $1";;
+ --basedir=*) VALAFLAGS="${VALAFLAGS} $1";;
+ --enable-checking) VALAFLAGS="${VALAFLAGS} $1";;
+ --thread) VALAFLAGS="${VALAFLAGS} $1";;
+ --pkg=*) VALAFLAGS="${VALAFLAGS} $1";;
+ --vapidir=*) VALAFLAGS="${VALAFLAGS} $1";;
+ -X) shift; VALAFLAGS="${VALAFLAGS} -X $1";;
+ -g) VALAFLAGS="${VALAFLAGS} $1";;
+ -d) shift; makeflags="${makeflags} DIRECTORY=$1/";;
+ -H) shift; h_file="$1";;
+ --ccode) c_mode="yes";;
+ -C) c_mode="yes";;
+ *) echo "parvala: unrecognised argument: $1"; exit 1;;
+ esac
+ shift
+done
+
+if test -n "${h_file}"; then
+ if test -n "${vapi_file}"; then
+ makeflags="${makeflags} OUT_VAPI=${vapi_file}"
+ fi
+ makeflags="${makeflags} OUT_HFILE=${h_file}"
+else
+ if test -n "${vapi_file}"; then
+ echo 'parvala: --library requires -H to also be specified'
+ fi
+fi
+
+if test -z "${c_mode}"; then
+ echo 'parvala: required argument -C not specified'
+ exit 1
+fi
+
+make -j${JOBS} -f `dirname $0`/../share/parvala/parvala.mk \
+ VALAC="${VALAC}" VALAFLAGS="${VALAFLAGS}" \
+ VALAFILES="${valafiles}" ${makeflags}
diff --git a/contrib/parvala/parvala.mk b/contrib/parvala/parvala.mk
new file mode 100644
index 0000000..cd0938d
--- /dev/null
+++ b/contrib/parvala/parvala.mk
@@ -0,0 +1,30 @@
+VALA_AUX = $(DIRECTORY).vala-aux/
+
+.PHONY: all-vapi
+
+BASENAMES = $(notdir $(basename $(VALAFILES)))
+VALA_FASTVAPI_FILES = $(foreach f, $(BASENAMES), $(VALA_AUX)$(f).vapi)
+VALA_FASTVAPI_STAMPS = $(foreach f, $(BASENAMES), $(VALA_AUX)$(f).vapi.stamp)
+VALA_DEPS = $(foreach f, $(BASENAMES), $(VALA_AUX)$(f).dep)
+
+all: $(VALA_DEPS) $(OUT_HFILE)
+
+.PRECIOUS: $(VALA_AUX)%.vapi.stamp $(VALA_AUX)%.dep
+
+$(VALA_AUX)%.vapi: ;
+
+$(VALA_AUX)%.vapi.stamp: $(DIRECTORY)%.vala | $(VALA_AUX)
+ @echo ' GEN '$(@:.stamp=); $(VALAC) --fast-vapi=$(@:.stamp=) $< && touch $@
+
+$(VALA_AUX)%.dep: $(DIRECTORY)%.vala | $(VALA_FASTVAPI_STAMPS)
+ @echo ' GEN '$(<:.vala=.c); $(VALAC) -C --deps=$@ $(VALAFLAGS) $(addprefix --use-fast-vapi=,$(subst $(VALA_AUX)$(notdir $(basename $@)).vapi,, $(VALA_FASTVAPI_FILES))) $<
+
+$(VALA_AUX):
+ @mkdir -p $(VALA_AUX)
+
+include $(wildcard $(VALA_AUX)/*.dep)
+
+ifdef OUT_HFILE
+$(OUT_HFILE) $(addsuffix .vapi,$(OUT_VAPI)): $(VALA_FASTVAPI_FILES) | $(VALA_FASTVAPI_STAMPS)
+ @echo ' GEN '$(OUT_HFILE) $(addsuffix .vapi,$(OUT_VAPI)); $(VALAC) -C -H $(OUT_HFILE) $(addprefix --library=,$(OUT_VAPI)) $(VALAFLAGS) $(addprefix --use-fast-vapi=,$(VALA_FASTVAPI_FILES)) && touch $(OUT_HFILE)
+endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]