diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-07-25 21:24:37 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-07-25 21:24:37 -0400 |
commit | e89a74700c8a7db01f07a405f583e6399ba7da16 (patch) | |
tree | d45b73bf49bf9f05b39d6ff0d73cf9fe9aa931f2 | |
parent | 827be127213f3697f954dabf7cc67a5e075bed5e (diff) |
Add janino. Required creating a 'union' type for sources.mk.
-rw-r--r-- | Makefile | 22 | ||||
-rw-r--r-- | conf/dependencies.mk | 2 | ||||
-rw-r--r-- | conf/sources.mk | 5 | ||||
-rw-r--r-- | rules/janino/Makefile | 54 | ||||
-rw-r--r-- | rules/janino/delete.list | 2 |
5 files changed, 83 insertions, 2 deletions
@@ -35,13 +35,17 @@ dep_optdir = $(shell $(FIND) $1 2>/dev/null) # configuration ################################################################ -packages := $(filter-out _%,$(shell $(SED) "s/[\# ].*//" conf/sources.mk)) +# Load conf/sources.mk +variables := $(shell $(SED) "s/[\# ].*//" conf/sources.mk) include conf/sources.mk +# Load other configuration files include conf/dependencies.mk export MAVEN_LOCAL_REPO := $(shell $(CAT) conf/maven.local.repo.txt) export JAR_DIR := $(shell $(CAT) conf/jardir.txt) -specs := $(foreach package,$(packages),$($(package))) +# Post-processing for conf/sources.mk +packages := $(filter-out _%,$(variables)) +specs := $(foreach variable,$(variables),$(findstring |,$($(variable)))) tarbombs := $(addprefix build/extract/,$(call spec2,base,$(_tarbombs))) # download ##################################################################### @@ -118,6 +122,12 @@ build/extract/tar/%: # magic foreach loop ( cd '$(_tar_basedir)' && $(TAR) -m $(if $(filter $(_tar_basedir),$(tarbombs)),,--strip-components 1) -xf '$(top)/$<' ); \ } || { $(RM) -r '$(_tar_basedir)'; $(FAIL); } +# union +build/extract/union/%: # magic foreach loop + $(RM) -r '$@' + $(MKDIRS) '$@' && $(CP) -a $(foreach d,$(filter build/extract/%,$^),'$d'/*) '$@/' || { $(RM) -r '$@'; $(FAIL); } + $(TOUCH) '$@' + # magic foreach loop (git, tar) $(foreach spec,$(call specs_for,git tar), \ $(eval \ @@ -126,6 +136,14 @@ $(foreach spec,$(call specs_for,git tar), \ ) \ ) +# magic foreach loop (union) +$(foreach spec,$(call specs_for,union), \ + $(eval \ + build/extract/$(call spec2,file,$(spec)): \ + $(addprefix build/extract/,$(call name2,file,$(subst :, ,$(call spec2,url,$(spec))))) \ + ) \ + ) + # place (patch) ################################################################ place: PHONY $(addprefix build/workdir/,$(packages)) diff --git a/conf/dependencies.mk b/conf/dependencies.mk index a0058fa..108bfc5 100644 --- a/conf/dependencies.mk +++ b/conf/dependencies.mk @@ -214,6 +214,8 @@ build/packages/wagon: \ build/packages/jsoup \ build/packages/plexus-interactivity \ build/packages/plexus-utils +build/packages/janino: \ + /opt/apache-ant/lib/ant.jar build/packages/jarjar: \ build/packages/asm4 \ build/packages/maven-plugin-api-bootstrap diff --git a/conf/sources.mk b/conf/sources.mk index 629d6ef..cf732ba 100644 --- a/conf/sources.mk +++ b/conf/sources.mk @@ -92,6 +92,11 @@ qdox = tar|https://nexus.codehaus.org/co slf4j-api = tar|http://www.slf4j.org/dist/slf4j-1.7.7.tar.gz|slf4j-api # HTTPS is mis-configured wagon = tar|$(_apache_mirror)/maven/wagon/wagon-2.6-source-release.zip +# Janino +_janino-part1 = svn|https://svn.codehaus.org/janino|tags/janino_2.7.5 +_janino-part2 = svn|https://svn.code.sf.net/p/loggifier/code|tags/janino_2.7.5 +janino = union|_janino-part1:_janino-part2 + eclipselink-persistence20 = tar|https://git.eclipse.org/c/eclipselink/javax.persistence.git/snapshot/javax.persistence-2.0.6.v201308211412.tar.gz eclipselink-persistence21 = tar|https://git.eclipse.org/c/eclipselink/javax.persistence.git/snapshot/javax.persistence-2.1.0.v201304241213.tar.gz sisu-inject-bootstrap = tar|https://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/snapshot/releases/0.2.1.tar.gz|0.2.1 diff --git a/rules/janino/Makefile b/rules/janino/Makefile new file mode 100644 index 0000000..042e6f3 --- /dev/null +++ b/rules/janino/Makefile @@ -0,0 +1,54 @@ +DESTDIR ?= +MAVEN_LOCAL_REPO ?= ~/.m2 + +ANT = ant +EXISTS = test -e +FAIL = exit 1 +FIND = find +INSTALL = install +MKDIRS = mkdir -p +RM = rm -f +SED = sed +TOUCH = touch +XMLSTARLET = xml + +pom_get = $(shell $(XMLSTARLET) sel -T -t $(foreach xpath,$1, -v '$(subst /,/_:,$(xpath))' -n) janino-dist/poms/$(artifactId).pom) + +version := $(shell $(SED) -n 's/^version\s*=\s*//p' janino-dist/build.properties) +artifactIds := $(patsubst janino-dist/poms/%.pom,%,$(wildcard janino-dist/poms/*.pom)) +groupId = $(firstword $(call pom_get,/project/groupId /project/parent/groupId)) + +findjar = $(firstword $(foreach path,$(subst :, ,$(CLASSPATH)),$(if $(findstring $1,$(path)),$(path))) /notfound.jar) +ant_jar = $(call findjar,ant) + +all: PHONY $(foreach a,$(artifactIds),janino-dist/build/$a.jar .poms/$a-$(version).jar) + +ignore = .poms build mirror +janino-dist/build: $(shell $(FIND) . -mindepth 1 $(foreach d,$(ignore),-name $d -prune -o) -name '* *' -prune -o -print) + $(SED) -ri 's|^(ant\.jar\s*=).*|\1 $(ant_jar)|' janino-dist/build.properties && \ + cd janino-dist && $(ANT) || { $(RM) -r $@; $(FAIL); } + $(TOUCH) $@ +janino-dist/build/%.jar: janino-dist/build + $(EXISTS) $@ || { $(RM) -r $<; $(FAIL); } + $(TOUCH) $@ + +.poms/%-$(version).pom: janino-dist/poms/%.pom + $(MKDIRS) $(@D) + $(SED) 's|@VERSION@|$(version)|' < $< > $@ + +install-base = $(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(groupId))/$(artifactId)/$(version)/$(artifactId)-$(version) +install-jars = $(foreach artifactId,$(filter-out %-parent,$(artifactIds)),$(install-base).jar) +install-poms = $(foreach artifactId, $(artifactIds) ,$(install-base).pom) +install-targets = $(install-jars) $(install-poms) +install: PHONY $(install-targets) + +$(foreach artifactId,$(artifactIds), \ + $(eval $(install-base).jar: janino-dist/build/$(artifactId).jar ; $$(INSTALL) -Dm644 $$< $$@) \ + $(eval $(install-base).pom: .poms/$(artifactId)-$(version).pom ; $$(INSTALL) -Dm644 $$< $$@) ) + +clean: PHONY + $(RM) -r .poms janino-dist/build + +.PHONY: PHONY +.DELETE_ON_ERROR: +.SECONDARY: diff --git a/rules/janino/delete.list b/rules/janino/delete.list new file mode 100644 index 0000000..a324a9a --- /dev/null +++ b/rules/janino/delete.list @@ -0,0 +1,2 @@ +janino-dist/lib/*.jar +janino/lib/*.jar |