From aa1af4d1d7a9e086dcab5f1e95db2a52fe65893e Mon Sep 17 00:00:00 2001 From: eater <=@eater.me> Date: Tue, 26 Mar 2019 00:04:50 +0100 Subject: [PATCH] Initial commit --- .gitmodules | 3 + README.md | 18 +++ mxe | 1 + mxe.src/bullet.mk | 33 +++++ mxe.src/crabnet.mk | 18 +++ mxe.src/mygui.mk | 22 +++ mxe.src/openal-2-fix-visibility.patch | 28 ++++ mxe.src/openal.mk | 32 +++++ mxe.src/openexr-3-namespace-fix.patch | 13 ++ mxe.src/openexr-4-namespace-fix.patch | 161 +++++++++++++++++++++ mxe.src/openexr-5-namespace-fix.patch | 62 ++++++++ mxe.src/openmw-1-fix-headers.patch | 42 ++++++ mxe.src/openmw-2-aggresive-static.patch | 163 ++++++++++++++++++++++ mxe.src/openmw-3-fix-openal-headers.patch | 15 ++ mxe.src/openmw.mk | 35 +++++ mxe.src/openscenegraph.mk | 31 ++++ nwah | 54 +++++++ 17 files changed, 731 insertions(+) create mode 100644 .gitmodules create mode 100644 README.md create mode 160000 mxe create mode 100644 mxe.src/bullet.mk create mode 100644 mxe.src/crabnet.mk create mode 100644 mxe.src/mygui.mk create mode 100644 mxe.src/openal-2-fix-visibility.patch create mode 100644 mxe.src/openal.mk create mode 100644 mxe.src/openexr-3-namespace-fix.patch create mode 100644 mxe.src/openexr-4-namespace-fix.patch create mode 100644 mxe.src/openexr-5-namespace-fix.patch create mode 100644 mxe.src/openmw-1-fix-headers.patch create mode 100644 mxe.src/openmw-2-aggresive-static.patch create mode 100644 mxe.src/openmw-3-fix-openal-headers.patch create mode 100644 mxe.src/openmw.mk create mode 100644 mxe.src/openscenegraph.mk create mode 100755 nwah diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c65b5a3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "mxe"] + path = mxe + url = https://github.com/mxe/mxe.git diff --git a/README.md b/README.md new file mode 100644 index 0000000..e0c7821 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# WARNING + +It does not work _yet_ + +# OpenMW MinGW + +OpenMW MinGW is a small project which sets up a Linux build environment for +Windows, by using MinGW and [mxe](https://mxe.cc). + +Building all dependencies may easily take 2-3 hours, it is recommend to cache. + +All files in `mxe.src` get copied into `mxe/src` + +## Running + +```sh +./nwah mxe openmw +``` diff --git a/mxe b/mxe new file mode 160000 index 0000000..ecca116 --- /dev/null +++ b/mxe @@ -0,0 +1 @@ +Subproject commit ecca1162cba6017c3b73348312cbebc83e3e47f3 diff --git a/mxe.src/bullet.mk b/mxe.src/bullet.mk new file mode 100644 index 0000000..7436044 --- /dev/null +++ b/mxe.src/bullet.mk @@ -0,0 +1,33 @@ +# This file is part of MXE. See LICENSE.md for licensing information. + +PKG := bullet +$(PKG)_WEBSITE := https://bulletphysics.org/ +$(PKG)_DESCR := Bullet physics, version 2 +$(PKG)_VERSION := 2.86 +$(PKG)_IGNORE := +$(PKG)_SUBDIR := $(PKG)3-$($(PKG)_VERSION) +$(PKG)_CHECKSUM := e6e8b755280ce2c1a8218529eae5dd78e184f7036854229cea611374ad5a671f +$(PKG)_GH_CONF := bulletphysics/bullet3/releases +$(PKG)_URL_2 := https://github.com/bulletphysics/bullet3/archive/$($(PKG)_VERSION).tar.gz +$(PKG)_DEPS := cc + +define $(PKG)_BUILD + cd '$(1)' && '$(TARGET)-cmake' . \ + -DINSTALL_LIBS=ON \ + -DBUILD_CPU_DEMOS=OFF \ + -DBUILD_DEMOS=OFF \ + -DBUILD_BULLET2_DEMOS=OFF \ + -DBUILD_EXTRAS=OFF \ + -DBUILD_MULTITHREADING=OFF \ + -DBUILD_UNIT_TESTS=OFF \ + -DUSE_CUSTOM_VECOR_MATH=OFF \ + -DUSE_DOUBLE_PRECISION=OFF \ + -DUSE_GLUT=OFF \ + -DUSE_GRAPHICAL_BENCHMARK=OFF + $(MAKE) -C '$(1)' -j '$(JOBS)' install VERBOSE=1 + + '$(TARGET)-g++' \ + -Wall -Wextra -std=gnu++0x \ + '$(TEST_FILE)' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \ + `'$(TARGET)-pkg-config' $(PKG) --cflags --libs` +endef diff --git a/mxe.src/crabnet.mk b/mxe.src/crabnet.mk new file mode 100644 index 0000000..010581a --- /dev/null +++ b/mxe.src/crabnet.mk @@ -0,0 +1,18 @@ +PKG := crabnet +$(PKG)_WEBSITE := https://github.com/TES3MP/CrabNet +$(PKG)_DESCR := CrabNet is a cross platform, open source, C++ networking engine for game programmers. +$(PKG)_IGNORE := +$(PKG)_VERSION := 1.001 +$(PKG)_SUBDIR := CrabNet-feaute-mingw-support +$(PKG)_CHECKSUM := 52dc30b8aaf805482f1703f71b82d6f560df813ec04b858728d70ec9034e43f6 +$(PKG)_GH_CONF := teamnwah/CrabNet/branches/feaute/mingw-support +$(PKG)_URL_2 := https://github.com/teamnwah/CrabNet/archive/feaute/mingw-support.tar.gz +$(PKG)_DEPS := cc + +define $(PKG)_BUILD + cd '$(BUILD_DIR)' && $(TARGET)-cmake '$(SOURCE_DIR)' + $(MAKE) -C '$(BUILD_DIR)' -j $(JOBS) + $(INSTALL) -d '$(PREFIX)/$(TARGET)/include/raknet' + $(INSTALL) -m644 '$(BUILD_DIR)/include/raknet'/* '$(PREFIX)/$(TARGET)/include/raknet' + $(INSTALL) -m644 '$(BUILD_DIR)/lib/libRakNetLibStatic.a' '$(PREFIX)/$(TARGET)/lib' +endef diff --git a/mxe.src/mygui.mk b/mxe.src/mygui.mk new file mode 100644 index 0000000..8f8316c --- /dev/null +++ b/mxe.src/mygui.mk @@ -0,0 +1,22 @@ +PKG := mygui +$(PKG)_WEBSITE := https://github.com/TES3MP/CrabNet +$(PKG)_DESCR := Fast, flexible and simple GUI. +$(PKG)_IGNORE := +$(PKG)_VERSION := 3.2.1 +$(PKG)_CHECKSUM := 37232d736159cd7d1a4d0291d714964505b7edc8d65cb0147533259d102f78cc +$(PKG)_GH_CONF := MyGUI/mygui/releases,MyGUI +$(PKG)_URL_2 := https://github.com/MyGUI/mygui/archive/MyGUI$($(PKG)_VERSION).tar.gz +$(PKG)_DEPS := cc freetype zlib + +define $(PKG)_BUILD + cd '$(BUILD_DIR)' && $(TARGET)-cmake '$(SOURCE_DIR)' \ + -DMYGUI_RENDERSYSTEM=1 \ + -DMYGUI_BUILD_DEMOS=OFF \ + -DMYGUI_BUILD_TOOLS=OFF \ + -DMYGUI_BUILD_PLUGINS=OFF \ + -DMYGUI_STATIC=ON \ + -DMYGUI_STANDALONE_BUILD=ON + + $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' VERBOSE=1 + $(MAKE) -C '$(BUILD_DIR)' -j 1 install VERBOSE=1 +endef diff --git a/mxe.src/openal-2-fix-visibility.patch b/mxe.src/openal-2-fix-visibility.patch new file mode 100644 index 0000000..d9b62c3 --- /dev/null +++ b/mxe.src/openal-2-fix-visibility.patch @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0087edb2..28960a4f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -282,15 +282,6 @@ ELSE() + int main() {return 0;}" HAVE_GCC_DESTRUCTOR) + ENDIF() + +-# Set visibility/export options if available +-IF(WIN32) +- SET(EXPORT_DECL "__declspec(dllexport)") +- IF(NOT MINGW) +- SET(ALIGN_DECL "__declspec(align(x))") +- ELSE() +- SET(ALIGN_DECL "__declspec(aligned(x))") +- ENDIF() +-ELSE() + SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + # Yes GCC, really don't accept visibility modes you don't support + SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror") +@@ -321,7 +312,6 @@ ELSE() + ENDIF() + + SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}") +-ENDIF() + + SET(SSE_SWITCH "") + SET(SSE2_SWITCH "") diff --git a/mxe.src/openal.mk b/mxe.src/openal.mk new file mode 100644 index 0000000..e50de81 --- /dev/null +++ b/mxe.src/openal.mk @@ -0,0 +1,32 @@ +# This file is part of MXE. See LICENSE.md for licensing information. + +PKG := openal +$(PKG)_WEBSITE := https://openal-soft.org/ +$(PKG)_IGNORE := +$(PKG)_VERSION := 1.16.0 +$(PKG)_CHECKSUM := 2f3dcd313fe26391284fbf8596863723f99c65d6c6846dccb48e79cadaf40d5f +$(PKG)_SUBDIR := openal-soft-$($(PKG)_VERSION) +$(PKG)_FILE := openal-soft-$($(PKG)_VERSION).tar.bz2 +$(PKG)_URL := https://openal-soft.org/openal-releases/$($(PKG)_FILE) +$(PKG)_DEPS := cc portaudio + +define $(PKG)_UPDATE + $(WGET) -q -O- 'https://openal-soft.org/openal-releases/?C=M;O=D' | \ + $(SED) -n 's,.*"openal-soft-\([0-9][^"]*\)\.tar.*,\1,p' | \ + $(SORT) -V | \ + tail -1 +endef + +define $(PKG)_BUILD + cd '$(1)/build' && '$(TARGET)-cmake' .. \ + -DALSOFT_EXAMPLES=FALSE \ + -DALSOFT_UTILS=FALSE \ + -DALSOFT_BUILD_IMPORT_LIB=FALSE + + $(MAKE) -C '$(1)/build' -j '$(JOBS)' install + + '$(TARGET)-gcc' \ + -W -Wall -Werror -ansi -pedantic \ + '$(TEST_FILE)' -o '$(PREFIX)/$(TARGET)/bin/test-openal.exe' \ + `'$(TARGET)-pkg-config' openal --cflags --libs` +endef diff --git a/mxe.src/openexr-3-namespace-fix.patch b/mxe.src/openexr-3-namespace-fix.patch new file mode 100644 index 0000000..dbd8dd8 --- /dev/null +++ b/mxe.src/openexr-3-namespace-fix.patch @@ -0,0 +1,13 @@ +diff --git a/IlmImf/ImfDwaCompressor.h b/IlmImf/ImfDwaCompressor.h +index 654ae790..ae80ca4e 100644 +--- a/IlmImf/ImfDwaCompressor.h ++++ b/IlmImf/ImfDwaCompressor.h +@@ -71,7 +71,7 @@ class DwaCompressor: public Compressor + + virtual int numScanLines () const; + +- virtual Imf::Compressor::Format format () const; ++ virtual Format format () const; + + virtual int compress (const char *inPtr, + int inSize, diff --git a/mxe.src/openexr-4-namespace-fix.patch b/mxe.src/openexr-4-namespace-fix.patch new file mode 100644 index 0000000..4cc1a1e --- /dev/null +++ b/mxe.src/openexr-4-namespace-fix.patch @@ -0,0 +1,161 @@ +diff --git a/IlmImf/ImfDwaCompressor.cpp b/IlmImf/ImfDwaCompressor.cpp +index 1c1bd454..8bfc7d6f 100644 +--- a/IlmImf/ImfDwaCompressor.cpp ++++ b/IlmImf/ImfDwaCompressor.cpp +@@ -1845,7 +1845,7 @@ DwaCompressor::numScanLines() const + } + + +-Imf::Compressor::Format ++Compressor::Format + DwaCompressor::format() const + { + if (GLOBAL_SYSTEM_LITTLE_ENDIAN) +@@ -1927,7 +1927,7 @@ DwaCompressor::compress + _outBuffer = new char[outBufferSize]; + } + +- char *outDataPtr = &_outBuffer[NUM_SIZES_SINGLE * sizeof(Imf::Int64) + ++ char *outDataPtr = &_outBuffer[NUM_SIZES_SINGLE * sizeof(Int64) + + channelRuleSize]; + + // +@@ -1980,7 +1980,7 @@ DwaCompressor::compress + + if (fileVersion >= 2) + { +- char *writePtr = &_outBuffer[NUM_SIZES_SINGLE * sizeof(Imf::Int64)]; ++ char *writePtr = &_outBuffer[NUM_SIZES_SINGLE * sizeof(Int64)]; + Xdr::write (writePtr, channelRuleSize); + + for (size_t i = 0; i < channelRules.size(); ++i) +@@ -2011,7 +2011,7 @@ DwaCompressor::compress + continue; + + rowPtrs[chan].push_back(inDataPtr); +- inDataPtr += cd->width * Imf::pixelTypeSize(cd->type); ++ inDataPtr += cd->width * pixelTypeSize(cd->type); + } + } + +@@ -2111,7 +2111,7 @@ DwaCompressor::compress + for (int x = 0; x < cd->width; ++x) + { + for (int byte = 0; +- byte < Imf::pixelTypeSize (cd->type); ++ byte < pixelTypeSize (cd->type); + ++byte) + { + +@@ -2119,7 +2119,7 @@ DwaCompressor::compress + } + } + +- *rleRawSize += cd->width * Imf::pixelTypeSize(cd->type); ++ *rleRawSize += cd->width * pixelTypeSize(cd->type); + } + + break; +@@ -2131,7 +2131,7 @@ DwaCompressor::compress + // + + { +- int scanlineSize = cd->width * Imf::pixelTypeSize(cd->type); ++ int scanlineSize = cd->width * pixelTypeSize(cd->type); + + for (unsigned int y = 0; y < rowPtrs[chan].size(); ++y) + { +@@ -2650,7 +2650,7 @@ DwaCompressor::uncompress + continue; + + rowPtrs[chan].push_back (outBufferEnd); +- outBufferEnd += cd->width * Imf::pixelTypeSize (cd->type); ++ outBufferEnd += cd->width * pixelTypeSize (cd->type); + } + } + +@@ -2702,7 +2702,7 @@ DwaCompressor::uncompress + continue; + + ChannelData *cd = &_channelData[chan]; +- int pixelSize = Imf::pixelTypeSize (cd->type); ++ int pixelSize = pixelTypeSize (cd->type); + + switch (cd->compression) + { +@@ -2794,7 +2794,7 @@ DwaCompressor::uncompress + + { + int row = 0; +- int dstScanlineSize = cd->width * Imf::pixelTypeSize (cd->type); ++ int dstScanlineSize = cd->width * pixelTypeSize (cd->type); + + for (int y = minY; y <= maxY; ++y) + { +@@ -2940,7 +2940,7 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) + // + + int rleAmount = 2 * numScanLines() * (_max[0] - _min[0] + 1) * +- Imf::pixelTypeSize (_channelData[chan].type); ++ pixelTypeSize (_channelData[chan].type); + + rleBufferSize += rleAmount; + } +@@ -2950,7 +2950,7 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) + case UNKNOWN: + + unknownBufferSize += numScanLines() * (_max[0] - _min[0] + 1) * +- Imf::pixelTypeSize (_channelData[chan].type); ++ pixelTypeSize (_channelData[chan].type); + break; + + default: +@@ -3073,13 +3073,13 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) + case RLE: + planarUncBufferSize[RLE] += + numScanLines() * (_max[0] - _min[0] + 1) * +- Imf::pixelTypeSize (_channelData[chan].type); ++ pixelTypeSize (_channelData[chan].type); + break; + + case UNKNOWN: + planarUncBufferSize[UNKNOWN] += + numScanLines() * (_max[0] - _min[0] + 1) * +- Imf::pixelTypeSize (_channelData[chan].type); ++ pixelTypeSize (_channelData[chan].type); + break; + + default: +@@ -3386,11 +3386,11 @@ DwaCompressor::setupChannelData (int minX, int minY, int maxX, int maxY) + { + ChannelData *cd = &_channelData[chan]; + +- cd->width = Imf::numSamples (cd->xSampling, minX, maxX); +- cd->height = Imf::numSamples (cd->ySampling, minY, maxY); ++ cd->width = numSamples (cd->xSampling, minX, maxX); ++ cd->height = numSamples (cd->ySampling, minY, maxY); + + cd->planarUncSize = +- cd->width * cd->height * Imf::pixelTypeSize (cd->type); ++ cd->width * cd->height * pixelTypeSize (cd->type); + + cd->planarUncBuffer = planarUncBuffer[cd->compression]; + cd->planarUncBufferEnd = cd->planarUncBuffer; +@@ -3398,7 +3398,7 @@ DwaCompressor::setupChannelData (int minX, int minY, int maxX, int maxY) + cd->planarUncRle[0] = cd->planarUncBuffer; + cd->planarUncRleEnd[0] = cd->planarUncRle[0]; + +- for (int byte = 1; byte < Imf::pixelTypeSize(cd->type); ++byte) ++ for (int byte = 1; byte < pixelTypeSize(cd->type); ++byte) + { + cd->planarUncRle[byte] = + cd->planarUncRle[byte-1] + cd->width * cd->height; +@@ -3416,7 +3416,7 @@ DwaCompressor::setupChannelData (int minX, int minY, int maxX, int maxY) + else + { + planarUncBuffer[cd->compression] += +- cd->width * cd->height * Imf::pixelTypeSize (cd->planarUncType); ++ cd->width * cd->height * pixelTypeSize (cd->planarUncType); + } + } + } diff --git a/mxe.src/openexr-5-namespace-fix.patch b/mxe.src/openexr-5-namespace-fix.patch new file mode 100644 index 0000000..9900faa --- /dev/null +++ b/mxe.src/openexr-5-namespace-fix.patch @@ -0,0 +1,62 @@ +diff --git a/IlmImf/ImfZip.cpp b/IlmImf/ImfZip.cpp +index 93d625e1..7268e948 100644 +--- a/IlmImf/ImfZip.cpp ++++ b/IlmImf/ImfZip.cpp +@@ -42,14 +42,14 @@ + + OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER + +-Imf::Zip::Zip(size_t maxRawSize): ++Zip::Zip(size_t maxRawSize): + _maxRawSize(maxRawSize), + _tmpBuffer(0) + { + _tmpBuffer = new char[_maxRawSize]; + } + +-Imf::Zip::Zip(size_t maxScanLineSize, size_t numScanLines): ++Zip::Zip(size_t maxScanLineSize, size_t numScanLines): + _maxRawSize(0), + _tmpBuffer(0) + { +@@ -57,19 +57,19 @@ Imf::Zip::Zip(size_t maxScanLineSize, size_t numScanLines): + _tmpBuffer = new char[_maxRawSize]; + } + +-Imf::Zip::~Zip() ++Zip::~Zip() + { + if (_tmpBuffer) delete[] _tmpBuffer; + } + + size_t +-Imf::Zip::maxRawSize() ++Zip::maxRawSize() + { + return _maxRawSize; + } + + size_t +-Imf::Zip::maxCompressedSize() ++Zip::maxCompressedSize() + { + return uiAdd (uiAdd (_maxRawSize, + size_t (ceil (_maxRawSize * 0.01))), +@@ -77,7 +77,7 @@ Imf::Zip::maxCompressedSize() + } + + int +-Imf::Zip::compress(const char *raw, int rawSize, char *compressed) ++Zip::compress(const char *raw, int rawSize, char *compressed) + { + // + // Reorder the pixel data. +@@ -136,7 +136,7 @@ Imf::Zip::compress(const char *raw, int rawSize, char *compressed) + } + + int +-Imf::Zip::uncompress(const char *compressed, int compressedSize, ++Zip::uncompress(const char *compressed, int compressedSize, + char *raw) + { + // diff --git a/mxe.src/openmw-1-fix-headers.patch b/mxe.src/openmw-1-fix-headers.patch new file mode 100644 index 0000000..bd3ee15 --- /dev/null +++ b/mxe.src/openmw-1-fix-headers.patch @@ -0,0 +1,42 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0ccfbfa55..3c2047dd5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -225,8 +225,8 @@ endif() + if(QT_STATIC) + if(WIN32) + if(DESIRED_QT_VERSION MATCHES 4) +- # QtCore needs WSAAsyncSelect from Ws2_32.lib +- set(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY} Ws2_32.lib) ++ # QtCore needs WSAAsyncSelect from ws2_32.lib ++ set(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY} ws2_32.lib) + message("QT_QTCORE_LIBRARY: ${QT_QTCORE_LIBRARY}") + endif() + endif() +diff --git a/cmake/FindOSGPlugins.cmake b/cmake/FindOSGPlugins.cmake +index 8220f33d4..2654bf5d5 100644 +--- a/cmake/FindOSGPlugins.cmake ++++ b/cmake/FindOSGPlugins.cmake +@@ -28,9 +28,7 @@ foreach(_library ${OSGPlugins_FIND_COMPONENTS}) + + set(${_library_uc}_DIR ${OSGPlugins_LIB_DIR}) # to help function osg_find_library + set(_saved_lib_prefix ${CMAKE_FIND_LIBRARY_PREFIXES}) # save CMAKE_FIND_LIBRARY_PREFIXES +- set(CMAKE_FIND_LIBRARY_PREFIXES "") # search libraries with no prefix + osg_find_library(${_library_uc} ${_library}) # find it into ${_library_uc}_LIBRARIES +- set(CMAKE_FIND_LIBRARY_PREFIXES ${_saved_lib_prefix}) # restore prefix + + if (${_library_uc}_LIBRARIES) + set(${_component}_LIBRARY ${${_library_uc}_LIBRARIES}) # fake as if we call find_library +diff --git a/components/files/windowspath.cpp b/components/files/windowspath.cpp +index 2354e6f31..36290db9a 100644 +--- a/components/files/windowspath.cpp ++++ b/components/files/windowspath.cpp +@@ -6,7 +6,7 @@ + + #include + #include +-#include ++#include + + #include + namespace bconv = boost::locale::conv; diff --git a/mxe.src/openmw-2-aggresive-static.patch b/mxe.src/openmw-2-aggresive-static.patch new file mode 100644 index 0000000..17f8fc2 --- /dev/null +++ b/mxe.src/openmw-2-aggresive-static.patch @@ -0,0 +1,163 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3c2047dd5..d209037c0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -219,7 +219,7 @@ if(OSG_STATIC) + add_definitions(-DOSG_LIBRARY_STATIC) + + find_package(OSGPlugins REQUIRED COMPONENTS ${USED_OSG_PLUGINS}) +- list(APPEND OPENSCENEGRAPH_LIBRARIES ${OSGPlugins_LIBRARIES}) ++ list(APPEND OPENSCENEGRAPH_LIBRARIES "-Wl,-Bstatic" ${OSGPlugins_LIBRARIES}) + endif() + + if(QT_STATIC) +@@ -470,7 +470,7 @@ if(WIN32) + + INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Debug/resources" DESTINATION "." CONFIGURATIONS Debug) + INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Release/resources" DESTINATION "." CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel) +- ++ + FILE(GLOB plugin_dir_debug "${OpenMW_BINARY_DIR}/Debug/osgPlugins-*") + FILE(GLOB plugin_dir_release "${OpenMW_BINARY_DIR}/Release/osgPlugins-*") + INSTALL(DIRECTORY ${plugin_dir_debug} DESTINATION "." CONFIGURATIONS Debug) +@@ -837,4 +837,3 @@ if (DOXYGEN_FOUND) + WORKING_DIRECTORY ${OpenMW_BINARY_DIR} + COMMENT "Generating documentation for the github-pages at ${DOXYGEN_PAGES_OUTPUT_DIR}" VERBATIM) + endif () +- +diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt +index 0092712db..fc29e0c0b 100644 +--- a/apps/openmw/CMakeLists.txt ++++ b/apps/openmw/CMakeLists.txt +@@ -97,6 +97,8 @@ add_openmw_dir (mwbase + + # Main executable + ++link_libraries("-static") ++ + if (NOT ANDROID) + openmw_add_executable(openmw + ${OPENMW_FILES} +@@ -111,6 +113,13 @@ else () + ) + endif () + ++add_custom_command( ++ TARGET openmw ++ PRE_LINK ++ COMMAND sed 's:-Wl,-Bdynamic::g' -i /home/eater/projects/openmw-mingw/mxe/tmp-openmw-x86_64-w64-mingw32.static/openmw-openmw-0.45.0.build_/apps/openmw/CMakeFiles/openmw.dir/linklibs.rsp ++) ++ ++ + # Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING + # when we change the backend. + include_directories( +@@ -118,6 +127,8 @@ include_directories( + ) + + target_link_libraries(openmw ++ "-Wl,-Bstatic" ++ ${OPENMW_CUSTOM_FLAGS} + ${OSG_LIBRARIES} + ${OPENTHREADS_LIBRARIES} + ${OSGPARTICLE_LIBRARIES} +@@ -138,7 +149,7 @@ target_link_libraries(openmw + components + ) + +-if (ANDROID) ++# if (ANDROID) + set (OSG_PLUGINS + -Wl,--whole-archive + ) +@@ -151,24 +162,24 @@ if (ANDROID) + ) + + target_link_libraries(openmw +- EGL +- android ++# EGL ++# android + log + dl + z + ${OPENSCENEGRAPH_LIBRARIES} + freetype + jpeg +- png ++ png + ) +-endif (ANDROID) ++# endif (ANDROID) + + if (USE_SYSTEM_TINYXML) + target_link_libraries(openmw ${TinyXML_LIBRARIES}) + endif() + + if (NOT UNIX) +-target_link_libraries(openmw ${SDL2MAIN_LIBRARY}) ++target_link_libraries(openmw "-Wl,-Bstatic" ${SDL2MAIN_LIBRARY}) + endif() + + # Fix for not visible pthreads functions for linker with glibc 2.15 +diff --git a/cmake/FindMyGUI.cmake b/cmake/FindMyGUI.cmake +index 473f543ba..2dc820922 100644 +--- a/cmake/FindMyGUI.cmake ++++ b/cmake/FindMyGUI.cmake +@@ -37,7 +37,7 @@ libfind_pkg_detect(MyGUI MyGUI${MYGUI_STATIC_SUFFIX} MYGUI${MYGUI_STATIC_SUFFIX} + HINTS $ENV{MYGUI_HOME}/lib + PATH_SUFFIXES "" release relwithdebinfo minsizerel + ) +-if (MYGUI_STATIC AND (APPLE OR ANDROID)) ++if (MYGUI_STATIC) + # we need explicit Freetype libs only on OS X and ANDROID for static build + libfind_package(MyGUI Freetype) + endif() +@@ -48,6 +48,8 @@ libfind_version_n_header(MyGUI + ) + libfind_process(MyGUI) + ++set(MyGUI_LIBRARIES "-Wl,-Bstatic" ${MyGUI_LIBRARIES}) ++ + if (MyGUI_Debug_FOUND) + set(MyGUI_LIBRARIES optimized ${MyGUI_LIBRARIES} debug ${MyGUI_Debug_LIBRARIES}) + endif() +diff --git a/cmake/FindOSGPlugins.cmake b/cmake/FindOSGPlugins.cmake +index 2654bf5d5..e0c3af930 100644 +--- a/cmake/FindOSGPlugins.cmake ++++ b/cmake/FindOSGPlugins.cmake +@@ -45,4 +45,5 @@ foreach(_dependency PNG ZLIB JPEG) # needed by osgdb_png or osgdb_jpeg + #list(APPEND OSGPlugins_PROCESS_LIBS ${_dependency}_LIBRARY) + endforeach() + ++libfind_package(OSGPlugin openexr) + libfind_process(OSGPlugins) +diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt +index 5c245afd0..d282fa6ba 100644 +--- a/components/CMakeLists.txt ++++ b/components/CMakeLists.txt +@@ -197,6 +197,7 @@ include_directories(${Bullet_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) + add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS} ${ESM_UI_HDR}) + + target_link_libraries(components ++ "-Wl,-Bstatic" + ${Boost_SYSTEM_LIBRARY} + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} +@@ -218,6 +219,7 @@ target_link_libraries(components + + if (WIN32) + target_link_libraries(components ++ "-Wl,-Bstatic" + ${Boost_LOCALE_LIBRARY}) + endif() + +@@ -236,7 +238,7 @@ if (GIT_CHECKOUT) + endif (GIT_CHECKOUT) + + if (WIN32) +- target_link_libraries(components shlwapi) ++ target_link_libraries(components "-Wl,-Bstatic" shlwapi) + if(MINGW) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOGDI") + endif(MINGW) diff --git a/mxe.src/openmw-3-fix-openal-headers.patch b/mxe.src/openmw-3-fix-openal-headers.patch new file mode 100644 index 0000000..d634388 --- /dev/null +++ b/mxe.src/openmw-3-fix-openal-headers.patch @@ -0,0 +1,15 @@ +diff --git a/apps/openmw/mwsound/openal_output.hpp b/apps/openmw/mwsound/openal_output.hpp +index b6a26c99a..6ce10d940 100644 +--- a/apps/openmw/mwsound/openal_output.hpp ++++ b/apps/openmw/mwsound/openal_output.hpp +@@ -6,8 +6,8 @@ + #include + #include + +-#include "alc.h" +-#include "al.h" ++#include "AL/alc.h" ++#include "AL/al.h" + #include "alext.h" + + #include "sound_output.hpp" diff --git a/mxe.src/openmw.mk b/mxe.src/openmw.mk new file mode 100644 index 0000000..96c3eb5 --- /dev/null +++ b/mxe.src/openmw.mk @@ -0,0 +1,35 @@ +PKG := openmw +$(PKG)_DESCR := Fast, flexible and simple GUI. +$(PKG)_IGNORE := +$(PKG)_VERSION := 0.45.0 +$(PKG)_SUBDIR := openmw-openmw-$($(PKG)_VERSION) +$(PKG)_CHECKSUM := b63cf971f406ef5f28019f65e9e2bd9641a227459ede45d147562917f67e1c64 +$(PKG)_GH_CONF := openmw/openmw/releases +$(PKG)_URL_2 := https://github.com/openmw/openmw/archive/openmw-$($(PKG)_VERSION).tar.gz +$(PKG)_DEPS := cc bullet qt openscenegraph boost ffmpeg openal sdl2 mygui + +define $(PKG)_BUILD + cd '$(BUILD_DIR)' && $(TARGET)-cmake '$(SOURCE_DIR)' \ + -DMyGUI_LIBRARY=$(PREFIX)/$(TARGET)/lib/Release/libMyGUIEngineStatic.a \ + -DMYGUI_STATIC=ON \ + -DBOOST_STATIC=ON \ + -DSDL2_STATIC=ON \ + -DOSG_STATIC=ON \ + -DQT_STATIC=ON \ + -DRECASTNAVIGATION_STATIC=ON \ + -DBUILD_OPENCS=OFF \ + -DBUILD_NIFTEST=OFF \ + -DBUILD_LAUNCHER=OFF \ + -DBUILD_WIZARD=OFF \ + -DBUILD_MWINIIMPORTER=OFF \ + -DBUILD_ESSIMPORTER=OFF \ + -DBUILD_BSATOOL=OFF \ + -DBUILD_ESMTOOL=OFF \ + -DBoost_ALL_NO_LIB=ON \ + -DCMAKE_BUILD_TYPE=None \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_CXX_FLAGS="-static -Wa,-mbig-obj -Wl,-Bstatic" \ + -DOPENMW_CUSTOM_FLAGS="-Wl,-Bstatic $(PREFIX)/$(TARGET)/lib/libOpenAL32.a `$(TARGET)-pkg-config --cflags --libs openal freetype2 sdl2 gl libavcodec libavdevice libavfilter libavformat libavresample libavutil`" + $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' VERBOSE=1 + $(MAKE) -C '$(BUILD_DIR)' -j 1 install VERBOSE=1 +endef diff --git a/mxe.src/openscenegraph.mk b/mxe.src/openscenegraph.mk new file mode 100644 index 0000000..0ff4d52 --- /dev/null +++ b/mxe.src/openscenegraph.mk @@ -0,0 +1,31 @@ +# This file is part of MXE. See LICENSE.md for licensing information. + +PKG := openscenegraph +$(PKG)_WEBSITE := http://www.openscenegraph.org/ +$(PKG)_DESCR := OpenSceneGraph +$(PKG)_IGNORE := +$(PKG)_VERSION := 3.6 +$(PKG)_CHECKSUM := 7f27ad127e768544be8bc81209e9447352089400980fc27c11717c72885cedaa +$(PKG)_GH_CONF := OpenMW/osg/branches/3.6 +$(PKG)_SUBDIR := osg-$($(PKG)_VERSION) +$(PKG)_URL_2 := https://github.com/OpenMW/osg/archive/3.6.tar.gz +$(PKG)_DEPS := cc boost curl dcmtk freetype gdal giflib gstreamer \ + gta jasper jpeg libpng openal openexr openthreads poppler \ + tiff zlib + +define $(PKG)_BUILD + cd '$(BUILD_DIR)' && '$(TARGET)-cmake' '$(SOURCE_DIR)' \ + -DCMAKE_CXX_FLAGS='-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS' \ + -DCMAKE_HAVE_PTHREAD_H=OFF \ + -DOSG_DETERMINE_WIN_VERSION=OFF \ + -DPKG_CONFIG_EXECUTABLE='$(PREFIX)/bin/$(TARGET)-pkg-config' \ + -DDYNAMIC_OPENTHREADS=$(CMAKE_SHARED_BOOL) \ + -DDYNAMIC_OPENSCENEGRAPH=$(CMAKE_SHARED_BOOL) \ + -DBUILD_OSG_APPLICATIONS=OFF \ + -DPOPPLER_HAS_CAIRO_EXITCODE=0 \ + -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS_EXITCODE=1 \ + -D_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED=1 + + $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' VERBOSE=1 + $(MAKE) -C '$(BUILD_DIR)' -j 1 install VERBOSE=1 +endef diff --git a/nwah b/nwah new file mode 100755 index 0000000..25eed8d --- /dev/null +++ b/nwah @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +set -e; + +# Repository used for OpenMW +DEFAULT_OPENMW_REPO="https://github.com/OpenMW/openmw.git" +# Branch to checkout and build (can also take tags) +DEFAULT_OPENMW_BRANCH="0.45.0" +# Dependencies that should be build for +DEFAULT_OPENMW_DEPS="bullet qt openscenegraph boost ffmpeg openal sdl2 mygui" +# Default target we should build. +DEFAULT_OPENMW_TARGET="x86_64-w64-mingw32.static" + +# If tes3mp should be built +OPENMW_TES3MP=${OPENMW_TES3MP:-0} + +if [ "${OPENMW_TES3MP}" = "1" ]; then + DEFAULT_OPENMW_REPO="https://github.com/TES3MP/openmw-tes3mp" + DEFAULT_OPENMW_BRANCH="0.7.0-alpha" + DEFAULT_OPENMW_DEPS+=" lua crabnet" +fi + +# Set working values +OPENMW_REPO=${OPENMW_REPO:-${DEFAULT_OPENMW_REPO}} +OPENMW_BRANCH=${OPENMW_BRANCH:-${DEFAULT_OPENMW_BRANCH}} +OPENMW_DEPS=${OPENMW_DEPS:-${DEFAULT_OPENMW_DEPS}} +OPENMW_TARGET=${OPENMW_TARGET:-${DEFAULT_OPENMW_TARGET}} + +# Set PWD correctly for script +cd "$(dirname "$(realpath "$0")")" + +nwah_mxe() { + cp -u mxe.src/* mxe/src; + test -f mxe/src/bullet-1-pkgconfig.patch && rm mxe/src/bullet-1-pkgconfig.patch; + pushd mxe; + echo "> mxe: make $@" + make MXE_TARGETS="${OPENMW_TARGET}" "$@"; +} + +main() { + local naked_cmd="${1}" + local cmd="nwah_${1}"; + shift; + + if [ "$(type -t "${cmd}")" != "function" ]; then + echo "No command found ${naked_cmd}"; + nwah_usage; + exit 1; + fi + + ${cmd} "$@"; +} + +main "$@"