repository for its build system • git clone https://github.com/chocolate-doom/chocpkg.git • cd chocpkg ./chocpkg/chocpkg build chocolate-doom • It fetches and compiles all of its dependencies • chocolate-doom-3.0.0 • SDL2_mixer-2.0.4 • SDL2_net-2.0.1 • SDL2-2.0.12
a Makefile on how to build a program. • This is easy, if you stay on the same platform … if not, there’s other tools like Autoconf and CMake … they build a build script. To do this they have their own configuration files … http://www.c-howto.de/tutorial/makefiles/
build cmake .. # cmake --build . • I was told there’s a GUI? • cmake-gui • ccmake • If you [C] Configure often enough, you will be able to [G] Generate …
throws a Could NOT find ZMusic (missing: ZMUSIC_LIBRARIES ZMUSIC_INCLUDE_DIR) error. • I was able to build ZMusic on the first try • cmake --build . finally compiles GZDoom, which takes ages on my MacBook Air (13-inch, Mid 2013). • ./gzdoom.app/Contents/MacOS/gzdoom
a base level, fairly simple.” – Emscripten Tutorial • “Building large projects with Emscripten is very easy. Emscripten provides two simple scripts that configure your makefiles to use emcc as a drop-in replacement for gcc — in most cases the rest of your project’s current build system remains unchanged.” – Building Projects
./configure emmake make • emcc project.bc -o project.html • emcc compiles the bytecode generated by make to JavaScript, builds a project.html file as an output, as well as an accompanying project.js launcher file, and a project.wasm WebAssembly file.
Doom by Sam Lantinga • Released in 1998, its based on the code released by id Software in 1997 • Simple DirectMedia Layer? • Sam Lantinga? • It’s a single folder with C code and a configure then make build process
hack this file for your BSD sockets layer • SDL_byteorder.h file not found • implicitly declaring library function alloca 2. Fixing runtime errors • failure to dynamicAlloc • Game mode indeterminate. • Uncaught CopyOnLock is not supported for SDL_LockSurface • The game shows a black screen, then halts at the closing credits • wasm streaming compile failed 3. Profit
is always daunting • Stuff you wrote may not run in a couple of years/months • Front-End Developers are not the only people … • … dealing with platform-specific problems • … creating overly complex, nested build systems • Don’t try to tackle the complex problem first, start small
after 27 years • Porting C code to the web platform is not a one-click solution, even with tools like Emscripten • Ports can be impressive work on their own • Sh*t about the Doom engine (not part of this talk)