Guest User

Untitled

a guest
Sep 11th, 2019
100
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2.  
  3. # checking for xmkmf... no
  4. # checking for X... (cached) no
  5. # checking if X11 header files can be found... no
  6. # checking --enable-gui argument... no GUI support
  7. # checking for X11/SM/SMlib.h... (cached) no
  8. ## if you meet the above situation on ubuntu 16.04, please follow the following cmd
  9. # sudo apt-get install xorg-dev
  10.  
  11. function colored() {
  12. GREEN=$(tput setaf 22)
  13. YELLOW=$(tput setaf 3)
  14. NORMAL=$(tput sgr0)
  15. REVERSE=$(tput rev)
  16. }
  17.  
  18. function uncolored() {
  19. GREEN=""
  20. YELLOW=""
  21. NORMAL=""
  22. REVERSE=""
  23. }
  24.  
  25. function init_color() {
  26. if [[ -t 1 ]] && [[ -n "$TERM" ]] && command -v tput &>/dev/null && tput colors &>/dev/null; then
  27. ncolors=$(tput colors)
  28. if [[ -n "$ncolors" ]] && [[ "$ncolors" -ge 8 ]] ; then
  29. colored
  30. else
  31. uncolored
  32. fi
  33. else
  34. uncolored
  35. fi
  36.  
  37. return 0
  38. }
  39.  
  40.  
  41. check_dependence() {
  42. command -v checkinstall >/dev/null 2>&1 && {
  43. echo "checking checkinstall command... yes"
  44. } || {
  45. echo "Please run the ${YELLOW}apt-get install checkinstall${NORMAL} to install the checkinstall"
  46. exit 1
  47. }
  48.  
  49. return 0
  50. }
  51.  
  52. compile() {
  53. LDFLAGS="" CPPFLAGS="" CFLAGS="-g -O2" ./configure \
  54. --with-compiledby="bwangel" \
  55. --enable-fail-if-missing \
  56. --enable-cscope \
  57. --enable-gpm \
  58. --enable-selinux \
  59. --disable-smack \
  60. --with-features=huge \
  61. --enable-multibyte \
  62. --enable-acl \
  63. --with-x \
  64. --enable-xim \
  65. --enable-gui=gnome2 \
  66. --disable-gtk2-check \
  67. --enable-gnome-check \
  68. --disable-motif-check \
  69. --disable-athena-check \
  70. --disable-fontset \
  71. --enable-luainterp \
  72. --disable-mzschemeinterp \
  73. --enable-perlinterp \
  74. --enable-pythoninterp \
  75. --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
  76. --enable-python3interp \
  77. --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu \
  78. --enable-tclinterp \
  79. --with-tclsh=/usr/bin/tclsh && make -j$(grep -c '^processor' /proc/cpuinfo) && return 0
  80. }
  81.  
  82. build_deb() {
  83. echo -ne "${REVERSE}${YELLOW}Please enter the password for sudo${NORMAL}\n"
  84.  
  85. sudo checkinstall -D \
  86. --install=no \
  87. --pkgname="b-vim" \
  88. --pkgversion="0.1" \
  89. --pkgrelease=1 \
  90. --backup=no \
  91. --maintainer="'michael tsui <bwangel.me@gmail.com>'" \
  92. --pkgsource="vim" \
  93. --provides="editor" \
  94. --review-control \
  95. --pkggroup="editors" \
  96. && {
  97. return 0
  98. } || {
  99. return 1
  100. }
  101. }
  102.  
  103. main() {
  104. init_color && check_dependence && compile && build_deb
  105. }
  106.  
  107. main
RAW Paste Data