Index: Makefile =================================================================== --- Makefile (revision 497616) +++ Makefile (working copy) @@ -22,7 +22,8 @@ libfluidsynth.so:audio/fluidsynth \ libgme.so:audio/libgme -USES= cmake gettext jpeg openal pkgconfig +USES= cmake compiler:openmp gettext gl gnome jpeg openal pkgconfig \ + sdl DATADIR= ${DMDIR}/${PORTNAME} @@ -43,6 +44,10 @@ .include "${.CURDIR}/../doom-data/Makefile.include" +.if exists(/usr/lib/libstdc++.so) +USE_GCC= yes +.endif + do-install: ${MKDIR} ${STAGEDIR}${DATADIR} ${INSTALL_PROGRAM} ${CONFIGURE_WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin Index: files/patch-CMakeLists.txt =================================================================== --- files/patch-CMakeLists.txt (nonexistent) +++ files/patch-CMakeLists.txt (working copy) @@ -0,0 +1,55 @@ +--- CMakeLists.txt.orig 2019-01-20 17:58:02 UTC ++++ CMakeLists.txt +@@ -163,10 +163,22 @@ option( NO_OPENAL "Disable OpenAL sound support" OFF ) + find_package( BZip2 ) + find_package( JPEG ) + find_package( ZLIB ) +-# find_package( asmjit ) +- # no, we're not using external asmjit for now, we made too many modifications to our's. +- # if the asmjit author uses our changes then we'll update this. + ++include( TargetArch ) ++ ++target_architecture(ZDOOM_TARGET_ARCH) ++ ++if( ${ZDOOM_TARGET_ARCH} MATCHES "x86_64" ) ++ set( HAVE_VM_JIT ON ) ++endif() ++ ++# no, we're not using external asmjit for now, we made too many modifications to our's. ++# if the asmjit author uses our changes then we'll update this. ++ ++#if( ${HAVE_VM_JIT} ) ++# find_package( asmjit ) ++#endif() ++ + # GME + find_path( GME_INCLUDE_DIR gme/gme.h ) + find_library( GME_LIBRARIES gme ) +@@ -297,15 +309,17 @@ else() + set( ZLIB_LIBRARY z ) + endif() + +-if( ASMJIT_FOUND AND NOT FORCE_INTERNAL_ASMJIT ) +- message( STATUS "Using system asmjit, includes found at ${ASMJIT_INCLUDE_DIR}" ) +-else() +- message( STATUS "Using internal asmjit" ) +- set( SKIP_INSTALL_ALL TRUE ) # Avoid installing asmjit alongside zdoom +- add_subdirectory( asmjit ) +- set( ASMJIT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/asmjit ) +- set( ASMJIT_LIBRARIES asmjit ) +- set( ASMJIT_LIBRARY asmjit ) ++if( ${HAVE_VM_JIT} ) ++ if( ASMJIT_FOUND AND NOT FORCE_INTERNAL_ASMJIT ) ++ message( STATUS "Using system asmjit, includes found at ${ASMJIT_INCLUDE_DIR}" ) ++ else() ++ message( STATUS "Using internal asmjit" ) ++ set( SKIP_INSTALL_ALL TRUE ) # Avoid installing asmjit alongside zdoom ++ add_subdirectory( asmjit ) ++ set( ASMJIT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/asmjit ) ++ set( ASMJIT_LIBRARIES asmjit ) ++ set( ASMJIT_LIBRARY asmjit ) ++ endif() + endif() + + if( JPEG_FOUND AND NOT FORCE_INTERNAL_JPEG ) Property changes on: files/patch-CMakeLists.txt ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_CMakeLists.txt =================================================================== --- files/patch-src_CMakeLists.txt (nonexistent) +++ files/patch-src_CMakeLists.txt (working copy) @@ -0,0 +1,91 @@ +--- src/CMakeLists.txt.orig 2019-01-20 17:58:02 UTC ++++ src/CMakeLists.txt +@@ -13,7 +13,6 @@ include( CheckIncludeFile ) + include( CheckIncludeFiles ) + include( CheckLibraryExists ) + include( FindPkgConfig ) +-include( TargetArch ) + + if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) + option( NO_STRIP "Do not strip Release or MinSizeRel builds" ) +@@ -33,8 +32,6 @@ if( APPLE ) + option( OSX_COCOA_BACKEND "Use native Cocoa backend instead of SDL" ON ) + endif() + +-target_architecture(ZDOOM_TARGET_ARCH) +- + if( ${ZDOOM_TARGET_ARCH} MATCHES "x86_64" ) + set( X64 64 ) + endif() +@@ -460,9 +457,15 @@ add_custom_target( revision_check ALL + # Libraries ZDoom needs + + message( STATUS "Fluid synth libs: ${FLUIDSYNTH_LIBRARIES}" ) +-set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${GME_LIBRARIES}" "${ASMJIT_LIBRARIES}" "${CMAKE_DL_LIBS}" ) +-include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${ASMJIT_INCLUDE_DIR}" ) ++set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${GME_LIBRARIES}" "${CMAKE_DL_LIBS}" ) ++include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" ) + ++if( ${HAVE_VM_JIT} ) ++ add_definitions( -DHAVE_VM_JIT ) ++ include_directories( "${ASMJIT_INCLUDE_DIR}" ) ++ set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ASMJIT_LIBRARIES}") ++endif() ++ + if( SNDFILE_FOUND ) + set( ZDOOM_LIBS ${ZDOOM_LIBS} "${SNDFILE_LIBRARIES}" ) + include_directories( "${SNDFILE_INCLUDE_DIRS}" ) +@@ -799,6 +802,17 @@ set( NOT_COMPILED_SOURCE_FILES + zcc-parse.h + ) + ++set( VM_JIT_SOURCES ++ scripting/vm/jit.cpp ++ scripting/vm/jit_runtime.cpp ++ scripting/vm/jit_call.cpp ++ scripting/vm/jit_flow.cpp ++ scripting/vm/jit_load.cpp ++ scripting/vm/jit_math.cpp ++ scripting/vm/jit_move.cpp ++ scripting/vm/jit_store.cpp ++) ++ + # This is disabled for now because I cannot find a way to give the .pch file a different name. + # Visual C++ 2015 seems hell-bent on only allowing one .pch file with the same name as the executable. + #enable_precompiled_headers( g_pch2.h FASTMATH_PCH_SOURCES ) +@@ -1174,14 +1188,6 @@ set (PCH_SOURCES + scripting/decorate/thingdef_states.cpp + scripting/vm/vmexec.cpp + scripting/vm/vmframe.cpp +- scripting/vm/jit.cpp +- scripting/vm/jit_runtime.cpp +- scripting/vm/jit_call.cpp +- scripting/vm/jit_flow.cpp +- scripting/vm/jit_load.cpp +- scripting/vm/jit_math.cpp +- scripting/vm/jit_move.cpp +- scripting/vm/jit_store.cpp + scripting/zscript/ast.cpp + scripting/zscript/zcc_compile.cpp + scripting/zscript/zcc_parser.cpp +@@ -1256,6 +1262,12 @@ set (PCH_SOURCES + events.cpp + ) + ++if( ${HAVE_VM_JIT} ) ++ set( PCH_SOURCES ${PCH_SOURCES} ${VM_JIT_SOURCES} ) ++else() ++ set( NOT_COMPILED_SOURCE_FILES ${NOT_COMPILED_SOURCE_FILES} ${VM_JIT_SOURCES} ) ++endif() ++ + enable_precompiled_headers( g_pch.h PCH_SOURCES ) + + add_executable( zdoom WIN32 MACOSX_BUNDLE +@@ -1263,7 +1275,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE + ${NOT_COMPILED_SOURCE_FILES} + __autostart.cpp + ${SYSTEM_SOURCES} +- ${X86_SOURCES} + ${FASTMATH_SOURCES} + ${PCH_SOURCES} + x86.cpp Property changes on: files/patch-src_CMakeLists.txt ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_d__dehacked.cpp =================================================================== --- files/patch-src_d__dehacked.cpp (nonexistent) +++ files/patch-src_d__dehacked.cpp (working copy) @@ -0,0 +1,18 @@ +--- src/d_dehacked.cpp.orig 2019-01-20 17:58:02 UTC ++++ src/d_dehacked.cpp +@@ -807,6 +807,7 @@ void SetDehParams(FState *state, int codepointer) + } + fclose(dump); + } ++#ifdef HAVE_VM_JIT + if (Args->CheckParm("-dumpjit")) + { + FILE *dump = fopen("dumpjit.txt", "a"); +@@ -816,6 +817,7 @@ void SetDehParams(FState *state, int codepointer) + } + fclose(dump); + } ++#endif // HAVE_VM_JIT + } + } + Property changes on: files/patch-src_d__dehacked.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_files.h =================================================================== --- files/patch-src_files.h (nonexistent) +++ files/patch-src_files.h (working copy) @@ -0,0 +1,19 @@ +--- src/files.h.orig 2019-04-03 11:53:53 UTC ++++ src/files.h +@@ -261,14 +261,14 @@ class FileReader (public) + { + uint32_t v = 0; + Read(&v, 4); +- return BigLong(v); ++ return BigLong(uint32_t(v)); + } + + int32_t ReadInt32BE() + { + uint32_t v = 0; + Read(&v, 4); +- return BigLong(v); ++ return BigLong(uint32_t(v)); + } + + Property changes on: files/patch-src_files.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_hwrenderer_scene_hw__bsp.cpp =================================================================== --- files/patch-src_hwrenderer_scene_hw__bsp.cpp (nonexistent) +++ files/patch-src_hwrenderer_scene_hw__bsp.cpp (working copy) @@ -0,0 +1,29 @@ +--- src/hwrenderer/scene/hw_bsp.cpp.orig 2019-03-24 01:44:59 UTC ++++ src/hwrenderer/scene/hw_bsp.cpp +@@ -40,7 +40,10 @@ + #include "hwrenderer/scene/hw_portal.h" + #include "hwrenderer/utility/hw_clock.h" + #include "hwrenderer/data/flatvertices.h" ++ ++#ifdef ARCH_IA32 + #include ++#endif + + CVAR(Bool, gl_multithread, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) + +@@ -106,6 +109,7 @@ void HWDrawInfo::WorkerThread() + auto job = jobQueue.GetJob(); + if (job == nullptr) + { ++#ifdef ARCH_IA32 + // The queue is empty. But yielding would be too costly here and possibly cause further delays down the line if the thread is halted. + // So instead add a few pause instructions and retry immediately. + _mm_pause(); +@@ -118,6 +122,7 @@ void HWDrawInfo::WorkerThread() + _mm_pause(); + _mm_pause(); + _mm_pause(); ++#endif + } + // Note that the main thread MUST have prepared the fake sectors that get used below! + // This worker thread cannot prepare them itself without costly synchronization. Property changes on: files/patch-src_hwrenderer_scene_hw__bsp.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_m__png.cpp =================================================================== --- files/patch-src_m__png.cpp (nonexistent) +++ files/patch-src_m__png.cpp (working copy) @@ -0,0 +1,31 @@ +--- src/m_png.cpp.orig 2019-04-03 12:02:26 UTC ++++ src/m_png.cpp +@@ -139,8 +139,8 @@ bool M_CreatePNG (FileWriter *file, const uint8_t *buf + sig[0] = MAKE_ID(137,'P','N','G'); + sig[1] = MAKE_ID(13,10,26,10); + +- ihdr->Width = BigLong(width); +- ihdr->Height = BigLong(height); ++ ihdr->Width = BigLong(int(width)); ++ ihdr->Height = BigLong(int(height)); + ihdr->BitDepth = 8; + ihdr->ColorType = color_type == SS_PAL ? 3 : 2; + ihdr->Compression = 0; +@@ -261,7 +261,7 @@ bool M_AppendPNGText (FileWriter *file, const char *ke + { + crc = AddCRC32 (crc, (uint8_t *)text, len); + } +- crc = BigLong(crc); ++ crc = BigLong(uint32_t(crc)); + return file->Write (&crc, 4) == 4; + } + return false; +@@ -1036,7 +1036,7 @@ static bool WriteIDAT (FileWriter *file, const uint8_t + { + uint32_t foo[2], crc; + +- foo[0] = BigLong (len); ++ foo[0] = BigLong (int(len)); + foo[1] = MAKE_ID('I','D','A','T'); + crc = CalcCRC32 ((uint8_t *)&foo[1], 4); + crc = BigLong ((unsigned int)AddCRC32 (crc, data, len)); Property changes on: files/patch-src_m__png.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_m__swap.h =================================================================== --- files/patch-src_m__swap.h (nonexistent) +++ files/patch-src_m__swap.h (working copy) @@ -0,0 +1,19 @@ +--- src/m_swap.h.orig 2019-04-03 11:35:28 UTC ++++ src/m_swap.h +@@ -129,6 +129,16 @@ inline int BigLong(int &x) + return x; + } + ++inline unsigned int BigLong(unsigned int x) ++{ ++ return x; ++} ++ ++inline int BigLong(int x) ++{ ++ return x; ++} ++ + #else + + inline short LittleShort(short x) Property changes on: files/patch-src_m__swap.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_resourcefiles_file__wad.cpp =================================================================== --- files/patch-src_resourcefiles_file__wad.cpp (nonexistent) +++ files/patch-src_resourcefiles_file__wad.cpp (working copy) @@ -0,0 +1,24 @@ +--- src/resourcefiles/file_wad.cpp.orig 2019-04-03 12:22:12 UTC ++++ src/resourcefiles/file_wad.cpp +@@ -158,8 +158,8 @@ bool FWadFile::Open(bool quiet) + // This should be sufficient to detect big endian wads. + if (InfoTableOfs + NumLumps*sizeof(wadlump_t) > (unsigned)wadSize) + { +- NumLumps = BigLong(header.NumLumps); +- InfoTableOfs = BigLong(header.InfoTableOfs); ++ NumLumps = BigLong(uint32_t(header.NumLumps)); ++ InfoTableOfs = BigLong(uint32_t(header.InfoTableOfs)); + isBigEndian = true; + + // Check again to detect broken wads +@@ -183,8 +183,8 @@ bool FWadFile::Open(bool quiet) + Lumps[i].Name[0] &= ~0x80; + + Lumps[i].Owner = this; +- Lumps[i].Position = isBigEndian ? BigLong(fileinfo[i].FilePos) : LittleLong(fileinfo[i].FilePos); +- Lumps[i].LumpSize = isBigEndian ? BigLong(fileinfo[i].Size) : LittleLong(fileinfo[i].Size); ++ Lumps[i].Position = isBigEndian ? BigLong(int(fileinfo[i].FilePos)) : LittleLong(fileinfo[i].FilePos); ++ Lumps[i].LumpSize = isBigEndian ? BigLong(int(fileinfo[i].Size)) : LittleLong(fileinfo[i].Size); + Lumps[i].Namespace = ns_global; + Lumps[i].Flags = Lumps[i].Compressed? LUMPF_COMPRESSED : 0; + Lumps[i].FullName = NULL; Property changes on: files/patch-src_resourcefiles_file__wad.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_scripting_backend_vmbuilder.cpp =================================================================== --- files/patch-src_scripting_backend_vmbuilder.cpp (nonexistent) +++ files/patch-src_scripting_backend_vmbuilder.cpp (working copy) @@ -0,0 +1,18 @@ +--- src/scripting/backend/vmbuilder.cpp.orig 2019-01-20 17:58:02 UTC ++++ src/scripting/backend/vmbuilder.cpp +@@ -922,6 +922,7 @@ void FFunctionBuildList::Build() + + void FFunctionBuildList::DumpJit() + { ++#ifdef HAVE_VM_JIT + FILE *dump = fopen("dumpjit.txt", "w"); + if (dump == nullptr) + return; +@@ -932,6 +933,7 @@ void FFunctionBuildList::DumpJit() + } + + fclose(dump); ++#endif // HAVE_VM_JIT + } + + Property changes on: files/patch-src_scripting_backend_vmbuilder.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_scripting_vm_vmframe.cpp =================================================================== --- files/patch-src_scripting_vm_vmframe.cpp (nonexistent) +++ files/patch-src_scripting_vm_vmframe.cpp (working copy) @@ -0,0 +1,47 @@ +--- src/scripting/vm/vmframe.cpp.orig 2019-01-20 17:58:02 UTC ++++ src/scripting/vm/vmframe.cpp +@@ -44,11 +44,7 @@ + #include "c_cvars.h" + #include "version.h" + +-#if (defined(_M_X64 ) || defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(__amd64 ) || defined(__amd64__ )) +-#define ARCH_X64 +-#endif +- +-#ifdef ARCH_X64 ++#ifdef HAVE_VM_JIT + CUSTOM_CVAR(Bool, vm_jit, true, CVAR_NOINITCALL) + { + Printf("You must restart " GAMENAME " for this change to take effect.\n"); +@@ -56,6 +52,8 @@ CUSTOM_CVAR(Bool, vm_jit, true, CVAR_NOINITCALL) + } + #else + CVAR(Bool, vm_jit, false, CVAR_NOINITCALL|CVAR_NOSET) ++FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames) { return FString(); } ++void JitRelease() {} + #endif + + cycle_t VMCycles[10]; +@@ -282,7 +280,7 @@ static bool CanJit(VMScriptFunction *func) + + int VMScriptFunction::FirstScriptCall(VMFunction *func, VMValue *params, int numparams, VMReturn *ret, int numret) + { +-#ifdef ARCH_X64 ++#ifdef HAVE_VM_JIT + if (vm_jit && CanJit(static_cast(func))) + { + func->ScriptCall = JitCompile(static_cast(func)); +@@ -290,12 +288,10 @@ int VMScriptFunction::FirstScriptCall(VMFunction *func + func->ScriptCall = VMExec; + } + else ++#endif // HAVE_VM_JIT + { + func->ScriptCall = VMExec; + } +-#else +- func->ScriptCall = VMExec; +-#endif + + return func->ScriptCall(func, params, numparams, ret, numret); + } Property changes on: files/patch-src_scripting_vm_vmframe.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_sound_timiditypp_smplfile.cpp =================================================================== --- files/patch-src_sound_timiditypp_smplfile.cpp (nonexistent) +++ files/patch-src_sound_timiditypp_smplfile.cpp (working copy) @@ -0,0 +1,20 @@ +--- src/sound/timiditypp/smplfile.cpp.orig 2019-04-03 12:42:58 UTC ++++ src/sound/timiditypp/smplfile.cpp +@@ -218,7 +218,7 @@ int Instruments::get_next_importer(char *sample_file, + thing = BE_SHORT(tmpshort); + #define READ_LONG_BE(thing) \ + if (1 != tf_read(&tmplong, 4, 1, tf)) goto fail; \ +- thing = BE_LONG(tmplong); ++ thing = BE_LONG(int32_t(tmplong)); + + const uint8_t pan_mono[] = {64}; /* center */ + const uint8_t pan_stereo[] = {1,127}; /* left,right */ +@@ -610,7 +610,7 @@ int Instruments::import_aiff_load(char *sample_file, I + for(;;) { + if (tf_read(&buf[type_index], type_size, 1, tf) != 1) + break; +- chunk_size = BE_LONG(xbuf.i[2]); ++ chunk_size = BE_LONG(int32_t(xbuf.i[2])); + if (memcmp(&buf[4 + 0], "COMM", 4) == 0) + { + if (chunk_flags & AIFF_CHUNKFLAG_COMMON) Property changes on: files/patch-src_sound_timiditypp_smplfile.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property