Skip to content

Instantly share code, notes, and snippets.

@martin-kokos
Created January 5, 2021 14:13
Show Gist options
  • Save martin-kokos/fa73a163171851904fbc40ea2c113a2f to your computer and use it in GitHub Desktop.
Save martin-kokos/fa73a163171851904fbc40ea2c113a2f to your computer and use it in GitHub Desktop.
JOSM ebuild
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
JAVA_ANT_ENCODING=UTF-8
ESVN_REPO_URI="https://josm.openstreetmap.de/svn/trunk"
inherit eutils java-pkg-2 java-ant-2 subversion desktop
DESCRIPTION="Java-based editor for the OpenStreetMap project"
HOMEPAGE="https://josm.openstreetmap.de/"
[[ ${PV} == "99999" ]] || ESVN_REPO_URI="${ESVN_REPO_URI}@${PV}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
RESTRICT="network-sandbox" #FIXME build system Ant uses ivy which is downloaded at build time
DEPEND=">=virtual/jdk-1.8"
RDEPEND=">=virtual/jre-1.8"
IUSE=""
src_prepare() {
default
# create-revision needs the compile directory to be a svn directory
# see also https://lists.openstreetmap.org/pipermail/dev/2009-March/014182.html
sed -i \
-e "s:arg[ ]value=\".\":arg value=\"${ESVN_STORE_DIR}\/${PN}\/trunk\":" \
build.xml || die "Sed failed"
#FIXME REVISION.xml doesn't seem to be created and then app reports "Strange version"
sed -i \
-e "s:<property name=\"version.entry.commit.revision\" value=\"UNKNOWN\"/>:<property name=\"version.entry.commit.revision\" value=\"${PV}\"/>:" \
build.xml || die "Sed failed"
}
src_compile() {
eant dist-optimized "-Divy.default.ivy.user.dir=${T}" #FIXME should be probably part of EANT_EXTRA_ARGS but don't know how
}
src_install() {
local -x IVY_HOME="${T}" # Give ivy home for cache inside sandbox
java-pkg_newjar "dist/${PN}-custom-optimized.jar" "${PN}.jar" || die "java-pkg_newjar failed"
java-pkg_dolauncher "${PN}" --jar "${PN}.jar" || die "java-pkg_dolauncher failed"
local icon_size
for icon_size in 16 32 48; do
pwd
newicon -s "${icon_size}" -t "hicolor" \
"build/images/logo_${icon_size}x${icon_size}x32.png" ${PN}.png
newicon -s "${icon_size}" -t "locolor" \
"build/images/logo_${icon_size}x${icon_size}x8.png" ${PN}.png
done
make_desktop_entry "${PN}" "Java OpenStreetMap Editor" ${PN} "Utility;Science;Geoscience"
}
pkg_postinst() {
ewarn "NOTE: If you experience ugly fonts in the application, consider forcing font anti-aliasing in _JAVA_OPTIONS"
ewarn "See https://wiki.archlinux.org/index.php/Java_Runtime_Environment_fonts on how to do this."
}
@martin-kokos
Copy link
Author

based off of gentoo/gentoo#10475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment