Created
March 4, 2017 06:43
-
-
Save hanetzer/4293aeccc38f5f2b12fb59e25d8ed537 to your computer and use it in GitHub Desktop.
mkxp mingw-64 build arch linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source ../../sources.def | |
if [ $ARCH == i686 ]; then | |
AR=( | |
libmsvcrt-ruby240-static.a | |
) | |
else | |
AR=( | |
libx64-msvcrt-ruby240-static.a | |
) | |
fi | |
AR+=( | |
libSDL2main.a | |
libSDL2_image.a | |
libSDL_sound.a | |
libSDL2_ttf.a | |
libfreetype.a | |
libtiff.a | |
liblzma.a | |
libpng16.a | |
libjpeg.a | |
libvorbisfile.a | |
libvorbis.a | |
libFLAC.a | |
libspeex.a | |
libogg.a | |
libz.a | |
libphysfs.a | |
libpixman-1.a | |
libsigc-2.0.a | |
libSDL2.a | |
libOpenAL32.a | |
# libwebp.a | |
libmodplug.a | |
libboost_program_options-mt.a | |
libiconv.a | |
) | |
AR_FILES=() | |
for ar in ${AR[*]} | |
do | |
AR_FILES+=("/usr/$ARCH-w64-mingw32/lib/${ar}") | |
done | |
BOOST_I=/usr/$ARCH-w64-mingw32/sys-root/mingw/include | |
PKGS=(sigc++-2.0 pixman-1 zlib physfs vorbisfile | |
sdl2 SDL2_image SDL2_ttf SDL_sound openal | |
fluidlite) | |
CXX=$ARCH-w64-mingw32-g++ | |
STRIP=$ARCH-w64-mingw32-strip | |
CFLAGS=$($ARCH-w64-mingw32-pkg-config --cflags ${PKGS[*]}) | |
CFLAGS+=" -I${BOOST_I}" | |
CFLAGS+=" -pipe -O2" | |
RUBY_CFLAGS=$($ARCH-w64-mingw32-pkg-config --cflags ruby-2.4) | |
OPENAL_LDFLAGS=$($ARCH-w64-mingw32-pkg-config --libs openal) | |
LDFLAGS="-lwinmm -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static -lpthread" | |
OBJECTS=() | |
ARG_DESC=( | |
"--link-only" "LINK_ONLY" | |
"--debug" "DEBUG" | |
) | |
# Init option vars to false | |
for (( i=0; i<$((${#ARG_DESC[@]}/2)); i++ )); do | |
arg_var=${ARG_DESC[$((i*2+1))]} | |
declare $arg_var=false | |
done | |
# Parse args | |
for arg in $@; do | |
for (( i=0; i<$((${#ARG_DESC[@]}/2)); i++ )); do | |
if [ ${arg} == ${ARG_DESC[$((i*2))]} ]; then | |
arg_var=${ARG_DESC[$((i*2+1))]} | |
declare $arg_var=true | |
fi | |
done | |
done | |
if [ $DEBUG == true ]; then | |
CFLAGS+=" -g" | |
fi | |
BUILD_DIR=`pwd` | |
cd .. | |
for embed in ${EMBED[*]} | |
do | |
file="${embed}" | |
base=$(basename $file) | |
out="${BUILD_DIR}/${base}.xxd" | |
if [ $LINK_ONLY == false ]; then | |
echo "Generating ${out}" | |
xxd -i $file > "${out}" | |
fi | |
done | |
cd - | |
for res in ${RESOURCES[*]} | |
do | |
file="../${res}" | |
base="$(basename --suffix=.rc $res)" | |
out=${base}.o | |
OBJECTS+=" ${out}" | |
if [ $LINK_ONLY == false ]; then | |
echo "Compiling resource ${out}" | |
$ARCH-w64-mingw32-windres -i $file -o $out | |
fi | |
done | |
for src in ${SOURCES[*]} | |
do | |
file="../${src}" | |
base=$(basename --suffix=.cpp $src) | |
out="${base}.o" | |
OBJECTS+=" ${out}" | |
if [ $LINK_ONLY == false ]; then | |
echo "Compiling ${out}" | |
$CXX -c -o $out $file -I. -I../src -I../assets $CFLAGS | |
fi | |
done | |
for src in ${MRI_SOURCES[*]} | |
do | |
file="../${src}" | |
base=$(basename --suffix=.cpp $src) | |
out="${base}.o" | |
OBJECTS+=" ${out}" | |
if [ $LINK_ONLY == false ]; then | |
echo "Compiling ${out}" | |
$CXX -c -o $out $file -I. -I../src -I../binding-mri $CFLAGS $RUBY_CFLAGS | |
fi | |
done | |
function link_exe { | |
EXE_F="${1}-${ARCH}.exe" | |
echo "Linking ${EXE_F}" | |
$CXX -o $EXE_F ${OBJECTS[*]} -lmingw32 -static-libgcc -static-libstdc++ ${AR_FILES[*]} $LDFLAGS $2 | |
if [ $DEBUG == false ]; then | |
$STRIP -s $EXE_F | |
fi | |
} | |
link_exe mkxp -mwindows & | |
link_exe mkxp-console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOURCES=( | |
src/eventthread.cpp | |
src/windowvx.cpp | |
src/vorbissource.cpp | |
src/vertex.cpp | |
src/scene.cpp | |
src/tileatlas.cpp | |
src/alstream.cpp | |
src/gl-fun.cpp | |
src/viewport.cpp | |
src/main.cpp | |
src/tilemap.cpp | |
src/soundemitter.cpp | |
src/window.cpp | |
src/tilequad.cpp | |
src/audio.cpp | |
src/plane.cpp | |
src/shader.cpp | |
src/input.cpp | |
src/tilemapvx.cpp | |
src/tileatlasvx.cpp | |
src/bundledfont.cpp | |
src/fluid-fun.cpp | |
src/midisource.cpp | |
src/bitmap.cpp | |
src/sprite.cpp | |
src/rgssad.cpp | |
src/filesystem.cpp | |
src/audiostream.cpp | |
src/glstate.cpp | |
src/keybindings.cpp | |
src/sharedstate.cpp | |
src/settingsmenu.cpp | |
src/config.cpp | |
src/autotiles.cpp | |
src/gl-meta.cpp | |
src/sdlsoundsource.cpp | |
src/gl-debug.cpp | |
src/table.cpp | |
src/autotilesvx.cpp | |
src/texpool.cpp | |
src/graphics.cpp | |
src/etc.cpp | |
src/font.cpp | |
) | |
MRI_SOURCES=( | |
binding-mri/bitmap-binding.cpp | |
binding-mri/viewport-binding.cpp | |
binding-mri/plane-binding.cpp | |
binding-mri/tilemap-binding.cpp | |
binding-mri/tilemapvx-binding.cpp | |
binding-mri/filesystem-binding.cpp | |
binding-mri/font-binding.cpp | |
binding-mri/windowvx-binding.cpp | |
binding-mri/binding-util.cpp | |
binding-mri/audio-binding.cpp | |
binding-mri/module_rpg.cpp | |
binding-mri/binding-mri.cpp | |
binding-mri/input-binding.cpp | |
binding-mri/graphics-binding.cpp | |
binding-mri/sprite-binding.cpp | |
binding-mri/table-binding.cpp | |
binding-mri/etc-binding.cpp | |
binding-mri/window-binding.cpp | |
) | |
EMBED=( | |
assets/liberation.ttf | |
assets/icon.png | |
shader/bitmapBlit.frag | |
shader/blur.frag | |
shader/blurH.vert | |
shader/blurV.vert | |
shader/common.h | |
shader/flashMap.frag | |
shader/flatColor.frag | |
shader/gray.frag | |
shader/hue.frag | |
shader/minimal.vert | |
shader/plane.frag | |
shader/simple.frag | |
shader/simple.vert | |
shader/simpleAlpha.frag | |
shader/simpleAlphaUni.frag | |
shader/simpleColor.frag | |
shader/simpleColor.vert | |
shader/simpleMatrix.vert | |
shader/sprite.frag | |
shader/sprite.vert | |
shader/tilemap.vert | |
shader/tilemapvx.vert | |
shader/trans.frag | |
shader/transSimple.frag | |
) | |
RESOURCES=( | |
assets/resource.rc | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment