| 6 | 6 |
PKD = $(abspath $(dir $(MAKEFILE_LIST)))
|
| 7 | 7 |
SRCPKG = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
|
| 8 | 8 |
BINPKG = lib$(SRCPKG)-java
|
| 9 | |
PKGVER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog -SVersion | cut -d- -f1)
|
| 10 | |
SBTVER ?= $(shell grep sbt.version= $(CURDIR)/project/build.properties | sed 's/.*=//')
|
| 11 | |
URL = https://dl.bintray.com/sbt/native-packages/sbt/$(SBTVER)/sbt-$(SBTVER).tgz
|
| 12 | |
|
| 13 | |
PKG_ORIG = $(CURDIR)/../$(SRCPKG)_$(PKGVER).orig.tar.gz
|
| 14 | |
BOOTSTRAP_SBT = $(CURDIR)/../$(SRCPKG)_$(PKGVER).orig-bootstrapsbt.tar.xz
|
| 15 | |
BOOTSTRAP_DEPS = $(CURDIR)/../$(SRCPKG)_$(PKGVER).orig-bootstrapdeps.tar.xz
|
| 16 | |
BOOTSTRAP_DEPS_SOURCES = $(CURDIR)/../$(SRCPKG)_$(PKGVER).orig-bootstrapdeps-sources.tar.xz
|
| 17 | 9 |
|
| 18 | 10 |
%:
|
| 19 | 11 |
dh $@ --with javahelper --with maven_repo_helper
|
|
| 31 | 23 |
override_dh_clean:
|
| 32 | 24 |
rm -fr .git $(SBTHOME) project/project $(shell find ./ -name target -type d) debian/$(BINPKG).poms
|
| 33 | 25 |
dh_clean
|
| 34 | |
|
| 35 | |
.PHONY: get-orig-source
|
| 36 | |
|
| 37 | |
get-orig-source: $(PKG_ORIG) $(BOOTSTRAP_DEPS) $(BOOTSTRAP_DEPS_SOURCES)
|
| 38 | |
|
| 39 | |
$(PKG_ORIG):
|
| 40 | |
@echo
|
| 41 | |
@echo "Downloading latest $(SRCPKG)-$(PKGVER)"
|
| 42 | |
uscan --noconf --verbose --rename --check-dirname-level=0 --download-version $(PKGVER) $(PKD)
|
| 43 | |
|
| 44 | |
$(BOOTSTRAP_SBT):
|
| 45 | |
@echo
|
| 46 | |
@echo "Fetching sbt binary for bootstrap"
|
| 47 | |
wget -q $(URL)
|
| 48 | |
rm -fr bootstrapsbt
|
| 49 | |
mkdir bootstrapsbt
|
| 50 | |
tar -C bootstrapsbt --strip-components=1 -zxf sbt-$(SBTVER).tgz
|
| 51 | |
tar -JcC bootstrapsbt -f $(BOOTSTRAP_SBT) .
|
| 52 | |
rm -fr sbt-$(SBTVER).tgz
|
| 53 | |
|
| 54 | |
$(BOOTSTRAP_DEPS) $(BOOTSTRAP_DEPS_SOURCES): $(BOOTSTRAP_SBT)
|
| 55 | |
@echo
|
| 56 | |
@echo "Fetching online sbt project build dependancies"
|
| 57 | |
rm -fr bootstrapsbt bootstrapdeps-sources
|
| 58 | |
mkdir bootstrapsbt
|
| 59 | |
tar -Jx -C bootstrapsbt -f $(BOOTSTRAP_SBT)
|
| 60 | |
mkdir -p $(SBTHOME)/.ivy2/cache
|
| 61 | |
mkdir $(SBTHOME)/.sbt
|
| 62 | |
$(SBTCMD) update
|
| 63 | |
#$(SBTCMD) update updateSbtClassifiers
|
| 64 | |
# "update" compiles compiler-interface jar with the scala defined by
|
| 65 | |
# the project, so we remove it and store all jar srcs into a dedicated
|
| 66 | |
# debian source component that will be copied before compiling the
|
| 67 | |
# whole project, including the compiler-interface jar
|
| 68 | |
# After bootstrap, we intend to provide this compiler-interface, built
|
| 69 | |
# with debian's scala
|
| 70 | |
rm -fr $(SBTHOME)/.ivy2/cache/org.scala-sbt/org.scala-sbt-compiler-interface-*
|
| 71 | |
# .properties and .xml.original will be regenerated and that will avoid unnecessary debian/copyright work
|
| 72 | |
find $(SBTHOME)/.ivy2/cache \( -name '*.properties' -o -name '*.xml.original' \) -delete
|
| 73 | |
# remove path with no jar file
|
| 74 | |
find $(SBTHOME)/.ivy2/cache/ -name '*.xml' |while read DIR; do \
|
| 75 | |
if [ ! -d $${DIR%/*}/jars -a ! -d $${DIR%/*}/bundles -a ! -d $${DIR%/*}/orbits ]; then rm -fr $${DIR%/*}; fi done
|
| 76 | |
cd $(SBTHOME)/.ivy2/cache ; find . -type d -name 'srcs'| while read DIR; do \
|
| 77 | |
mkdir -p $(CURDIR)/bootstrapdeps-sources/$$DIR ; \
|
| 78 | |
mv $$DIR/* $(CURDIR)/bootstrapdeps-sources/$$DIR ; \
|
| 79 | |
rm -fr $$DIR ; \
|
| 80 | |
done
|
| 81 | |
tar -JcC $(SBTHOME)/.ivy2/cache/ -f $(BOOTSTRAP_DEPS) .
|
| 82 | |
tar -Jc -f $(BOOTSTRAP_DEPS_SOURCES) bootstrapdeps-sources
|