Last active
April 15, 2020 16:49
-
-
Save thomasballinger/5bffacaf1c6d168fa265ada2000ff27d to your computer and use it in GitHub Desktop.
This file contains 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
# Starting with Ubuntu 18.04.3 (LTS) x64 | |
# I'm using a local VMwareFusion vm instead of Docker or something because I want to be able to test with a video device. | |
# New install | |
# (not shown) make account, enable ssh, add vm to /etc/hosts | |
ssh vm | |
apt-get update | |
sudo apt install git | |
git clone https://github.com/endless-sky/endless-sky.git | |
sudo apt install g++ \ | |
scons \ | |
libsdl2-dev \ | |
libpng-dev \ | |
libjpeg-dev \ | |
libgl1-mesa-dev \ | |
libglew-dev \ | |
libopenal-dev \ | |
libmad0-dev | |
(this is from readme-developer.txt in the repo) | |
cd endless-sky | |
scons | |
./endless-sky | |
# Ok so the project works when compiled normally. | |
cd | |
git clone https://github.com/emscripten-core/emsdk.git | |
cd emsdk | |
./emsdk install latest | |
./emsdk activate latest | |
source ./emsdk_env.sh | |
# Now to start changing things in the SConstruct file | |
# hardcode emscripten as CXX compiler | |
env['CXX'] = 'em++' | |
# use SDL | |
env['CXXFLAGS'] = '-s USE_SDL=2' | |
# At this point I start iterating on a new command, I'll port the changes back once I figure them out | |
em++ -o build/release/ImageBuffer.o -c -s USE_SDL=2 -s SDL2_IMAGE_FORMATS='["png", "jpg"]' -std=c++11 -Wall -O3 source/ImageBuffer.cpp | |
# Fix some errors | |
# bool / boolean | |
- jpeg_read_header(&cinfo, true); | |
+ jpeg_read_header(&cinfo, boolean(true)); | |
# can't find JCS_EXT_BGRA | |
# Just for now, I bet I still see SOMETHING if I take the alpha channel out? | |
- cinfo.out_color_space = JCS_EXT_BGRA; | |
+ cinfo.out_color_space = JCS_BG_RGB; | |
# source/ImageBuffer.cpp is compiling now, so let's keep going! | |
# Running scons gives our next error: | |
# source/Music.cpp:17:10: fatal error: 'mad.h' file not found | |
# I wonder what mad is? looks like mpeg stuff | |
# https://packages.ubuntu.com/bionic/libmad0-dev | |
# I don't see this on https://github.com/emscripten-ports, is that the full list? | |
# I think I'm supposed to build it with emconfigure / make install, then change the linker path or something? | |
# Maybe it's time to go back to reading the emscripten tutorial. | |
# https://emscripten.org/docs/compiling/Building-Projects.html#using-libraries | |
# New command to iterate on: (this reproduces the error) | |
em++ -o build/release/Music.o -c -s USE_SDL=2 -s SDL2_IMAGE_FORMATS='["png", "jpg"]' -std=c++11 -Wall -O3 source/Music.cpp | |
apt install curl | |
curl 'http://archive.ubuntu.com/ubuntu/pool/universe/libm/libmad/libmad_0.15.1b.orig.tar.gz' --output libmad.tar.gz | |
tar xzf libmad.tar.gz | |
cd libmad-0.15.1b/ | |
curl 'http://archive.ubuntu.com/ubuntu/pool/universe/libm/libmad/libmad_0.15.1b-9ubuntu18.04.1.diff.gz' --output libmad.diff.gz | |
gunzip libmad.diff.gz | |
patch -i libmad.diff | |
emconfigure ./configure | |
emmake make | |
# Lots of errors! | |
# clang-11: error: unknown argument: '-fforce-mem' | |
# clang-11: error: unknown argument: '-fthread-jumps' | |
# clang-11: error: unknown argument: '-fcse-follow-jumps' | |
# clang-11: error: unknown argument: '-fcse-skip-blocks' | |
# clang-11: error: unknown argument: '-fregmove' | |
# I wonder what to do about these. I think I should do more research in case there is a port somewhere out there. | |
# It looks like there is maybe? Something about SDL_mixer and a flag for libmad? | |
# https://github.com/emscripten-ports/SDL2_mixer | |
# I'm stopping for now, but I think I'm already where I got to last year when I tried to do this! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment