summaryrefslogtreecommitdiff
blob: 7ec6f3fa1f9f885418a39ddcce12a8200cebf73b (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-wm/ion-devel/ion-devel-20031211.ebuild,v 1.4 2004/02/22 22:40:01 agriffis Exp $

inherit eutils

DESCRIPTION="A tiling tabbed window manager designed with keyboard users in mind"
HOMEPAGE="http://www.iki.fi/tuomov/ion/"
SRC_URI="http://modeemi.fi/~tuomov/dl/${P}.tar.gz"
LICENSE="Clarified-Artistic"
SLOT="0"
KEYWORDS="~alpha ~hppa ~mips ~ppc ~sparc ~x86 ~amd64"
IUSE="xinerama"
DEPEND="virtual/x11
	app-misc/run-mailcap
	>=dev-lang/lua-5.0.1_beta20031003"
S=${WORKDIR}/${P/_p/-}

src_unpack() {

	unpack ${P}.tar.gz

	cat >${T}/system.mk.patch <<EOP
--- ion-devel-20031211/system.mk	2003-12-11 18:16:16.000000000 +0100
+++ ion-devel/system.mk	2003-12-17 18:05:02.000000000 +0100
@@ -7,7 +7,7 @@
 ## Installation paths
 ##

-PREFIX=/usr/local
+PREFIX=/usr

 # Unless you are creating a package conforming to some OS's standards, you
 # probably do not want to modify the following directories:
@@ -15,13 +15,13 @@
 # Main binaries
 BINDIR=\$(PREFIX)/bin
 # Configuration .lua files
-ETCDIR=\$(PREFIX)/etc/ion
+ETCDIR=/etc/X11/ion
 # Some .lua files and ion-* shell scripts
 SHAREDIR=\$(PREFIX)/share/ion
 # Manual pages
-MANDIR=\$(PREFIX)/man
+MANDIR=\$(PREFIX)/share/man
 # Some documents
-DOCDIR=\$(PREFIX)/doc/ion
+DOCDIR=\$(PREFIX)/share/doc/${PF}
 # Nothing at the moment
 INCDIR=\$(PREFIX)/include/ion
 # Nothing at the moment
@@ -68,7 +68,7 @@

 # If you have installed Lua 5.0 from the official tarball without changing
 # paths, this so do it.
-LUA_DIR=/usr/local
+LUA_DIR=/usr
 LUA_LIBS = -L\$(LUA_DIR)/lib -R\$(LUA_DIR)/lib -llua -llualib
 LUA_INCLUDES = -I\$(LUA_DIR)/include
 LUA=\$(LUA_DIR)/bin/lua
@@ -116,7 +116,7 @@
 # asprintf and vasprintf in the c library. (gnu libc has.)
 # If HAS_SYSTEM_ASPRINTF is not defined, an implementation
 # in sprintf_2.2/ is used.
-#HAS_SYSTEM_ASPRINTF=1
+HAS_SYSTEM_ASPRINTF=1


 ##
@@ -139,7 +139,7 @@
 # it so it is perhaps better not using anything at all.

 # Most systems
-#XOPEN_SOURCE=-ansi -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
+XOPEN_SOURCE=-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
 # sunos, (irix)
 #XOPEN_SOURCE=-ansi -D__EXTENSIONS__

@@ -153,8 +153,8 @@
 # following should optimize function calls to Lua a little.
 #C99_SOURCE=-std=c99 -DCF_HAS_VA_COPY

-CFLAGS=-g -Os \$(WARN) \$(DEFINES) \$(INCLUDES) \$(EXTRA_INCLUDES)
-LDFLAGS=-g -Os \$(LIBS) \$(EXTRA_LIBS)
+CFLAGS=${CFLAGS} \$(WARN) \$(DEFINES) \$(INCLUDES) \$(EXTRA_INCLUDES)
+LDFLAGS=${CFLAGS} \$(LIBS) \$(EXTRA_LIBS)


 ##
EOP
	epatch ${T}/system.mk.patch

	epatch ${FILESDIR}/${P}-miscellaneous.patch

	cd ${S}

	if [ `use xinerama` ]; then
		einfo Enabling Xinerama support
		eend 0
	else
		einfo Disabling Xinerama support
		sed -i system.mk \
			-e 's/\(XINERAMA_LIBS=-lXinerama\)/#\1/' \
			-e 's/#\(DEFINES += -DCF_NO_XINERAMA\)/\1/'
		eend $?
	fi

	if has_version '<x11-base/xfree-4.3.0'; then
		einfo Enabling Xfree\<4.3.0/Opera/UTF-8 bug workaround
		eend 0
	else
		einfo Disabling Xfree\<4.3.0/Opera/UTF-8 bug workaround
		sed -i system.mk \
			-e 's/\(DEFINES += -DCF_XFREE86_TEXTPROP_BUG_WORKAROUND\)/#\1/'
		eend $?
	fi

	if has_version '>=sys-devel/gcc-3'; then
		einfo Enabling Lua function call optimizations
		sed -i system.mk \
			-e 's/#\(C99_SOURCE=-std=c99 -DCF_HAS_VA_COPY\)/\1/'
		eend $?
	fi

}

src_compile() {
	emake || die
}

src_install() {

	make PREFIX=${D}/usr ETCDIR=${D}/etc/X11/ion install || die

	insinto /usr/include/ion
	doins *.h *.mk mkexports.lua
	for i in de floatws ioncore ionws luaextl menu query; do
		insinto /usr/include/ion/${i}
		doins ${i}/*.h
	done
	insinto /usr/include/ion/libtu
	doins libtu/include/libtu/*

	echo -e "#!/bin/sh\n/usr/bin/ion" > ${T}/ion
	echo -e "#!/bin/sh\n/usr/bin/pwm" > ${T}/pwm
	exeinto /etc/X11/Sessions
	doexe ${T}/ion ${T}/pwm

}

pkg_postinst() {
	einfo "The configuration files have moved and some have been renamed."
	einfo "To remove stale system-wide files and update user configurations run"
	einfo "    ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config"
}

pkg_config() {

	einfo "Removing stale system-wide configuration files"
	rm -Rf ${R}/etc/X11/ion-devel ${R}/etc/X11/Sessions/ion-devel
	eend 0

	einfo "Updating user configurations..."
	for h in $(cut -d: -f6 ${R}/etc/passwd); do
		if test -d ${R}${h}/.ion-devel; then
			test -d ${R}${h}/.ion2 && break
			einfo ${h}
			cp -a ${R}${h}/.ion-devel ${R}${h}/.ion2
			for i in ${R}${h}/.ion2/ioncore*.lua; do
				sed -i ${i} -e 's/ioncore/ion/g'
				mv ${i} ${i/ioncore/ion}
			done
			rm -f ${R}${h}/.ion2/ioncore*.lua
			eend 0
		fi
	done

}