#!/bin/bash ulimit -s unlimited shopt -s extglob # vim.SlackBuild # by Stuart Winter for the Slackware porting Project. # Heavily based on the original Slackware build script. # 20-Jun-2004 # # Copyright 2008, 2009, 2010, 2013, 2016 Patrick J. Volkerding, Sebeka, Minnesota, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Paths to skeleton port's source & real Slackware source tree: slackset_var_cwds # Update these with each re-build/upgrade: XSB=$CWD/$PKGNAM.SlackBuild [ ! -x $XSB ] && { echo "ERROR: Cannot find x86 SlackBuild for ${PKGNAM}!" ; exit 1; } for upstreamvar in \ VIMBRANCH \ CTAGSVER \ ; do eval $( grep -E "^${upstreamvar}=" $XSB ) echo "Upstream variable: ${upstreamvar} version $( eval $( echo "echo \$${upstreamvar}" ) )" done # The possible settings for this are yes/no/dynamic. PERLINTERP=${PERLINTERP:-dynamic} # The possible settings for this are yes/no/dynamic. LUAINTERP=${LUAINTERP:-dynamic} # Version of VIM is taken from the Slackware64 source tree # rather than the arm/build script # The Slackware script also downloads if it's missing but we don't need to do that. #pushd $CWD #VERSION=$(echo vim-${VIMBRANCH}*.tar.!(*sign|*asc|*sig) | rev | cut -f 3- -d . | cut -f 1 -d - | rev) #VERSION="$(wget -q -O - https://github.com/vim/vim/tags | grep v${VIMBRANCH} | head -n 1 | sed "s/^.*v${VIMBRANCH}/v${VIMBRANCH}/" | cut -f 1 -d '<' | tr -d v)" #popd echo "VIM version: $VERSION" echo "VIM branch : $VIMBRANCH" # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # If dynamic support for Ruby works with this $ARCH, then allow it: # needs checking for A64 if [ "$ARCH" = "x86_64" ]; then RUBYDYNAMIC="=dynamic" fi ###### Build ctags################################################### cd $TMPBUILD tar xvvf $CWD/ctags-$CTAGSVER.tar.!(*sign|*asc|*sig) cd ctags-$CTAGSVER || failextract slackhousekeeping # # Apply CTAGS patches: # # patch to solve an issue introduced by glibc-2.34 from http://deb.debian.org/debian/pool/main/e/exuberant-ctags/exuberant-ctags_5.9~svn20110310-15.debian.tar.xz zcat $CWD/ctags.use-conventional-unused-marker.patch.gz | patch -Esp1 --verbose || exit 1 # Configure: CFLAGS="$SLKCFLAGS" \ LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}" \ ./configure \ --prefix=/usr \ --build=${SLK_ARCH_BUILD} || failconfig # Build: make $NUMJOBS || make || failmake # Install binary: mkdir -p $PKG/usr/bin install -m755 ctags $PKG/usr/bin # Install man pages: mkdir -p $PKG/usr/man/man1 install -m644 ctags.1 $PKG/usr/man/man1 # Install docs: mkdir -p $PKG/usr/doc/ctags-$CTAGSVER cp -fav \ COPYING* EXTENDING.html FAQ INSTALL INSTALL.oth NEWS README* \ $PKG/usr/doc/ctags-$CTAGSVER ##### Build vim without X support###################################### config_vim() { CFLAGS=-O2 \ ./configure \ $* \ --prefix=/usr \ --enable-luainterp=$LUAINTERP \ --disable-canberra \ --enable-multibyte \ --enable-cscope \ --enable-perlinterp=$PERLINTERP \ --enable-pythoninterp=no \ --enable-python3interp=dynamic \ --enable-rubyinterp${RUBYDYNAMIC} \ --enable-tclinterp=dynamic \ --with-features=huge \ --with-compiledby="" \ --build=${SLK_ARCH_BUILD} } # Extract source: cd $TMPBUILD tar xvvf $CWD/vim-${VERSION}.tar.!(*sign|*asc|*sig) slackhousekeeping cd vim*/ || failextract # # Apply VIM patches: # # Configure: config_vim \ --without-x \ --disable-gui || failconfig # Build: make $NUMJOBS || make || failmake # Install into package: make install DESTDIR=$PKG rsync -lprvt $PKG/usr/share/man/ $PKG/usr/man/ rm -r $PKG/usr/share/man # Don't make backups in /var/spool/cron/*, which fixes "crontab -e": zcat $CWD/vim.vimrc.diff.gz | patch -p1 --verbose || exit 1 cp -a runtime/vimrc_example.vim runtime/vimrc.new # Add patched vimrc to the package: cat runtime/vimrc.new > $PKG/usr/share/vim/vimrc.new # Don't package gvim.desktop - it will be included in the vim-gvim package: rm -f $PKG/usr/share/applications/gvim.desktop # Remove empty directory: rmdir $PKG/usr/share/applications # Legacy binary links: ( cd $PKG/usr/bin ; rm -rf rview ) ( cd $PKG/usr/bin ; ln -sf vim rview ) ( cd $PKG/usr/bin ; rm -rf rvim ) ( cd $PKG/usr/bin ; ln -sf vim rvim ) ( cd $PKG/usr/bin ; rm -rf view ) ( cd $PKG/usr/bin ; ln -sf vim view ) ( cd $PKG/usr/bin ; rm -rf eview ) ( cd $PKG/usr/bin ; ln -sf vim eview ) ( cd $PKG/usr/bin ; rm -rf evim ) ( cd $PKG/usr/bin ; ln -sf vim evim ) # These should not be shipped: rm -fv $PKG/usr/bin/{ex,vi} # Copy docs: mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION cp -fav README.txt \ $PKG/usr/doc/$PKGNAM-$VERSION ( cd $PKG/usr/doc/$PKGNAM-$VERSION ; rm -rf doc ) ( cd $PKG/usr/doc/$PKGNAM-$VERSION ; ln -sf ../../share/vim/vim$(echo $VIMBRANCH | tr -d .) doc ) # Move the vim.desktop into the docs directory. There's really not much use # for this .desktop file. It's easy enough to just open a terminal and run # vim in it without this. mv -fv $PKG/usr/share/applications/vim.desktop $PKG/usr/doc/$PKGNAM-$VERSION # Package description & install script: mkdir -pm755 $PKG/install install -m644 $CWD/slack-desc.vim $PKG/install/slack-desc zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh ##################################################################### # Set generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs #slackstriprpaths # strip rpaths slack_delete_lafiles # delete usr/lib{,64}/*.la slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # set all files to root.root, chmod -R og-w, slackchown, slack644docs # Need to re-create the package name in a variable since it was set in # arm/build with a place hoder version of 0.00. export SLACKPACKAGE=$PKGNAM-$VERSION-$PKGARCH-$BUILD.txz slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links