SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "gvim"

# SliTaz package receipt.

PACKAGE="gvim"
VERSION="9.0.0133"
basever=${VERSION%.*}
basever=${basever/./}
CATEGORY="editors"
TAGS="text-editor"
SHORT_DESC="Advanced text editor, with gtk+ GUI."
MAINTAINER="erjo@slitaz.org"
LICENSE="other"
WEB_SITE="https://www.vim.org/"

SOURCE="vim"
TARBALL="$SOURCE-$VERSION.tar.gz"
WGET_URL="https://github.com/$SOURCE/$SOURCE/archive/v$VERSION.tar.gz"

PROVIDES="xxd"
DEPENDS="gtk+ ncurses xorg-libXau xorg-libXdmcp xorg-libXt"
BUILD_DEPENDS="gtk+-dev"
CONFIG_FILES="/etc/vim/vimrc"

# What is the latest version available today?
current_version()
{
    wget -O - ${WGET_URL%/*}/ 2>/dev/null | \
    sed '/vim-[0-9]/!d;/tar/!d;s|.*vim-||;s|.tar.*||' | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
    export LDFLAGS="$LDFLAGS -ltinfo"

    # 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

    # 9.0.0133 unrecognised:
#        --disable-athena-check

    ./configure                \
        --prefix=/usr            \
        --cache-file=$PWD/config.cache    \
        --infodir=/usr/share/info    \
        --mandir=/usr/share/man        \
        --with-features=normal        \
        --with-x=yes            \
        --enable-gui=gtk2        \
        --enable-multibyte        \
        --disable-motif-check        \
        $CONFIGURE_ARGS &&

    make                        \
        VIMRCLOC=/etc/vim            \
        VIMRUNTIMEDIR=/usr/share/vim/vim$basever\
        MAKE="make -e" &&
    make    install                \
        DESTDIR=$DESTDIR

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

    for i in GenericName Keywords
      do
        l="$(grep $i= $DESTDIR/usr/share/applications/vim.desktop)"
        sed -i "/$i=/d;s|$i\[de].*|$l\n&|" $DESTDIR/usr/share/applications/vim.desktop
      done
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share/icons/hicolor/16x16/apps
    mkdir -p $fs/usr/share/applications
    mkdir -p $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
}

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 symbolic link
    ln -sf busybox "$1/bin/vi"
}
6047 packages and 209931 files in current database (Wed Jun 26 15:35:30 2024)