SliTaz Next Cooker

Home Bugs Hg Roadmap Pizza Tank | Cross i486 ISO
package icon

gvim
Advanced text editor with GTK+ GUI

receipt stuff/gvim.desktop
# SliTaz package receipt v2.

PACKAGE="gvim"
VERSION="7.3"
CATEGORY="editors"
SHORT_DESC="Advanced text editor with GTK+ GUI"
MAINTAINER="[email protected]"
LICENSE="other"
WEB_SITE="https://www.vim.org/"
REPOLOGY="vim"

SOURCE="vim"
TARBALL="$SOURCE-$VERSION.tar.bz2"
WGET_URL="ftp://ftp.vim.org/pub/vim/unix/$TARBALL"

BUILD_DEPENDS="gtk2-dev"

compile_rules() {
	# define the place for the global vimrc file (set to /etc/vim/vimrc)
	# (patch from Arch Linux PKGBUILD)
	sed -i 's|^.*\(#define SYS_VIMRC_FILE\).*$|\1 "/etc/vim/vimrc"|' $src/src/feature.h
	# and global gvimrc file (set to /etc/vim/gvimrc)
	sed -i 's|^.*\(#define SYS_GVIMRC_FILE\).*$|\1 "/etc/vim/gvimrc"|' $src/src/feature.h

	./configure \
		--prefix=/usr \
		--cache-file=$PWD/config.cache \
		--infodir=/usr/share/info \
		--with-features=normal \
		--with-x=yes \
		--enable-gui=gtk2 \
		--enable-multibyte \
		--disable-motif-check \
		--disable-athena-check \
		--mandir=/usr/share/man \
		$CONFIGURE_ARGS &&
	make \
		VIMRCLOC=/etc/vim \
		VIMRUNTIMEDIR=/usr/share/vim/vim73 \
		MAKE="make -e" &&
	make DESTDIR=$install install || return 1

	mkdir -p $install/etc/vim
	cp -a $src/runtime/vimrc_example.vim $install/etc/vim/vimrc
}

genpkg_rules() {
	mkdir -p $fs/usr/share/icons/hicolor/16x16/apps $fs/usr/share/applications $fs/etc

	cp -a $install/usr/bin $fs/usr
	cp -a $install/usr/share/vim $fs/usr/share
	cp -a $src/runtime/vim16x16.png $fs/usr/share/icons/hicolor/16x16/apps/gvim.png
	cp -a $stuff/gvim.desktop $fs/usr/share/applications
	cp -a $install/etc/vim $fs/etc
	DEPENDS="ncurses gtk2 libxt libxau libxdmcp"
	CONFIG_FILES="/etc/vim/vimrc"
	TAGS="text-editor"
}

post_install() {
	cmd=$(readlink "$1/bin/vi")
	if [ ! "$cmd" == '/usr/bin/vim' ]; then
		echo ""
		echo "**** Actual VI link : $cmd"
		echo ""
		echo -n "Do you want vim  for /bin/vi (y/N) ? : "; read -t 30 answer
		if [ "$answer" == 'y' ]; then
			echo ""
			echo -n "Removing vi link to make a new one pointing on /usr/bin/vim..."
			rm "$1/bin/vi" && ln -sf /usr/bin/vim "$1/bin/vi"
			status
		else
			echo ""
			echo "Leaving /bin/vi to : $cmd"
		fi
	fi
}

post_remove() {
	# restore previous symlink
	ln -sf busybox "$1/bin/vi"
}