#!/usr/bin/make -f export JAVA_HOME=/usr/lib/jvm/default-java export CLASSPATH=/usr/share/java/gettext-commons.jar:/usr/share/java/signpost-core.jar:/usr/share/java/jmapviewer.jar SVNREPO := https://josm.openstreetmap.de/svn/trunk SVNI18NREPO := https://svn.openstreetmap.org/applications/editors/josm/i18n/ DATE := $(shell date +%Y%m%d) ifdef SVNREV VERSION := 0.0.svn${SVNREV} else VERSION := 0.0.0.${DATE} endif DESTDIR := ../tarballs/josm-${VERSION} DESTTGZ := ../tarballs/josm_${VERSION}+dfsg.orig.tar.gz include /usr/share/dpkg/pkg-info.mk DEB_UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | cut -d- -f1) IMGSTYLES_DIR := $(CURDIR)/debian/josm/usr/share/josm/images/styles # Docs are already included in the jar file and can be accessed from within josm. #DEB_INSTALL_DOCS_ALL := %: dh $@ override_dh_auto_build: # Move translation causing build failure out of the way mv i18n/po/ca@valencia.po . dh_auto_build -- -v -d -Ddebian.version=${DEB_VERSION} dist mv ca@valencia.po i18n/po/ override_dh_auto_install: dh_auto_install install -o root -g root -m 644 $(CURDIR)/dist/josm-custom.jar $(CURDIR)/debian/josm/usr/share/josm/josm-${DEB_UPSTREAM_VERSION}.jar dh_link usr/share/josm/josm-${DEB_UPSTREAM_VERSION}.jar usr/share/josm/josm.jar install -o root -g root -m 755 $(CURDIR)/native/linux/tested/usr/bin/josm $(CURDIR)/debian/josm/usr/bin/josm install -o root -g root -d $(CURDIR)/debian/josm/etc/default install -o root -g root -m 644 $(CURDIR)/native/linux/tested/etc/default/josm $(CURDIR)/debian/josm/etc/default/josm for size in 512x512 256x256 192x192 128x128 96x96 80x80 72x72 64x64 48x48 42x42 40x40 36x36 32x32 24x24 22x22 16x16 8x8; do \ install -o root -g root -d $(CURDIR)/debian/josm/usr/share/icons/hicolor/$${size}/apps ; \ install -o root -g root -m 644 $(CURDIR)/native/linux/tested/usr/share/icons/hicolor/$${size}/apps/org.openstreetmap.josm.png $(CURDIR)/debian/josm/usr/share/icons/hicolor/$${size}/apps/org.openstreetmap.josm.png ; \ done install -o root -g root -d $(CURDIR)/debian/josm/usr/share/icons/hicolor/scalable/apps install -o root -g root -m 644 $(CURDIR)/native/linux/tested/usr/share/icons/hicolor/scalable/apps/org.openstreetmap.josm.svg $(CURDIR)/debian/josm/usr/share/icons/hicolor/scalable/apps/org.openstreetmap.josm.svg install -o root -g root -m 644 $(CURDIR)/native/linux/tested/usr/share/pixmaps/org.openstreetmap.josm.png $(CURDIR)/debian/josm/usr/share/pixmaps/org.openstreetmap.josm.png install -o root -g root -m 644 $(CURDIR)/native/linux/tested/usr/share/applications/org.openstreetmap.josm.desktop $(CURDIR)/debian/josm/usr/share/applications/org.openstreetmap.josm.desktop install -o root -g root -m 644 $(CURDIR)/native/linux/tested/usr/share/metainfo/org.openstreetmap.josm.appdata.xml $(CURDIR)/debian/josm/usr/share/metainfo/org.openstreetmap.josm.appdata.xml install -o root -g root -d $(CURDIR)/debian/josm/usr/share/mime/packages install -o root -g root -m 644 $(CURDIR)/native/linux/tested/usr/share/mime/packages/josm.xml $(CURDIR)/debian/josm/usr/share/mime/packages override_dh_install: dh_install --list-missing # remove *.lang files, since we ship them in josm-l10n rm -rf $(CURDIR)/debian/josm/usr/share/josm/data/*.lang # remove executable bit chmod a-x $(CURDIR)/debian/josm/usr/share/josm/data/defaultpresets.xml # remove empty directory [ -z "$(ls ${IMGSTYLES_DIR} 2> /dev/null)" ] && rm -rf ${IMGSTYLES_DIR} rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/josm/usr/share/josm/data/security/ get-orig-source: dh_testdir test -d ../tarballs/. || mkdir -p ../tarballs @echo Downloading josm from ${SVNREPO} svn export -r ${SVNREV} ${SVNREPO} ${DESTDIR} @echo Removing duplicated code rm -rf ${DESTDIR}/src/com/google ${DESTDIR}/src/oauth ${DESTDIR}/src/org/apache/commons/compress ${DESTDIR}/src/org/apache/commons/logging @echo Downloading source JAR wget https://josm.openstreetmap.de/download/josm-snapshot-${SVNREV}-sources.jar -O /tmp/josm-sources.jar @echo Extracting sources from JAR cd ${DESTDIR}/src && jar -xf /tmp/josm-sources.jar ch/poole com/drew javax/json org/apache/commons/jcs org/glassfish org/tukaani && cd $$OLDPWD cd ${DESTDIR}/resources && jar -xf /tmp/josm-sources.jar META-INF/resources/webjars/tag2link && cd $$OLDPWD find ${DESTDIR}/resources/META-INF/resources/webjars/tag2link -type f -not -name index.json -delete @echo Downloading xmpcore source JAR wget https://repo1.maven.org/maven2/com/adobe/xmp/xmpcore/6.1.10/xmpcore-6.1.10-sources.jar -O /tmp/xmpcore-sources.jar @echo Extracting xmpcore sources from JAR cd ${DESTDIR}/src && jar -xf /tmp/xmpcore-sources.jar com/adobe && cd $$OLDPWD @echo Downloading annotations source JAR wget https://repo1.maven.org/maven2/org/jetbrains/annotations/19.0.0/annotations-19.0.0-sources.jar -O /tmp/annotations-sources.jar @echo Extracting annotations sources from JAR cd ${DESTDIR}/src && jar -xf /tmp/annotations-sources.jar org/jetbrains && cd $$OLDPWD @echo Fetching revision metadata svn info --xml -r ${SVNREV} ${SVNREPO} > ${DESTDIR}/REVISION @echo Fetching internalization data svn export ${SVNI18NREPO} ${DESTDIR}/i18n @echo Downloading translations from Launchpad bzr export -v ${DESTDIR}/i18n/po/ lp:~openstreetmap/josm/josm_trans/ @echo Stripping comments from translations to save some space in the tarball for i in ${DESTDIR}/i18n/po/josm/*.po; do \ grep -E -v "^#[:,\.]" $$i > ${DESTDIR}/i18n/po/`basename $$i`; \ done mv ${DESTDIR}/i18n/po/josm/*.pot ${DESTDIR}/i18n/po/ rm -rf ${DESTDIR}/i18n/po/josm/ @echo Removing jar files find ${DESTDIR} -name "*.jar" -exec rm -v {} \; @echo Removing nodist/images rm -fr ${DESTDIR}/nodist/images @echo Removing other useless data rm -fr ${DESTDIR}/nodist/data/*.osm ${DESTDIR}/nodist/data/*.gpx ${DESTDIR}/nodist/data/*.jpg @echo Removing non-free or autogenerated data rm -fr ${DESTDIR}/resources/data/*.lang rm -fr ${DESTDIR}/src/org/openstreetmap/josm/data/imagery/types/* @echo Removing embedded code copy of jmapviewer rm -fr ${DESTDIR}/src/org/openstreetmap/gui/jmapviewer/ @echo Removing embedded fonts rm -fr ${DESTDIR}/resources/data/fonts/ @echo Removing OSX support rm -fr ${DESTDIR}/native/macosx/ @echo Removing Windows installer rm -fr ${DESTDIR}/native/windows/ @echo Building snapshot tarball tar czf ${DESTTGZ} -C `dirname ${DESTDIR}` `basename ${DESTDIR}` @echo Cleaning up rm -rf ${DESTDIR} @echo Moving tarball to parent directory mv -v ${DESTTGZ} ../ @echo Removing source JAR rm -f /tmp/josm-sources.jar /tmp/xmpcore-sources.jar /tmp/annotations-sources.jar @echo Removing tarballs directory rmdir ../tarballs @echo . @echo To update debian/changelog type @echo dch -v ${VERSION}+dfsg-1 @echo .