Skip to content

Instantly share code, notes, and snippets.

@koturn
Last active May 25, 2016 10:48
Show Gist options
  • Save koturn/92b4ee639e6f1fe2c955 to your computer and use it in GitHub Desktop.
Save koturn/92b4ee639e6f1fe2c955 to your computer and use it in GitHub Desktop.
Vimのビルド用スクリプト等
@echo off
if not exist "vim-kaoriya-patches" (
git clone https://github.com/koron/vim-kaoriya-patches.git
)
git apply --check vim-kaoriya-patches/master/*.diff
git apply vim-kaoriya-patches/master/*.diff
#!/bin/sh -eu
if [ ! -d 'vim-kaoriya-patches' ]; then
git clone https://github.com/koron/vim-kaoriya-patches.git
fi
git apply --check vim-kaoriya-patches/master/*.diff
git apply vim-kaoriya-patches/master/*.diff
@echo off
setlocal ENABLEDELAYEDEXPANSION
set PROGNAME=%0
set BUILD_TARGET=gui
:OPTPARSE_START
set OPT=%1
if "%~1" == "" (
goto OPTPARSE_END
) else if "%~1" == "-c" (
set BUILD_TARGET=cui
) else if "%~1" == "--cui" (
set BUILD_TARGET=cui
) else if "%~1" == "--clean" (
set BUILD_TARGET=clean
) else if "%~1" == "--clean-all" (
set BUILD_TARGET=cleanall
) else if "%~1" == "-g" (
set BUILD_TARGET=gui
) else if "%~1" == "--gui" (
set BUILD_TARGET=gui
) else if "%~1" == "-h" (
call :SHOW_USAGE
exit /b
) else if "%~1" == "--help" (
call :SHOW_USAGE
exit /b
)
shift
goto OPTPARSE_START
:OPTPARSE_END
set USERNAME=jeak.koutan.apple
set USERDOMAIN=gmail.com
set LUA_PATH=C:\CommonUtil\lua
set LUA_VERSION=5.2
set PERL_PATH=C:\Perl64\bin
set PERL_VERSION=516
set PYTHON2_PATH=C:\Python27
set PYTHON2_VERSION=27
set PYTHON3_PATH=C:\Python33
set PYTHON3_VERSION=33
:: set RUBY_PATH=C:\Ruby200-x64\bin
:: set RUBY_VERSION=20
:: set RUBY_VERSION_LONG=2.0.0
:: set RUBY_INCLUDE=%RUBY_PATH%\..\include\ruby-2.0.0;%RUBY_PATH%\..\include\ruby-2.0.0\x64-mingw32
:: RUBY="%RUBY_PATH%"
:: RUBY_VER="%RUBY_VERSION%"
:: RUBY_VER_LONG="%RUBY_VERSION_LONG%"
set WIN32MAK_PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
set LUA_INCLUDE=%LUA_PATH%\lib\include
set INCLUDE=%INCLUDE%;%WIN32MAK_PATH%;%LUA_INCLUDE%;%RUBY_INCLUDE%
set P_ARCH=x86_amd64
@if %P_ARCH% == x86 set P_CPU=i386
@if %P_ARCH% == x86 set DEFINES=-D_USING_V110_SDK71_
@if %P_ARCH% == x86_amd64 set P_CPU=AMD64
set DEFINES=%DEFINES% ^
-DNDEBUG ^
-DMODIFIED_BY=\"\\\"%USERNAME%@%USERDOMAIN%\\\"\"
cd src
if "%BUILD_TARGET%" == "cui" (
call :BUILD_CUI
) else if "%BUILD_TARGET%" == "gui" (
call :BUILD_GUI
) else if "%BUILD_TARGET%" == "clean" (
call :CLEAN
) else if "%BUILD_TARGET%" == "cleanall" (
call :CLEANALL
)
cd ..
exit /b
:SHOW_USAGE
echo [Usage]
echo %PROGNAME% [Option]
echo [Options]
echo -c, --cui
echo Build cui-vim
echo --clean
echo Clean objects
echo --clean-all
echo Clean objects and executable binaries
echo -g, --gui
echo Build gui-vim
echo -h, --help
echo Show usage and exit
exit /b
:CLEAN
nmake -f Make_mvc.mak clean
exit /b
:CLEANALL
call :CLEAN
del *.exe Obj*
exit /b
:BUILD_CUI
nmake -f Make_mvc.mak ^
CPU="%P_CPU%" ^
CSCOPE=yes ^
DEBUG=no ^
DEFINES="%DEFINES%" ^
FEATURES=HUGE ^
GUI=no ^
ICONV=yes ^
MBYTE=yes ^
MIGEMO= ^
NETBEANS=yes ^
LUA="%LUA_PATH%" ^
LUA_VER="%LUA_VERSION%" ^
DYNAMIC_LUA=yes ^
PYTHON="%PYTHON2_PATH%" ^
PYTHON_VER="%PYTHON2_VERSION%" ^
DYNAMIC_PYTHON=yes ^
PYTHON3="%PYTHON3_PATH%" ^
PYTHON3_VER="%PYTHON3_VERSION%" ^
DYNAMIC_PYTHON3=yes ^
DYNAMIC_RUBY=yes
exit /b
:BUILD_GUI
nmake -f Make_mvc.mak ^
CPU="%P_CPU%" ^
CSCOPE=yes ^
DEBUG=no ^
DEFINES="%DEFINES%" ^
DIRECTX=yes ^
FEATURES=HUGE ^
GUI=yes ^
ICONV=yes ^
IME=yes ^
MBYTE=yes ^
MIGEMO= ^
NETBEANS=yes ^
LUA="%LUA_PATH%" ^
LUA_VER="%LUA_VERSION%" ^
DYNAMIC_LUA=yes ^
PYTHON="%PYTHON2_PATH%" ^
PYTHON_VER="%PYTHON2_VERSION%" ^
DYNAMIC_PYTHON=yes ^
PYTHON3="%PYTHON3_PATH%" ^
PYTHON3_VER="%PYTHON3_VERSION%" ^
DYNAMIC_PYTHON3=yes
exit /b
#!/bin/sh -eu
show_usage() {
echo '[Usage]'
echo " $0 [options] [arguments]"
echo '[Option]'
echo ' -c, --clean'
echo ' Delete configure cache'
echo ' -p PLATFORM, --platform=PLATFORM'
echo ' Specify platform'
echo ' cygwin: for cygwin'
echo ' linux: for linux (default)'
echo ' -h, --help'
echo ' Show help and exit'
}
case ${OSTYPE} in
cygwin | msys)
platform=cygwin
;;
*)
platform=linux
;;
esac
unset GETOPT_COMPATIBLE
OPT=`getopt -o cp:h -l clean,platform:,help -- "$@"`
if [ $? -ne 0 ]; then
echo >&2 'Invalid argument'
show_usage >&2
exit 1
fi
eval set -- "$OPT"
while [ $# -gt 0 ]; do
case $1 in
-c | --clean)
rm src/auto/config.cache
make clean
exit 0
;;
-p | --platform)
platform=$2
shift
;;
-h | --help)
show_usage
exit 0
;;
--)
shift
break
;;
esac
shift
done
build_cygwin() {
./configure \
--prefix=/usr/local/ \
--enable-fail-if-missing \
--enable-gui=no \
--enable-multibyte=yes \
--enable-perlinterp=yes \
--enable-pythoninterp=yes \
--enable-rubyinterp=yes \
--enable-luainterp=yes \
--enable-tclinterp=yes \
--enable-cscope=yes \
--enable-gpm \
--enable-cscope \
--enable-fontset \
--with-features=huge \
--without-x \
--with-lua-prefix=/usr/local \
--with-modified-by=koturn \
--with-compiledby=koturn \
CFLAGS='-Ofast -march=native -mtune=native -funroll-loops -DNDEBUG' \
LDFLAGS='-s -Ofast' && \
make && \
make install
}
build_linux() {
./configure \
--prefix=/usr/local/ \
--enable-fail-if-missing \
--enable-gui=yes \
--enable-multibyte=yes \
--enable-perlinterp=yes \
--enable-pythoninterp=yes \
--enable-luainterp=yes \
--enable-cscope=yes \
--enable-gpm \
--enable-cscope \
--enable-fontset \
--enable-xim \
--disable-selinux \
--with-features=huge \
--with-x \
--with-gnome \
--with-lua-prefix=/usr/local \
--with-modified-by=koturn \
--with-compiledby=koturn \
CFLAGS='-Ofast -m64 -march=native -mtune=native -funroll-loops -DNDEBUG' \
LDFLAGS='-s -Ofast' && \
make -j2 && \
sudo make install
}
case $platform in
cygwin)
build_cygwin
;;
linux)
build_linux
;;
*)
echo 'Invalid platform name' >&2
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment