keepass-2.35-r1.ebuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit eutils fdo-mime gnome2-utils multilib
  5. MY_PN="KeePass"
  6. DESCRIPTION="A free, open source, light-weight and easy-to-use password manager"
  7. HOMEPAGE="http://keepass.info/"
  8. SRC_URI="mirror://sourceforge/${PN}/${MY_PN}-${PV}-Source.zip"
  9. LICENSE="GPL-2"
  10. SLOT="0"
  11. KEYWORDS="amd64 x86"
  12. IUSE="aot"
  13. COMMON_DEPEND="dev-lang/mono"
  14. DEPEND="${COMMON_DEPEND}
  15. app-arch/unzip"
  16. RDEPEND="${COMMON_DEPEND}
  17. dev-dotnet/libgdiplus[cairo]"
  18. S="${WORKDIR}"
  19. PATCHES=( "${FILESDIR}/${PN}-2.20-xsl-path-detection.patch" )
  20. src_prepare() {
  21. # KeePass looks for some XSL files in the same folder as the executable,
  22. # we prefer to have it in /usr/share/KeePass. Apply patch using base function.
  23. # This XSL file will not be upstreamed since the KeePass creator said that
  24. # including this patch would break the Portable USB version of KeePass
  25. # (which keeps/looks for xsl files in its own folder)
  26. default
  27. # New Mono Prep Script until keepass 2.36+ comes out.
  28. # This script has been upstreamed, still waiting for final confirmation.
  29. local newMonoPrepScript="${FILESDIR}/keepass-2.35-new-monoprep-script.sh"
  30. # Switch into build dir so the mono prepration script works correctly
  31. cd Build || die
  32. cp -f "${newMonoPrepScript}" PrepMonoDev.sh
  33. source PrepMonoDev.sh || die
  34. cd ../ || die
  35. }
  36. src_compile() {
  37. # Build with Release target
  38. xbuild /target:KeePass /property:Configuration=Release || die
  39. # Run Ahead Of Time compiler on the binary
  40. if use aot; then
  41. cp Ext/KeePass.exe.config Build/KeePass/Release/ || die
  42. mono --aot -O=all Build/KeePass/Release/KeePass.exe || die
  43. fi
  44. }
  45. src_install() {
  46. # Wrapper script to launch mono
  47. make_wrapper "${PN}" "mono /usr/$(get_libdir)/${PN}/KeePass.exe"
  48. # Some XSL files
  49. insinto "/usr/share/${PN}/XSL"
  50. doins Ext/XSL/*
  51. insinto "/usr/$(get_libdir)/${PN}/"
  52. exeinto "/usr/$(get_libdir)/${PN}/"
  53. doins Ext/KeePass.exe.config
  54. # Default configuration, simply says to use user-specific configuration
  55. doins Ext/KeePass.config.xml
  56. # The actual executable
  57. doexe Build/KeePass/Release/KeePass.exe
  58. # Copy the AOT compilation result
  59. if use aot; then
  60. doexe Build/KeePass/Release/KeePass.exe.so
  61. fi
  62. # Prepare the icons
  63. newicon -s 256 Ext/Icons_04_CB/Finals/plockb.png "${PN}.png"
  64. newicon -s 256 -t gnome -c mimetypes Ext/Icons_04_CB/Finals/plockb.png "application-x-${PN}2.png"
  65. # Create a desktop entry and associate it with the KeePass mime type
  66. make_desktop_entry "${PN}" "${MY_PN}" "${PN}" "System;Security" "MimeType=application/x-keepass2;"
  67. # MIME descriptor for .kdbx files
  68. insinto /usr/share/mime/packages/
  69. doins "${FILESDIR}/${PN}.xml"
  70. # sed, because patching this really sucks
  71. sed -i 's/mono/mono --verify-all/g' "${D}/usr/bin/keepass"
  72. }
  73. pkg_preinst() {
  74. gnome2_icon_savelist
  75. }
  76. pkg_postinst() {
  77. _update_caches
  78. if ! has_version x11-misc/xdotool ; then
  79. elog "Optional dependencies:"
  80. elog " x11-misc/xdotool (enables autotype/autofill)"
  81. fi
  82. elog "Some systems may experience issues with copy and paste operations."
  83. elog "If you encounter this, please install x11-misc/xsel."
  84. }
  85. pkg_postrm() {
  86. _update_caches
  87. }
  88. _update_caches() {
  89. gnome2_icon_cache_update
  90. fdo-mime_mime_database_update
  91. fdo-mime_desktop_database_update
  92. }