Remove dev-php/PHP_CodeSniffer, because I forgot why it's here.
[mjo-overlay.git] / dev-db / pgmodeler / pgmodeler-0.7.2_alpha1.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=5
6
7 inherit qmake-utils multilib
8
9 DESCRIPTION="Design, diagram, and deploy PostgreSQL databases"
10 HOMEPAGE="http://www.pgmodeler.com.br/"
11 SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV/_/-}.tar.gz"
12
13 LICENSE="GPL-3"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="test"
17
18 RDEPEND="dev-db/postgresql
19 dev-libs/libxml2
20 dev-qt/qtcore:5
21 dev-qt/qtgui:5
22 dev-qt/qtnetwork:5
23 dev-qt/qtprintsupport:5
24 dev-qt/qtwidgets:5"
25 DEPEND="${RDEPEND}
26 virtual/pkgconfig"
27
28 DOCS=( CHANGELOG.md README.md )
29
30 S="${WORKDIR}/${PN}-${PV/_/-}"
31
32 src_prepare() {
33 # Don't build the plugins, their build system doesn't work with a
34 # non-default LIBDIR. See,
35 #
36 # https://github.com/pgmodeler/pgmodeler/issues/479
37 #
38 sed -i -e '/plugins\/dummy/d' -e '/plugins\/xml2object/d' pgmodeler.pro \
39 || die 'failed to disable plugins'
40
41 sed -i -e 's/TARGET = pgmodeler/TARGET = pgmodeler-bin/' main/main.pro \
42 || die 'failed to rename binary'
43 }
44
45 src_configure() {
46 local bindir="${D}usr/bin"
47 local libdir="${D}usr/$(get_libdir)"
48 local resdir="${D}usr/share/${PN}"
49 mkdir -p "${bindir}" "${libdir}" "${resdir}" || die
50
51 eqmake5 "${PN}.pro" \
52 BINDIR+="${bindir}" LIBDIR+="${libdir}" RESDIR+="${resdir}"
53 }
54
55 src_compile() {
56 emake
57 }
58
59 src_install() {
60 default
61
62 # Install our shell script wrapper.
63 cat <<-EOF > "${T}/pgmodeler"
64 #!/bin/bash
65
66 export PGMODELER_ROOT="${ROOT}usr/share/pgmodeler"
67
68 # There is no good way to install pgmodeler globally for more than one
69 # user, since it requires write access to its own conf files. As a
70 # workaround, we install the upstream conf files globally, and copy them
71 # to the user's home directory before launching pgmodeler.
72 USERDIR="\${HOME}/.pgmodeler"
73 if [ ! -d "\${USERDIR}/conf" ]; then
74 mkdir -p "\${USERDIR}"
75 cp --no-clobber -a "\${PGMODELER_ROOT}/conf" "\${USERDIR}/"
76 fi
77
78 export PGMODELER_CONF_DIR="\${USERDIR}/conf"
79 export PGMODELER_SCHEMAS_DIR="\${PGMODELER_ROOT}/schemas"
80 export PGMODELER_LANG_DIR="\${PGMODELER_ROOT}/lang"
81 export PGMODELER_TMP_DIR="${ROOT}tmp"
82 export PGMODELER_PLUGINS_DIR="\${PGMODELER_ROOT}/plugins" # Not installed
83 export PGMODELER_CHANDLER_PATH="${ROOT}usr/bin/pgmodeler-ch"
84
85 pgmodeler-bin
86 EOF
87
88 dobin "${T}/pgmodeler"
89 }
90
91 src_test() {
92 einfo ">>> Test phase: ${CATEGORY}/${PF}"
93 cd "${S}/tests" || die
94 eqmake5 tests.pro
95 emake
96 # Before `make install`, all of the binaries and libraries are
97 # stored in ${S}/build.
98 PGMODELER_ROOT="${S}/build" ../build/tests || die "tests failed"
99 }