summaryrefslogtreecommitdiff
blob: c997841538ea04ba76f2c02d78c011a4e8405af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6
POSTGRES_COMPAT=( 11 10 9.6 9.5 )

inherit autotools flag-o-matic postgres-multi toolchain-funcs

DESCRIPTION="X Amateur Station Tracking and Information Reporting"
HOMEPAGE="http://xastir.org/"

if [[ ${PV} == "9999" ]] ; then
	EGIT_REPO_URI="https://github.com/Xastir/Xastir.git"
	EGIT_BRANCH="master"
	KEYWORDS=""
	inherit git-r3
else
#	SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
	inherit versionator
	MY_PV="$(delete_all_version_separators)"
	SRC_URI="https://github.com/Xastir/Xastir/archive/"${PN}""${MY_PV}".tar.gz -> "${P}".tar.gz"
	KEYWORDS="~amd64 ~x86"
fi



LICENSE="GPL-2"
SLOT="0"
IUSE="ax25 debug festival gdal geotiff gpsman graphicsmagick mysql postgres spatialdb"
REQUIRED_USE="spatialdb? ( ^^ ( postgres mysql ) )
	postgres? ( ${POSTGRES_REQ_USE/||/^^} )"

DEPEND=">=x11-libs/motif-2.3:0
	x11-libs/libXt
	x11-libs/libX11
	x11-libs/libXpm
	x11-apps/xfontsel
	dev-libs/libpcre
	net-misc/curl
	sys-libs/db:4.8
	sci-libs/shapelib
	ax25? ( media-radio/ax25-tools )
	!graphicsmagick? ( media-gfx/imagemagick:=[-hdri,-q32] )
	graphicsmagick? ( media-gfx/graphicsmagick:=[-q32] )
	geotiff? ( sci-libs/proj
		sci-libs/libgeotiff
		media-libs/tiff:0 )
	gdal? ( sci-libs/gdal )
	festival? ( app-accessibility/festival )
	postgres? ( ${POSTGRES_DEP}
		dev-db/postgis[topology] )
	mysql? ( virtual/mysql:* )"
RDEPEND="${DEPEND}"

pkg_setup() {
	postgres-multi_pkg_setup
}

src_prepare() {
	# fix script location (bug #407185)
	eapply "${FILESDIR}"/${P}-scripts.diff

	# fix __FORTIFY_SOURCE warning (bug #337365)
	eapply "${FILESDIR}"/${PN}-2.0.4-fortify.diff

	# do not use builtin shapelib if sci-libs/shapelib is not installed
	# instead build without shapelib support (bug #430704)
	eapply "${FILESDIR}"/${P}-no-builtin-shapelib.diff

	# do not filter duplicate flags (see bug 411095)
	eapply "${FILESDIR}"/${PN}-2.0.0-dont-filter-flags.diff

	if use postgres; then
	# fix postgres gis check
	eapply "${FILESDIR}"/"${PN}"-"${PV}"-postgres-gis.patch
	eapply "${FILESDIR}"/pg-libdir.patch
	fi

	eapply_user

	eautoreconf
}

src_configure() {
	# provide include path to GraphicsMagic for configure stage
	use graphicsmagick && append-cflags -I/usr/include/GraphicsMagick

	myeconf() {
		econf \
		--with-pcre \
		--with-shapelib \
		--with-dbfawk \
		--with-rtree \
		$(use_with spatialdb spatial_db ) \
		$(use_with mysql mysql_any ) \
		$(use_with mysql mysql_spatial ) \
		$(use_with debug err_popups ) \
		$(use_with debug libgc ) \
		$(use_with debug profiling ) \
		$(use_with debug lsb ) \
		$(use_with postgres postgis ) \
		$(use_with gpsman) \
		$(use_with ax25) \
		$(use_with !graphicsmagick imagemagick) \
		$(use_with graphicsmagick) \
		$(use_with geotiff libproj) \
		$(use_with geotiff) \
		$(use_with gdal) \
		$(use_with festival)
	}

	if use postgres; then
		local MULTIBUILD_VARIANT="${_POSTGRES_INTERSECT_SLOTS[0]}"
		_postgres-multi_multibuild_wrapper myeconf
	else
		myeconf
	fi
}

src_compile() {
	if use postgres; then
		local MULTIBUILD_VARIANT="${_POSTGRES_INTERSECT_SLOTS[0]}"
		_postgres-multi_multibuild_wrapper emake AR="$(tc-getAR)"
	else
		emake AR="$(tc-getAR)"
	fi
}

src_install() {
	if use postgres; then
		local MULTIBUILD_VARIANT="${_POSTGRES_INTERSECT_SLOTS[0]}"
		_postgres-multi_multibuild_wrapper emake DESTDIR="${D}" install
	else
		emake DESTDIR="${D}" install
	fi

	rm -rf "${D}"/usr/share/doc/${PN}
	einstalldocs AUTHORS ChangeLog CONTRIBUTING FAQ README  \
	README.Getting-Started README.MAPS README.OSM_maps README.qt \
	README.sudo
}

pkg_postinst() {
	elog "Remember you have to be root to add addditional scripts,"
	elog "maps and other configuration data under /usr/share/xastir."
	elog
	elog "If you set USE=spatialdb:"
	elog "See Help -> Help Index -> Configure a SQL Database Connection"
	elog
	elog "There are security implications to using ax25 kernel drivers"
	elog "You will need to 'chmod 4755 /usr/bin/xastir' as root"
	elog "This is needed for socket controll to the ax ports"
	elog
}