Skip to content

Instantly share code, notes, and snippets.

@bwangelme
Created August 31, 2019 10:19
Show Gist options
  • Save bwangelme/2ea22cd1fc1c38fc9d095ce3d242002c to your computer and use it in GitHub Desktop.
Save bwangelme/2ea22cd1fc1c38fc9d095ce3d242002c to your computer and use it in GitHub Desktop.
build vim
#!/usr/bin/env bash
# checking for xmkmf... no
# checking for X... (cached) no
# checking if X11 header files can be found... no
# checking --enable-gui argument... no GUI support
# checking for X11/SM/SMlib.h... (cached) no
## if you meet the above situation on ubuntu 16.04, please follow the following cmd
# sudo apt-get install xorg-dev
function colored() {
GREEN=$(tput setaf 22)
YELLOW=$(tput setaf 3)
NORMAL=$(tput sgr0)
REVERSE=$(tput rev)
}
function uncolored() {
GREEN=""
YELLOW=""
NORMAL=""
REVERSE=""
}
function init_color() {
if [[ -t 1 ]] && [[ -n "$TERM" ]] && command -v tput &>/dev/null && tput colors &>/dev/null; then
ncolors=$(tput colors)
if [[ -n "$ncolors" ]] && [[ "$ncolors" -ge 8 ]] ; then
colored
else
uncolored
fi
else
uncolored
fi
return 0
}
check_dependence() {
command -v checkinstall >/dev/null 2>&1 && {
echo "checking checkinstall command... yes"
} || {
echo "Please run the ${YELLOW}apt-get install checkinstall${NORMAL} to install the checkinstall"
exit 1
}
return 0
}
compile() {
LDFLAGS="" CPPFLAGS="" CFLAGS="-g -O2" ./configure \
--with-compiledby="bwangel" \
--enable-fail-if-missing \
--enable-cscope \
--enable-gpm \
--enable-selinux \
--disable-smack \
--with-features=huge \
--enable-multibyte \
--enable-acl \
--with-x \
--enable-xim \
--enable-gui=gnome2 \
--disable-gtk2-check \
--enable-gnome-check \
--disable-motif-check \
--disable-athena-check \
--disable-fontset \
--enable-luainterp \
--disable-mzschemeinterp \
--enable-perlinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
--enable-python3interp \
--with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu \
--enable-tclinterp \
--with-tclsh=/usr/bin/tclsh && make -j$(grep -c '^processor' /proc/cpuinfo) && return 0
}
build_deb() {
echo -ne "${REVERSE}${YELLOW}Please enter the password for sudo${NORMAL}\n"
sudo checkinstall -D \
--install=no \
--pkgname="b-vim" \
--pkgversion="0.1" \
--pkgrelease=1 \
--backup=no \
--maintainer="'michael tsui <bwangel.me@gmail.com>'" \
--pkgsource="vim" \
--provides="editor" \
--review-control \
--pkggroup="editors" \
&& {
return 0
} || {
return 1
}
}
main() {
init_color && check_dependence && compile && build_deb
}
main
#!/bin/bash
# checking for xmkmf... no
# checking for X... (cached) no
# checking if X11 header files can be found... no
# checking --enable-gui argument... no GUI support
# checking for X11/SM/SMlib.h... (cached) no
## if you meet the above situation on ubuntu 16.04, please follow the following cmd
# sudo apt-get install xorg-dev
LDFLAGS="" CPPFLAGS="" CFLAGS="-g -O2" ./configure \
--with-compiledby="bwangel" \
--enable-fail-if-missing \
--enable-cscope \
--enable-gpm \
--enable-selinux \
--disable-smack \
--with-features=huge \
--enable-multibyte \
--enable-acl \
--with-x \
--enable-xim \
--enable-gui=gnome2 \
--disable-gtk2-check \
--enable-gnome-check \
--disable-motif-check \
--disable-athena-check \
--disable-fontset \
--enable-luainterp \
--disable-mzschemeinterp \
--enable-perlinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
--enable-python3interp \
--with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu \
--enable-tclinterp \
--with-tclsh=/usr/bin/tclsh && make -j4 && sudo make install && vim --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment