summaryrefslogtreecommitdiff
blob: cbafa1cafe1dfa8b11ad405e4bbd8a14694f4a9d (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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{8..11} )
GO_OPTIONAL=1
inherit autotools desktop flag-o-matic go-module python-single-r1

DESCRIPTION="A multiple large virtual desktop window manager derived from fvwm"
HOMEPAGE="http://www.fvwm.org/"

if [[ ${PV} == 9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/fvwmorg/fvwm3.git"
	EGIT_BRANCH="master"
else
	SRC_URI="https://github.com/fvwmorg/fvwm3/releases/download/${PV}/${P}.tar.gz"
	KEYWORDS="~amd64"
fi

SRC_URI+=" https://gitlab.com/Matt.Jolly/fvwm3-go-deps/-/raw/${PV}/${P}-deps.tar.xz?inline=false -> ${P}-deps.tar.xz"

LICENSE="GPL-2+ FVWM
	go? (
			Apache-2.0
			BSD
			MIT
		)"

SLOT="0"

IUSE="bidi debug doc go netpbm nls perl png readline rplay stroke svg tk truetype vanilla lock"
REQUIRED_USE="
	${PYTHON_REQUIRED_USE}"

DOCS=( NEWS )

if [[ ${PV} == 9999 ]]; then
	DOCS+=( dev-docs/COMMANDS dev-docs/DEVELOPERS.md dev-docs/INSTALL.md dev-docs/PARSING.md dev-docs/TODO.md dev-docs/NEW-COMMANDS.md )
fi

BDEPEND="
	virtual/pkgconfig
	doc? ( dev-libs/libxslt
		dev-ruby/asciidoctor )
	app-arch/unzip
	go? ( >=dev-lang/go-1.14 )
"

RDEPEND="${PYTHON_DEPS}
	${COMMON_DEPEND}
	!x11-wm/fvwm
	dev-libs/glib:2
	dev-libs/libevent:=
	dev-lang/perl
	sys-libs/zlib
	x11-libs/libICE
	x11-libs/libSM
	x11-libs/libX11
	x11-libs/libXau
	x11-libs/libxcb
	x11-libs/libXcursor
	x11-libs/libXdmcp
	x11-libs/libXext
	x11-libs/libXfixes
	x11-libs/libXpm
	x11-libs/libXrandr
	x11-libs/libXrender
	bidi? ( dev-libs/fribidi )
	lock? ( x11-misc/xlockmore )
	netpbm? ( media-libs/netpbm )
	perl? ( tk? (
			dev-lang/tk
			dev-perl/Tk
			>=dev-perl/X11-Protocol-0.56
		)
	)
	png? ( media-libs/libpng:= )
	readline? (
		sys-libs/ncurses:=
		sys-libs/readline:=
	)
	rplay? ( media-sound/rplay )
	stroke? ( dev-libs/libstroke )
	svg? (
		gnome-base/librsvg:2
		x11-libs/cairo
	)
	truetype? (
		media-libs/fontconfig
		x11-libs/libXft
	)
	userland_GNU? ( sys-apps/debianutils )"

DEPEND="${COMMON_DEPEND}
	x11-base/xorg-proto"

PATCHES=(
	"${FILESDIR}/${P}-translucent-menus.patch"
)

if [[ ${PV} == 9999 ]]; then
	PATCHES+=(
		"${FILESDIR}/${P}-goflags.patch"
	)
fi

src_unpack() {
	if [[ ${PV} == 9999 ]]; then
		einfo "The branch ${EGIT_BRANCH} will be installed."
		git-r3_src_unpack
	else
		unpack "${P}".tar.gz
	fi
	unpack "${P}"-deps.tar.xz
	mv go-mod ${P}/bin/FvwmPrompt/ || die
}

src_prepare() {
	default
	if use doc; then
		eapply "${FILESDIR}/${P}-htmldoc.patch"
	fi

	sed -i '/^@FVWM_BUILD_GOLANG_TRUE@GOBUILD = $(GOCMD) build/s/$/ -mod=mod/' \
		bin/FvwmPrompt/Makefile.in || die "Updating go build paramaters failed."

	eautoreconf
}

src_configure() {
	# Non-upstream email where bugs should be sent; used in fvwm-bug.
	export FVWM_BUGADDR="desktop-wm@nogentoo.org"

	# Recommended by upstream for release. Doesn't really matter for live ebuilds.
	append-flags -fno-strict-aliasing

	# Signed chars are required.
	for arch in arm arm64 ppc ppc64; do
		use $arch && append-flags -fsigned-chars
	done

	local myconf=(
		--prefix=/usr
		--with-imagepath=/usr/include/X11/bitmaps:/usr/include/X11/pixmaps:/usr/share/icons/fvwm
		--enable-package-subdirs
		$(use_enable bidi)
		$(use_enable doc mandoc)
		$(use_enable go golang)
		$(use_enable nls)
		$(use_enable nls iconv)
		$(use_enable perl perllib)
		$(use_enable png)
		$(use_with readline readline-library)
		$(use_enable svg rsvg)
		$(use_enable truetype xft)
		--docdir=/usr/share/doc/${P}
	)

	use readline && myconf+=( --without-termcap-library )

	econf ${myconf[@]}
}

src_compile() {
	PREFIX="/usr" emake
	if [[ ${PV} == *9999 ]]; then
		use doc && emake -C doc html
	fi
}

src_install() {
	emake DESTDIR="${ED}" prefix="/usr" exec_prefix="/usr" datarootdir="/usr/share" install

	dodir /etc/X11/Sessions
	echo "/usr/bin/fvwm3" > "${ED}/etc/X11/Sessions/${PN}" || die
	fperms a+x /etc/X11/Sessions/${PN} || die

	python_scriptinto "/usr/bin"
	python_doscript "${ED}/usr/bin/FvwmCommand" "${ED}/usr/bin/fvwm-menu-desktop"
	if use doc; then
		if [[ ${PV} == *9999 ]]; then
			HTML_DOCS=( doc/*.html )
		else
			HTML_DOCS=( doc/html/*.html )
		fi
	fi
	einstalldocs

	make_session_desktop fvwm3 /usr/bin/fvwm3
}

pkg_postinst() {
	if use go; then
		ewarn "FvwmPrompt has been installed, it provides the functionality of both FvwmCommand and FvwmConsole."
		ewarn "For compatibility with the existing fvwm2 configurations, the ebuild will install a FvwmCommand wrapper script."
		ewarn "If you need FvwmConsole, install ${PN} with USE=\"-go\", but FvwmPrompt and FvwmCommnd will not be installed."
	else
		ewarn "Fvwmconsole has been installed, but FvwmCommand and FvwmPrompt are no longer included in this ebuild."
		ewarn "If you need FvwmPrompt or FvwmCommand, install ${PN} with USE=\"go\"."
		ewarn "In that case, FvwmPrompt will replace FvwmConsole and provide the same functionality in a more flexible way."
	fi
}