Advertisement
Ancurio

win32_build.sh

Nov 17th, 2014
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.36 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. SOURCES=(
  4.   src/main.cpp
  5.   src/audio.cpp
  6.   src/bitmap.cpp
  7.   src/eventthread.cpp
  8.   src/filesystem.cpp
  9.   src/font.cpp
  10.   src/input.cpp
  11.   src/plane.cpp
  12.   src/scene.cpp
  13.   src/sprite.cpp
  14.   src/table.cpp
  15.   src/tilequad.cpp
  16.   src/viewport.cpp
  17.   src/window.cpp
  18.   src/texpool.cpp
  19.   src/shader.cpp
  20.   src/glstate.cpp
  21.   src/tilemap.cpp
  22.   src/autotiles.cpp
  23.   src/graphics.cpp
  24.   src/debuglogger.cpp
  25.   src/etc.cpp
  26.   src/config.cpp
  27.   src/settingsmenu.cpp
  28.   src/keybindings.cpp
  29.   src/tileatlas.cpp
  30.   src/sharedstate.cpp
  31.   src/gl-fun.cpp
  32.   src/gl-meta.cpp
  33.   src/vertex.cpp
  34.   src/soundemitter.cpp
  35.   src/sdlsoundsource.cpp
  36.   src/alstream.cpp
  37.   src/audiostream.cpp
  38.   src/rgssad.cpp
  39.   src/bundledfont.cpp
  40.   src/vorbissource.cpp
  41.   src/windowvx.cpp
  42.   src/tilemapvx.cpp
  43.   src/tileatlasvx.cpp
  44.   src/autotilesvx.cpp
  45.   src/midisource.cpp
  46.   src/fluid-fun.cpp
  47. )
  48.  
  49. MRI_SOURCES=(
  50.   binding-mri/binding-mri.cpp
  51.   binding-mri/binding-util.cpp
  52.   binding-mri/table-binding.cpp
  53.   binding-mri/etc-binding.cpp
  54.   binding-mri/bitmap-binding.cpp
  55.   binding-mri/font-binding.cpp
  56.   binding-mri/graphics-binding.cpp
  57.   binding-mri/input-binding.cpp
  58.   binding-mri/sprite-binding.cpp
  59.   binding-mri/viewport-binding.cpp
  60.   binding-mri/plane-binding.cpp
  61.   binding-mri/window-binding.cpp
  62.   binding-mri/tilemap-binding.cpp
  63.   binding-mri/audio-binding.cpp
  64.   binding-mri/module_rpg.cpp
  65.   binding-mri/filesystem-binding.cpp
  66.   binding-mri/windowvx-binding.cpp
  67.   binding-mri/tilemapvx-binding.cpp
  68. )
  69.  
  70. EMBED=(
  71.   shader/transSimple.frag
  72.   shader/trans.frag
  73.   shader/hue.frag
  74.   shader/sprite.frag
  75.   shader/plane.frag
  76.   shader/bitmapBlit.frag
  77.   shader/simple.frag
  78.   shader/simpleColor.frag
  79.   shader/simpleAlpha.frag
  80.   shader/flashMap.frag
  81.   shader/simple.vert
  82.   shader/simpleColor.vert
  83.   shader/sprite.vert
  84.   shader/tilemap.vert
  85.   shader/blur.frag
  86.   shader/blurH.vert
  87.   shader/blurV.vert
  88.   shader/simpleMatrix.vert
  89.   shader/tilemapvx.vert
  90.   assets/liberation.ttf
  91. )
  92.  
  93. AR=(
  94.   libmsvcrt-ruby210-static.a
  95.   libSDL2main.a
  96.   libSDL2_image.a
  97.   libSDL_sound.a
  98.   libSDL2_ttf.a
  99.   libfreetype.a
  100.   libpng16.a
  101.   libjpeg.a
  102.   libvorbisfile.a
  103.   libvorbis.a
  104.   libogg.a
  105.   libz.a
  106.   libphysfs.a
  107.   libpixman-1.a
  108.   libsigc-2.0.a
  109.   libSDL2.a
  110.   libOpenAL32.a
  111. )
  112.  
  113. MINGW_AR=(
  114.   libboost_program_options.a
  115.   libiconv.a
  116. )
  117.  
  118. AR_FILES=()
  119. for ar in ${AR[*]}
  120. do
  121.     AR_FILES+=("../deps-win32/lib/${ar}")
  122. done
  123.  
  124. for ar in ${MINGW_AR[*]}
  125. do
  126.     AR_FILES+=("/usr/i686-w64-mingw32/sys-root/mingw/lib/${ar}")
  127. done
  128.  
  129. BOOST_I=/usr/i686-w64-mingw32/sys-root/mingw/include
  130.  
  131. PKGS=(sigc++-2.0 pixman-1 zlib physfs vorbisfile
  132.       sdl2 SDL2_image SDL2_ttf SDL_sound openal)
  133.      
  134. source ../deps-win32/src/build_env
  135.      
  136. CXX=i686-w64-mingw32-g++
  137. STRIP=i686-w64-mingw32-strip
  138.  
  139. CFLAGS=$(pkg-config --cflags ${PKGS[*]})
  140. CFLAGS+=" -I${BOOST_I}"
  141. CFLAGS+=" -pipe -O2"
  142.  
  143. RUBY_CFLAGS=$(pkg-config --cflags ruby-2.1)
  144.  
  145.  
  146. OPENAL_LDFLAGS=$(pkg-config --libs openal)
  147. LDFLAGS="-lwinmm -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid"
  148.  
  149. OBJECTS=()
  150.  
  151. LINK_ONLY=false
  152. DEBUG=false
  153.  
  154. # Parse args
  155. for arg in $@
  156. do
  157.     if [ "${arg}" == "--link-only" ]; then
  158.         LINK_ONLY=true
  159.     fi
  160.     if [ "${arg}" == "--debug" ]; then
  161.         DEBUG=true
  162.     fi
  163.    
  164. done
  165.  
  166. if [ $DEBUG == true ]; then
  167.     CFLAGS+=" -g"
  168. fi
  169.  
  170. for embed in ${EMBED[*]}
  171. do
  172.     file="../${embed}"
  173.     base=$(basename $file)
  174.     out="${base}.xxd"
  175.  
  176.     if [ $LINK_ONLY == false ]; then
  177.         echo "Generating ${out}"
  178.         xxd -i $file > "${out}"
  179.     fi
  180. done
  181.  
  182. for src in ${SOURCES[*]}
  183. do
  184.     file="../${src}"
  185.     base=$(basename --suffix=.cpp $src)
  186.     out="${base}.o"
  187.     OBJECTS+=" ${out}"
  188.    
  189.     if [ $LINK_ONLY == false ]; then
  190.         echo "Compiling ${out}"
  191.         $CXX -c -o $out $file -I. -I../src $CFLAGS
  192.     fi
  193. done
  194.  
  195. for src in ${MRI_SOURCES[*]}
  196. do
  197.     file="../${src}"
  198.     base=$(basename --suffix=.cpp $src)
  199.     out="${base}.o"
  200.     OBJECTS+=" ${out}"
  201.    
  202.     if [ $LINK_ONLY == false ]; then
  203.         echo "Compiling ${out}"
  204.         $CXX -c -o $out $file -I. -I../src -I../binding-mri $CFLAGS $RUBY_CFLAGS
  205.     fi
  206. done
  207.  
  208. function link_exe {
  209.     EXE_F="${1}.exe"
  210.     echo "Linking ${EXE_F}"
  211.     $CXX -o $EXE_F ${OBJECTS[*]} -lmingw32 -static-libstdc++ -static-libgcc ${AR_FILES[*]} $LDFLAGS $2
  212.     if [ $DEBUG == false ]; then
  213.         $STRIP -s $EXE_F
  214.     fi
  215. }
  216.  
  217. link_exe mkxp -mwindows
  218. link_exe mkxp-console
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement