summaryrefslogtreecommitdiffstats
path: root/vim.cygport
blob: c142753b0d9737b83d57172ae00eba9bc2416109 (plain) (blame)
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
inherit lua perl python3 ruby
SCALLYWAG="label"

NAME="vim"
VERSION=9.1.1952
slot=${VERSION%.*}
RELEASE=1

LICENSE="Vim"
CATEGORY="Editors"
SUMMARY="Vi IMproved - enhanced vi editor"
DESCRIPTION="Vim (Vi IMproved) is an almost compatible version of the UNIX
editor vi. Almost every possible command can be performed using only ASCII
characters. Many new features have been added: multilevel undo, command line
history, file name completion, block operations, and editing of binary data."
HOMEPAGE="http://www.vim.org/"
SRC_URI="
 https://github.com/vim/vim/archive/v${VERSION}/vim-v${VERSION}.tar.gz
 mirror://portage/app-editors/vim/files/vim-completion
 mirror://portage/app-editors/gvim/files/gvim-completion
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vimrc
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/virc
"
PATCH_URI+="
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vim-7.0-fixkeys.patch
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vim-7.3-manpage-typo-668894-675480.patch
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vim-7.4-globalsyntax.patch
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vim-7.4-specsyntax.patch
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vim-8.0-copy-paste.patch
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vim-crypto-warning.patch
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vim-manpagefixes-948566.patch
 https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vim-python3-tests.patch
 7.3-cygwin-mouse.patch
 8.2-cygwin-python-dyn.patch
"
# 8.2-vim-fstabsyntax.patch
# https://src.fedoraproject.org/rpms/vim/raw/rawhide/f/vim-7.0-hunspell.patch
# vim-8.2.4372-1.src.patch

PKG_NAMES="vim vim-common vim-minimal gvim xxd vim-doc"
PKG_NAMES+=" vim-lua vim-perl vim-python3 vim-ruby"
vim_REQUIRES="vim-common" # cscope
vim_CONTENTS="
	etc/bash_completion.d/vim-completion
	etc/profile.d/vim.*
	usr/bin/rvim
	usr/bin/vim.exe
	usr/bin/vimdiff
	usr/bin/vimtutor
	usr/share/applications/vim.desktop
"
vim_common_SUMMARY="${SUMMARY} (common runtime)"
vim_common_REQUIRES="xxd"
vim_common_CONTENTS="
	--exclude=e*.1* --exclude=rvi.1* --exclude=rview.1* --exclude=vi.1*
	--exclude=view.1* --exclude=vimx.1* --exclude=g[ev]*.1*
	--exclude=rgv*.1* --exclude=xxd.1* --exclude=html
	etc/defaults/etc/vimrc
	etc/postinstall/vim.sh
	etc/preremove/vim.sh
	usr/share/doc/
	usr/share/icons/
	usr/share/man/
	usr/share/vim/
"
vim_minimal_CATEGORY="Base"  # ex/vi required by POSIX
vim_minimal_SUMMARY="Minimal Vi text editor"
vim_minimal_CONTENTS="
	etc/defaults/etc/virc
	usr/bin/ex
	usr/bin/rvi
	usr/bin/rview
	usr/bin/vi.exe
	usr/bin/view
	usr/share/man/man1/ex.*
	usr/share/man/man1/rvi.*
	usr/share/man/man1/rview.*
	usr/share/man/man1/vi.*
	usr/share/man/man1/view.*
	usr/share/man/*/man1/ex.*
	usr/share/man/*/man1/rvi.*
	usr/share/man/*/man1/rview.*
	usr/share/man/*/man1/vi.*
	usr/share/man/*/man1/view.*
"
gvim_SUMMARY="GUI for the Vim text editor"
gvim_REQUIRES="vim-common" # cscope lua perl python python3 ruby
gvim_CONTENTS="
	etc/bash_completion.d/gvim-completion
	usr/bin/ev*
	usr/bin/*g[ev]*
	usr/bin/vimx
	usr/share/applications/gvim.desktop
	usr/share/man/man1/ev*
	usr/share/man/man1/*g[ev]*
	usr/share/man/man1/vimx.1*
	usr/share/man/*/man1/ev*
	usr/share/man/*/man1/*g[ev]*
	usr/share/man/*/man1/vimx.1*
"
xxd_SUMMARY="Hexdump utility"
xxd_CONTENTS="usr/bin/xxd.exe usr/share/man/man1/xxd.* usr/share/man/*/man1/xxd.*"
vim_doc_SUMMARY="Vim Reference Manual"
vim_doc_CONTENTS="usr/share/doc/vim/html/"
# these are solely to indicate that rebuilds are needed along with version
# bumps to the language interpreters
vim_lua_CATEGORY="_obsolete"
vim_lua_REQUIRES="vim lua"
vim_perl_CATEGORY="_obsolete"
vim_perl_REQUIRES="vim perl"
vim_python3_CATEGORY="_obsolete"
vim_python3_REQUIRES="vim python39"
vim_ruby_CATEGORY="_obsolete"
vim_ruby_REQUIRES="vim ruby"

BUILD_REQUIRES="gettext-devel libattr-devel libiconv-devel libncurses-devel liblua-devel perl python3-devel ruby-devel libcanberra-devel libgtk3-devel libX11-devel libICE-devel libSM-devel libXt-devel libXpm-devel"

DIFF_EXCLUDES="tags"

src_compile() {
	lndirs
	cd ${B}/src

	saved_CFLAGS="${CFLAGS}"

	CFLAGS+=" -fstack-protector-strong"
	CFLAGS+=" -DSYS_VIMRC_FILE='\"/etc/vimrc\"'"
	cygconf \
		--with-features=huge \
		--with-tlib=ncursesw \
		--enable-cscope \
		--enable-multibyte \
		--enable-luainterp=dynamic \
		--enable-perlinterp=dynamic \
		--enable-pythoninterp=dynamic \
		--enable-python3interp=dynamic \
		--enable-rubyinterp=dynamic \
		--disable-tclinterp \
		--disable-gpm --disable-sysmouse \
		--enable-canberra \
		--enable-gui=gtk3 --disable-gtktest --with-x --enable-xim \
		--with-compiledby="<cygwin@cygwin.com>" \
		--with-modified-by="<cygwin@cygwin.com>"
	cygmake auto/osdef.h
	cygmake
	mv vim.exe gvim.exe
	cygmake -j1 distclean

	CFLAGS="${saved_CFLAGS}"

	CFLAGS+=" -fstack-protector-strong"
	CFLAGS+=" -DSYS_VIMRC_FILE='\"/etc/virc\"'"
	CFLAGS+=" -DUSR_VIMRC_FILE='\"$HOME/.virc\"'"
	CFLAGS+=" -DUSR_VIMRC_FILE2='\"~/.vim/.virc\"'"
	CFLAGS+=" -DVIMRC_FILE='\".virc\"'"
	cygconf \
		--with-features=small \
		--with-tlib=ncursesw \
		--enable-multibyte \
		--disable-luainterp \
		--disable-perlinterp \
		--disable-pythoninterp \
		--disable-python3interp \
		--disable-rubyinterp \
		--disable-tclinterp \
		--disable-gpm --disable-sysmouse \
		--disable-canberra \
		--disable-gui --without-x \
		--with-compiledby="<cygwin@cygwin.com>" \
		--with-modified-by="<cygwin@cygwin.com>"
	cygmake auto/osdef.h
	cygmake
	mv vim.exe vi.exe
	cygmake -j1 distclean

	CFLAGS="${saved_CFLAGS}"

	CFLAGS+=" -fstack-protector-strong"
	CFLAGS+=" -DSYS_VIMRC_FILE='\"/etc/vimrc\"'"
	cygconf \
		--with-features=huge \
		--with-tlib=ncursesw \
		--enable-cscope \
		--enable-multibyte \
		--enable-luainterp=dynamic \
		--enable-perlinterp=dynamic \
		--enable-pythoninterp=dynamic \
		--enable-python3interp=dynamic \
		--enable-rubyinterp=dynamic \
		--disable-tclinterp \
		--disable-gpm --disable-sysmouse \
		--disable-canberra \
		--disable-gui --without-x \
		--with-compiledby="<cygwin@cygwin.com>" \
		--with-modified-by="<cygwin@cygwin.com>"
	cygmake auto/osdef.h
	cygmake

	cd ${B}/runtime/doc
	chmod +x vim2html.pl
	cygmake perlhtml
}

src_install() {
	local x z
	cd ${B}/src
	cyginstall -j1 \
		STRIP=: INSTALL_DATA="cp -L" INSTALL_DATA_R="cp -Lr"

	dobin vi.exe gvim.exe gvimtutor

	# from src/main.c:
	# * If the executable name starts with "r" we disable shell commands.
	# * If the next character is "e" we run in Easy mode.
	# * If the next character is "g" we run the GUI version.
	# * If the next characters are "view" we start in readonly mode.
	# * If the next characters are "diff" or "vimdiff" we start in diff mode.
	# * If the next characters are "ex" we start in Ex mode.  If it's followed
	#   by "im" use improved Ex mode.
	# But we have to skip exim (improved Ex) due to conflict with the MTA

	for x in evim eview gview gvimdiff rgvim rgview gex vimx
	do
		ln -sfn gvim.exe ${D}/usr/bin/${x}
	done
	for x in ex rvi view rview
	do
		ln -sfn vi.exe ${D}/usr/bin/${x}
	done
	for x in vimdiff rvim
	do
		ln -sfn vim.exe ${D}/usr/bin/${x}
	done

	for man1dir in $(find ${D}/usr/share/man -name man1)
	do
		cp -f ${man1dir}/{vim,vi}.1
		for x in ${D}/usr/bin/*
		do
			x=${x##*/}
			case ${x} in
			*.exe|evim|vimdiff|vimtutor)	;;
			eview)	echo ".so evim.1" > ${man1dir}/${x}.1 ;;
			gvimdiff)
				echo ".so vimdiff.1" > ${man1dir}/${x}.1 ;;
			gvimtutor)
				echo ".so vimtutor.1" > ${man1dir}/${x}.1 ;;
			ex|rvi|rview|view)
				echo ".so vi.1" > ${man1dir}/${x}.1 ;;
			*)	echo ".so vim.1" > ${man1dir}/${x}.1 ;;
			esac
		done
	done

	for z in 16x16 32x32 48x48
	do
		insinto /usr/share/icons/hicolor/$z/apps
		newins ${S}/runtime/vim$z.png gvim.png
	done

	insinto /etc/bash_completion.d
	doins ${S}/gvim-completion ${S}/vim-completion

	insinto /etc
	doins ${S}/vimrc ${S}/virc
	make_etc_defaults /etc/vimrc /etc/virc

	dodir /etc/profile.d
	cat > ${D}/etc/profile.d/vim.sh <<EOF
if [ -n "\$BASH_VERSION" -o -n "\$KSH_VERSION" -o -n "\$ZSH_VERSION" ]; then
  # for bash and zsh, only if no alias is already set
  alias vi >/dev/null 2>&1 || alias vi=vim
fi
EOF
	cat > ${D}/etc/profile.d/vim.csh <<EOF
alias vi vim
EOF
	cat > ${D}/etc/profile.d/vim.fish <<EOF
alias vi vim
EOF

	# minimize optional dependencies
	pushd ${D}/usr/share/vim/vim${slot/\.}
	# this is used in 'make perlhtml'
	rm -f doc/vim2html.pl
	# these are just samples, maybe should be in doc
	rm -fr tools/
	popd

	newdoc ${S}/runtime/doc/uganda.txt LICENSE
	docinto html
	dodoc ${B}/runtime/doc/*.{html,css}
}

src_test() {
	cd ${B}
	make -i test
}