aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--games/Makefile1
-rw-r--r--games/xptools/Makefile102
-rw-r--r--games/xptools/distinfo5
-rw-r--r--games/xptools/files/patch-libs_Makefile66
-rw-r--r--games/xptools/files/patch-makerules_Meshtool34
-rw-r--r--games/xptools/files/patch-makerules_RenderFarmUI25
-rw-r--r--games/xptools/files/patch-makerules_global_paths.mk20
-rw-r--r--games/xptools/files/patch-makerules_global_toplevel.mk34
-rw-r--r--games/xptools/files/patch-src_GUI_GUI_Resources.cpp11
-rw-r--r--games/xptools/files/patch-src_Network_PCSBSocket.lin.cpp12
-rw-r--r--games/xptools/files/patch-src_Obj_XDefs.h48
-rw-r--r--games/xptools/files/patch-src_UI_XGUIApp.cpp11
-rw-r--r--games/xptools/files/patch-src_Utils_GISUtils.cpp15
-rw-r--r--games/xptools/files/patch-src_Utils_PlatformUtils.lin.cpp10
-rw-r--r--games/xptools/files/patch-src_WEDCore_WED_AppMain.cpp11
-rw-r--r--games/xptools/files/patch-src_XESCore_Airports.cpp14
-rw-r--r--games/xptools/files/patch-src__WEDImportExport__WED_DSFExport.cpp.patch38
-rw-r--r--games/xptools/files/patch-src_linuxinit_initializer.cpp13
-rw-r--r--games/xptools/pkg-descr7
-rw-r--r--games/xptools/pkg-message16
-rw-r--r--games/xptools/pkg-plist10
21 files changed, 503 insertions, 0 deletions
diff --git a/games/Makefile b/games/Makefile
index 13411ea545ec..58f08f730eb3 100644
--- a/games/Makefile
+++ b/games/Makefile
@@ -1149,6 +1149,7 @@
SUBDIR += xpilot-ng-server
SUBDIR += xpipeman
SUBDIR += xpired
+ SUBDIR += xptools
SUBDIR += xpuyopuyo
SUBDIR += xpuzzletama
SUBDIR += xpyraminx
diff --git a/games/xptools/Makefile b/games/xptools/Makefile
new file mode 100644
index 000000000000..2988a867666c
--- /dev/null
+++ b/games/xptools/Makefile
@@ -0,0 +1,102 @@
+# $FreeBSD$
+
+PORTNAME= xptools
+DISTVERSION= wed_161r1
+CATEGORIES= games
+
+MAINTAINER= mike.d.ft402@gmail.com
+COMMENT= X-Plane Scenery Tools
+
+LICENSE= MIT
+
+# Platform-specific defines in patch-src_XESCore_Airports.cpp.
+# Somewhere on FlightGear wiki it is said WED would only work for AMD64 anyway.
+ONLY_FOR_ARCHS= amd64
+
+BUILD_DEPENDS= gnustat:sysutils/coreutils \
+ ${LOCALBASE}/libdata/pkgconfig/eigen3.pc:math/eigen3 \
+ ${LOCALBASE}/lib/libntl.a:math/ntl \
+ cmake:devel/cmake
+LIB_DEPENDS= libboost_system.so:devel/boost-libs \
+ libcurl.so:ftp/curl \
+ libexpat.so:textproc/expat2 \
+ libfreetype.so:print/freetype2 \
+ libgmp.so:math/gmp \
+ libjasper.so:graphics/jasper \
+ libgeotiff.so:graphics/libgeotiff \
+ libproj.so:graphics/proj \
+ libmpfr.so:math/mpfr \
+ libpng.so:graphics/png \
+ libshp.so:devel/shapelib \
+ libsquish.so:graphics/squish \
+ libtiff.so:graphics/tiff \
+ lib3ds.so:graphics/lib3ds \
+ libGLw.so:graphics/libGLw \
+ libGLU.so:graphics/libGLU
+
+USES= gmake jpeg sqlite ssl
+
+USE_GITHUB= yes
+GH_ACCOUNT= X-Plane
+GH_SUBDIR= libs:xptools_libs
+GH_TAGNAME= 982173e:xptools_libs
+
+USE_CXXSTD= c++11
+USE_BINUTILS= yes
+USE_QT4= corelib gui moc opengl
+USE_GL+= gl
+
+BINARIES= DDSTool DSFTool MeshTool ObjConverter ObjView RenderFarm RenderFarmUI WED XGrinder XPlaneSupportLin.p
+
+OPTIONS_DEFINE= OPTIMIZED_CFLAGS DEBUG
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MDEBUG}
+.if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
+IGNORE= the Makefile has no flags for both debug and optimization
+.else
+ALL_TARGET= debug
+.endif
+.else
+.if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
+ALL_TARGET= release-opt
+.else
+ALL_TARGET= release
+.endif
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} \
+ -e's:g++:${CXX}:g' \
+ -e's|gcc|${CC}|g' \
+ ${WRKSRC}/makerules/global/toplevel.mk \
+ ${WRKSRC}/src/OneOffs/Makefile
+ @${REINPLACE_CMD} \
+ -e's:-Wl,--exclude-libs,libpng.a::g' \
+ -e's:\./libs/local$$(MULTI_SUFFIX)/lib/libCGAL.a:XYZZY&:g' \
+ -e's: \./libs/local$$(MULTI_SUFFIX)/lib/libCGAL_Core.a::g' \
+ -e's:\./libs/local$$(MULTI_SUFFIX)/lib/libdime.a:XYZZY&:g' \
+ -e's: .*libz.a: /usr/lib/libz.a /usr/lib/libbz2.a /usr/lib/liblzma.a:g' \
+ -e's: \./libs/local$$(MULTI_SUFFIX)/lib: ${PREFIX}/lib:g' \
+ -e's: ${PREFIX}/lib/libtiff.a:& ${PREFIX}/lib/libjbig.a:g' \
+ -e's:XYZZY::g' \
+ -e's: -ldl: -lexecinfo -lelf:g' \
+ ${WRKSRC}/makerules/ac3d \
+ ${WRKSRC}/makerules/DDSTool \
+ ${WRKSRC}/makerules/DSFTool \
+ ${WRKSRC}/makerules/ObjConverter \
+ ${WRKSRC}/makerules/ObjView \
+ ${WRKSRC}/makerules/RenderFarm \
+ ${WRKSRC}/makerules/WED \
+ ${WRKSRC}/makerules/XGrinder
+
+pre-build:
+ cd ${WRKSRC}/libs && ${GMAKE}
+
+do-install:
+.for f in ${BINARIES}
+ ${INSTALL_PROGRAM} ${WRKSRC}/build/*/*/${f} ${STAGEDIR}${PREFIX}/bin
+.endfor
+
+.include <bsd.port.mk>
diff --git a/games/xptools/distinfo b/games/xptools/distinfo
new file mode 100644
index 000000000000..89f609738451
--- /dev/null
+++ b/games/xptools/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1511276611
+SHA256 (X-Plane-xptools-wed_161r1_GH0.tar.gz) = eede9732b24dea94be1c21bf0b6c6dec475a25bbb2de2ce234f3ce701a216b82
+SIZE (X-Plane-xptools-wed_161r1_GH0.tar.gz) = 20419334
+SHA256 (X-Plane-xptools-982173e_GH0.tar.gz) = 9c705ded5e83e264e12cb36bacd7bbfc9adbce06eb2d523e6ac32aae08e0eecd
+SIZE (X-Plane-xptools-982173e_GH0.tar.gz) = 115284556
diff --git a/games/xptools/files/patch-libs_Makefile b/games/xptools/files/patch-libs_Makefile
new file mode 100644
index 000000000000..501d50ecaa40
--- /dev/null
+++ b/games/xptools/files/patch-libs_Makefile
@@ -0,0 +1,66 @@
+--- libs/Makefile.orig 2015-11-30 20:55:15 UTC
++++ libs/Makefile
+@@ -111,6 +111,10 @@
+ PLAT_LINUX := Yes
+ VIS := -fvisibility=hidden
+ endif
++ifeq ($(PLATFORM), FreeBSD)
++ PLAT_LINUX := Yes
++ VIS := -fvisibility=hidden
++endif
+
+ # boost
+ ARCHIVE_BOOST := boost_$(VER_BOOST).tar.gz
+@@ -368,9 +372,7 @@
+ libexpat libgmp libmpfr libssl libcurl libjasper
+
+ all: ./local$(MULTI_SUFFIX)/.xpt_libs
+-./local$(MULTI_SUFFIX)/.xpt_libs: boost mesa_headers zlib libpng \
+-libfreetype libjpeg libtiff libproj libgeotiff libsqlite lib3ds libcgal \
+-libsquish libdime libshp libexpat libgmp libmpfr libssl libcurl libjasper
++./local$(MULTI_SUFFIX)/.xpt_libs: libcgal libdime
+ @touch ./local$(MULTI_SUFFIX)/.xpt_libs
+
+ clean:
+@@ -629,11 +631,7 @@
+
+
+ libcgal: ./local$(MULTI_SUFFIX)/lib/.xpt_libcgal
+-./local$(MULTI_SUFFIX)/lib/.xpt_libcgal: \
+-./local$(MULTI_SUFFIX)/lib/.xpt_zlib \
+-./local$(MULTI_SUFFIX)/lib/.xpt_libgmp \
+-./local$(MULTI_SUFFIX)/lib/.xpt_libmpfr \
+-./local$(MULTI_SUFFIX)/lib/.xpt_boost
++./local$(MULTI_SUFFIX)/lib/.xpt_libcgal:
+ @echo "building libcgal..."
+ @-mkdir -p "./local$(MULTI_SUFFIX)/include"
+ @-mkdir -p "./local$(MULTI_SUFFIX)/lib"
+@@ -663,24 +661,17 @@
+ endif
+ ifdef PLAT_LINUX
+ @cd "CGAL-$(VER_CGAL)" && \
++ sed -i.orig 81d src/CMakeLists.txt && \
+ cmake . -DCMAKE_INSTALL_PREFIX=$(DEFAULT_PREFIX) \
+ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=FALSE \
+ -DCGAL_CXX_FLAGS="$(VIS) -I$(DEFAULT_INCDIR)" \
+ -DCGAL_MODULE_LINKER_FLAGS="-L$(DEFAULT_LIBDIR)" \
+ -DCGAL_SHARED_LINKER_FLAGS="-L$(DEFAULT_LIBDIR)" \
+ -DCGAL_EXE_LINKER_FLAGS="-L$(DEFAULT_LIBDIR)" \
+- -DGMP_INCLUDE_DIR=$(DEFAULT_INCDIR) \
+- -DGMP_LIBRARIES_DIR=$(DEFAULT_LIBDIR) \
+- -DGMP_LIBRARIES=$(DEFAULT_LIBDIR)/libgmp.a \
+- -DGMPXX_INCLUDE_DIR=$(DEFAULT_INCDIR) \
+- -DGMPXX_LIBRARIES=$(DEFAULT_LIBDIR)/libgmpxx.a \
+- -DMPFR_INCLUDE_DIR=$(DEFAULT_INCDIR) \
+- -DMPFR_LIBRARIES_DIR=$(DEFAULT_LIBDIR) \
+- -DMPFR_LIBRARIES=$(DEFAULT_LIBDIR)/libmpfr.a \
+ -DWITH_CGAL_ImageIO=OFF -DWITH_CGAL_PDB=OFF -DWITH_CGAL_Qt3=OFF \
+- -DWITH_CGAL_Qt4=OFF -DBoost_INCLUDE_DIR=$(DEFAULT_PREFIX)/include \
+- -DBOOST_ROOT=$(DEFAULT_PREFIX) $(BE_QUIET) && \
+- make $(BE_QUIET) && make install $(BE_QUIET)
++ -DWITH_CGAL_Qt4=OFF \
++ $(BE_QUIET) && \
++ gmake $(BE_QUIET) && gmake install $(BE_QUIET)
+ endif
+ ifdef PLAT_MINGW
+ @cd "CGAL-$(VER_CGAL)" && \
diff --git a/games/xptools/files/patch-makerules_Meshtool b/games/xptools/files/patch-makerules_Meshtool
new file mode 100644
index 000000000000..6ff6ed618fb8
--- /dev/null
+++ b/games/xptools/files/patch-makerules_Meshtool
@@ -0,0 +1,34 @@
+--- makerules/MeshTool.orig 2017-04-14 14:21:02 UTC
++++ makerules/MeshTool
+@@ -11,18 +11,20 @@
+ ifdef PLAT_LINUX
+ LDFLAGS += -static
+ LIBS := ./libs/local$(MULTI_SUFFIX)/lib/libCGAL.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libboost_thread.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libboost_system.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libsquish.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libgeotiff.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libshp.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libproj.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libtiff.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libjpeg.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libpng.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libz.a
+-LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libjasper.a
++LIBS += ${PREFIX}/lib/libboost_thread.a
++LIBS += ${PREFIX}/lib/libboost_system.a
++LIBS += ${PREFIX}/lib/libsquish.a
++LIBS += ${PREFIX}/lib/libgeotiff.a
++LIBS += ${PREFIX}/lib/libshp.a
++LIBS += ${PREFIX}/lib/libproj.a
++LIBS += ${PREFIX}/lib/libtiff.a
++LIBS += ${PREFIX}/lib/libjbig.a
++LIBS += ${PREFIX}/lib/libjpeg.a
++LIBS += ${PREFIX}/lib/libpng.a
++LIBS += -lz -llzma
++LIBS += ${PREFIX}/lib/libjasper.a
+ LIBS += -lpthread -lrt
++LIBS += -lexecinfo -lelf
+ endif #PLAT_LINUX
+
+ ifdef PLAT_MINGW
diff --git a/games/xptools/files/patch-makerules_RenderFarmUI b/games/xptools/files/patch-makerules_RenderFarmUI
new file mode 100644
index 000000000000..c944e9dec233
--- /dev/null
+++ b/games/xptools/files/patch-makerules_RenderFarmUI
@@ -0,0 +1,25 @@
+--- makerules/RenderFarmUI.orig 2017-04-14 14:21:02 UTC
++++ makerules/RenderFarmUI
+@@ -14,10 +14,10 @@
+ LIBS += -Wl,--as-needed
+ LIBS += -Wl,-Bstatic -Wl,--start-group
+ LIBS += -lexpat -lsquish -lsqlite3 -lshp -lgeotiff
+-LIBS += -lCGAL -lCGAL_Core -lproj -lfreetype -ltiff -ljpeg -lpng -lz -ljasper
+-LIBS += -lgmp -lmpfr -lstdc++ -lm -lgcc -lgcc_eh
++LIBS += -lCGAL -lproj -lfreetype -ltiff -ljbig -ljpeg -lpng -lz -lbz2 -llzma -ljasper
++LIBS += -lgmp -lmpfr -lc++ -lm -lgcc -lgcc_eh
+ LIBS += -Wl,--end-group -Wl,-Bdynamic
+-LIBS += -lQtCore -lQtGui -lQtOpenGL -lGL -lGLU -ldl -lc
++LIBS += -lQtCore -lQtGui -lQtOpenGL -lGL -lGLU -lexecinfo -lelf -lc
+ LIBS += -lboost_thread -lboost_system -lpthread
+ endif #PLAT_LINUX
+
+@@ -39,7 +39,7 @@
+ LIBS += ./libs/local/lib/libpng.a
+ LIBS += ./libs/local/lib/libfreetype.a
+ LIBS += ./libs/local/lib/libexpat.a
+-LIBS += ./libs/local/lib/libz.a
++LIBS += /usr/lib/libz.a /usr/lib/libbz2.a /usr/lib/liblzma.a
+ endif #PLAT_DARWIN
+
+ ##
diff --git a/games/xptools/files/patch-makerules_global_paths.mk b/games/xptools/files/patch-makerules_global_paths.mk
new file mode 100644
index 000000000000..0ac7ee82bb42
--- /dev/null
+++ b/games/xptools/files/patch-makerules_global_paths.mk
@@ -0,0 +1,20 @@
+--- makerules/global/paths.mk.orig 2017-04-14 14:21:02 UTC
++++ makerules/global/paths.mk
+@@ -2,6 +2,8 @@
+ # project wide include and library searchpaths
+ ##############################################
+
++LIBPATHS += -L${PREFIX}/lib
++LIBPATHS += -L${PREFIX}/lib/qt4
+ LIBPATHS += -L./libs/local$(MULTI_SUFFIX)/lib
+
+ INCLUDEPATHS += -I./libs/local$(MULTI_SUFFIX)/include
+@@ -43,5 +44,7 @@
+
+ ifdef PLAT_LINUX
+ INCLUDEPATHS += -I./libs/local$(MULTI_SUFFIX)/include/mesa
+-INCLUDEPATHS += -I/usr/include/qt4
++INCLUDEPATHS += -I${PREFIX}/include
++INCLUDEPATHS += -I${PREFIX}/include/qt4
++INCLUDEPATHS += -I${PREFIX}/include/freetype2
+ endif #PLAT_LINUX
diff --git a/games/xptools/files/patch-makerules_global_toplevel.mk b/games/xptools/files/patch-makerules_global_toplevel.mk
new file mode 100644
index 000000000000..5363d5d0a8c6
--- /dev/null
+++ b/games/xptools/files/patch-makerules_global_toplevel.mk
@@ -0,0 +1,34 @@
+--- makerules/global/toplevel.mk.orig 2017-04-14 14:21:02 UTC
++++ makerules/global/toplevel.mk
+@@ -8,7 +8,7 @@
+ .PHONY: all clean linkclean
+
+ PLATFORM := $(shell uname)
+-ARCHITECTURE := $(shell uname -m)
++ARCHITECTURE := $(shell uname -m |sed s/amd64/x86_64/)
+ WD := $(PWD)
+
+
+@@ -23,6 +23,9 @@
+ ifeq ($(PLATFORM), Linux)
+ PLAT_LINUX := Yes
+ endif
++ifeq ($(PLATFORM), FreeBSD)
++ PLAT_LINUX := Yes
++endif
+ ifeq ($(PLATFORM), Darwin)
+ PLAT_DARWIN := Yes
+ endif
+@@ -110,9 +113,9 @@
+ # if someone has a ppc linux machine, please define -DLIL/-DBIG in the code,
+ # remove them here and use the __ppc__ macro to resolve endianess issues
+ DEFINES := -DLIN=1 -DIBM=0 -DAPL=0 -DLIL=1 -DBIG=0
+- CFLAGS := $(M32_SWITCH) -Wno-deprecated-declarations -Wno-multichar -pipe -frounding-math
+- CXXFLAGS := $(M32_SWITCH) -Wno-deprecated -Wno-deprecated-declarations -Wno-multichar -pipe -frounding-math
+- LDFLAGS := $(M32_SWITCH) -static-libgcc
++ CFLAGS := $(M32_SWITCH) -Wno-deprecated-declarations -Wno-multichar -pipe
++ CXXFLAGS := $(M32_SWITCH) -Wno-deprecated -Wno-deprecated-declarations -Wno-multichar -pipe
++ LDFLAGS := $(M32_SWITCH)
+ BARE_LDFLAGS :=
+ STRIPFLAGS := -s -x
+ endif
diff --git a/games/xptools/files/patch-src_GUI_GUI_Resources.cpp b/games/xptools/files/patch-src_GUI_GUI_Resources.cpp
new file mode 100644
index 000000000000..01b816d60c56
--- /dev/null
+++ b/games/xptools/files/patch-src_GUI_GUI_Resources.cpp
@@ -0,0 +1,11 @@
+--- src/GUI/GUI_Resources.cpp.orig 2017-04-14 14:21:02 UTC
++++ src/GUI/GUI_Resources.cpp
+@@ -242,7 +242,7 @@
+
+ GUI_Resource GUI_LoadResource(const char* in_resource)
+ {
+- if (sResMap.empty()) gModuleHandle = dlopen(0, RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
++ if (sResMap.empty()) gModuleHandle = dlopen(0, RTLD_NOW | RTLD_LOCAL);
+ if (!gModuleHandle)
+ {
+ printf("error opening module\n");
diff --git a/games/xptools/files/patch-src_Network_PCSBSocket.lin.cpp b/games/xptools/files/patch-src_Network_PCSBSocket.lin.cpp
new file mode 100644
index 000000000000..0205b411cc26
--- /dev/null
+++ b/games/xptools/files/patch-src_Network_PCSBSocket.lin.cpp
@@ -0,0 +1,12 @@
+--- src/Network/PCSBSocket.lin.cpp.orig 2017-04-14 14:21:02 UTC
++++ src/Network/PCSBSocket.lin.cpp
+@@ -30,9 +30,6 @@
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>
+ #include <sys/ioctl.h>
+-#if LIN
+- #include <asm/ioctls.h>
+-#endif
+ #include <arpa/inet.h>
+ #include <netdb.h>
+ #include <unistd.h>
diff --git a/games/xptools/files/patch-src_Obj_XDefs.h b/games/xptools/files/patch-src_Obj_XDefs.h
new file mode 100644
index 000000000000..5038021b7988
--- /dev/null
+++ b/games/xptools/files/patch-src_Obj_XDefs.h
@@ -0,0 +1,48 @@
+--- src/Obj/XDefs.h.orig 2017-04-14 14:21:02 UTC
++++ src/Obj/XDefs.h
+@@ -177,40 +177,21 @@
+ // #define __powerpc__
+ // #endif
+
+- #if APL || LIN || MINGW_BUILD
+-// TODO: replace this hack with standard conform <unordered_map>, <hash_map> will disappear in the near future
+- #define GCC_VERSION (__GNUC__ * 10000 \
+- + __GNUC_MINOR__ * 100 \
+- + __GNUC_PATCHLEVEL__)
+- #if GCC_VERSION >= 40300
+- #include <backward/hash_fun.h>
+- #include <backward/hash_map>
+- #else
+ #include <ext/hash_map>
+- #include <ext/hash_fun.h>
+- #endif
+-
+ namespace __gnu_cxx {
+ template<>
+ struct hash<std::string>
+ {
+ size_t
+ operator()(const std::string& __s) const
+- { return __stl_hash_string(__s.c_str()); }
+- };
+-
+- template<>
+- struct hash<float>
+- {
+- size_t
+- operator()(const float& __s) const
+- { return (size_t) __s; }
++ {
++ std::hash<std::string> hash_fn;
++ return hash_fn(__s);
++ }
+ };
+
+ }
+- #else
+- #include <hash_map>
+- #endif
++
+ using namespace std; // DEC THIS TO GET THE NEW IOS FUNCTIONS IN fstream, iomanip, and string, which are all new, unlike the old fstream.h, iomanip.h, and string.h
+ using namespace __gnu_cxx; // DEC THIS TO GET THE NEW IOS FUNCTIONS IN fstream, iomanip, and string, which are all new, unlike the old fstream.h, iomanip.h, and string.h
+ using __gnu_cxx::hash_map;
diff --git a/games/xptools/files/patch-src_UI_XGUIApp.cpp b/games/xptools/files/patch-src_UI_XGUIApp.cpp
new file mode 100644
index 000000000000..700435c3c03d
--- /dev/null
+++ b/games/xptools/files/patch-src_UI_XGUIApp.cpp
@@ -0,0 +1,11 @@
+--- src/UI/XGUIApp.cpp.orig 2017-04-14 14:21:02 UTC
++++ src/UI/XGUIApp.cpp
+@@ -26,6 +26,8 @@
+ #include "PlatformUtils.h"
+ #include "ObjCUtils.h"
+
++#include <locale.h>
++
+ class XGrinderWin;
+
+ #if IBM
diff --git a/games/xptools/files/patch-src_Utils_GISUtils.cpp b/games/xptools/files/patch-src_Utils_GISUtils.cpp
new file mode 100644
index 000000000000..8f83c299ac28
--- /dev/null
+++ b/games/xptools/files/patch-src_Utils_GISUtils.cpp
@@ -0,0 +1,15 @@
+--- src/Utils/GISUtils.cpp.orig 2017-11-07 02:12:22 UTC
++++ src/Utils/GISUtils.cpp
+@@ -40,12 +40,7 @@
+ // set to 1 to save geotiff inside geojp2 to disk
+ #define DUMP_GTIF 0
+
+-#if defined(IBM)
+- #include <libxtiff/xtiffio.h>
+- #include "GUI_Unicode.h"
+-#else
+ #include <xtiffio.h>
+-#endif
+ void make_cache_file_path(const char * cache_base, int west, int south, const char * cache_name, char path[1024])
+ {
+ sprintf(path, "%s%s%+03d%+04d%s%+03d%+04d.%s.txt", cache_base, DIR_STR, latlon_bucket (south), latlon_bucket (west), DIR_STR, (int) south, (int) west, cache_name);
diff --git a/games/xptools/files/patch-src_Utils_PlatformUtils.lin.cpp b/games/xptools/files/patch-src_Utils_PlatformUtils.lin.cpp
new file mode 100644
index 000000000000..3a1aef25bfac
--- /dev/null
+++ b/games/xptools/files/patch-src_Utils_PlatformUtils.lin.cpp
@@ -0,0 +1,10 @@
+--- src/Utils/PlatformUtils.lin.cpp.orig 2017-04-14 14:21:02 UTC
++++ src/Utils/PlatformUtils.lin.cpp
+@@ -28,7 +28,6 @@
+ #include <pwd.h>
+ #include <cstring>
+ #include <string>
+-#include <linux/limits.h>
+
+ string GetApplicationPath()
+ {
diff --git a/games/xptools/files/patch-src_WEDCore_WED_AppMain.cpp b/games/xptools/files/patch-src_WEDCore_WED_AppMain.cpp
new file mode 100644
index 000000000000..ad1196bffda9
--- /dev/null
+++ b/games/xptools/files/patch-src_WEDCore_WED_AppMain.cpp
@@ -0,0 +1,11 @@
+--- src/WEDCore/WED_AppMain.cpp.orig 2017-04-14 14:21:02 UTC
++++ src/WEDCore/WED_AppMain.cpp
+@@ -27,6 +27,8 @@
+ #include <stdio.h>
+ #endif
+
++#include <locale.h>
++
+ #include "WED_AboutBox.h"
+ // Stuff we need to init
+ //#include "XESInit.h"
diff --git a/games/xptools/files/patch-src_XESCore_Airports.cpp b/games/xptools/files/patch-src_XESCore_Airports.cpp
new file mode 100644
index 000000000000..d4de4e923a6a
--- /dev/null
+++ b/games/xptools/files/patch-src_XESCore_Airports.cpp
@@ -0,0 +1,14 @@
+/usr/local/include/boost/numeric/interval/hw_rounding.hpp:42:4: error: Boost.Numeric.Interval: Please specify rounding control mechanism.
+--- src/XESCore/Airports.cpp.orig 2017-11-07 03:31:14 UTC
++++ src/XESCore/Airports.cpp
+@@ -38,6 +38,10 @@
+ #include "CompGeomUtils.h"
+ #include "MapBuffer.h"
+ #include <CGAL/convex_hull_2.h>
++// FIXME Arch-specific!
++#define __x86_64__ YES
++#define __USE_ISOC99 YES
++// END FIXME
+ #include <CGAL/Sweep_line_2_algorithms.h>
+ #include <CGAL/Boolean_set_operations_2/Gps_polygon_validation.h>
+ #if DEV
diff --git a/games/xptools/files/patch-src__WEDImportExport__WED_DSFExport.cpp.patch b/games/xptools/files/patch-src__WEDImportExport__WED_DSFExport.cpp.patch
new file mode 100644
index 000000000000..3d920daf2d66
--- /dev/null
+++ b/games/xptools/files/patch-src__WEDImportExport__WED_DSFExport.cpp.patch
@@ -0,0 +1,38 @@
+--- src/WEDImportExport/WED_DSFExport.cpp.orig 2017-04-14 14:21:02 UTC
++++ src/WEDImportExport/WED_DSFExport.cpp
+@@ -685,7 +685,7 @@
+
+ }
+
+-static void DSF_AccumChainBezier(
++static void DSF_AccumChainBezier2p(
+ vector<Bezier2p>::const_iterator start,
+ vector<Bezier2p>::const_iterator end,
+ const Bbox2& bounds,
+@@ -802,7 +802,7 @@
+ }
+ }
+
+-static void DSF_AccumChain(
++static void DSF_AccumChain2p(
+ vector<Segment2p>::const_iterator start,
+ vector<Segment2p>::const_iterator end,
+ const Bbox2& bounds,
+@@ -1370,7 +1370,7 @@
+ if(fac_is_auto_closed && bad_match(chain.front(),chain.back()))
+ problem_children.insert(what);
+ else
+- DSF_AccumChainBezier(chain.begin(),chain.end(), safe_bounds, cbs,writer, idx, fac->GetHeight(), fac_is_auto_closed);
++ DSF_AccumChainBezier2p(chain.begin(),chain.end(), safe_bounds, cbs,writer, idx, fac->GetHeight(), fac_is_auto_closed);
+ }
+ }
+ else
+@@ -1391,7 +1391,7 @@
+ if(fac_is_auto_closed && bad_match(chain.front(),chain.back()))
+ problem_children.insert(what);
+ else
+- DSF_AccumChain(chain.begin(),chain.end(), safe_bounds, cbs,writer, idx, fac->GetHeight(), fac_is_auto_closed);
++ DSF_AccumChain2p(chain.begin(),chain.end(), safe_bounds, cbs,writer, idx, fac->GetHeight(), fac_is_auto_closed);
+ }
+ }
+ }
diff --git a/games/xptools/files/patch-src_linuxinit_initializer.cpp b/games/xptools/files/patch-src_linuxinit_initializer.cpp
new file mode 100644
index 000000000000..4cfda6408725
--- /dev/null
+++ b/games/xptools/files/patch-src_linuxinit_initializer.cpp
@@ -0,0 +1,13 @@
+--- src/linuxinit/initializer.cpp.orig 2017-04-14 14:21:02 UTC
++++ src/linuxinit/initializer.cpp
+@@ -102,9 +102,7 @@
+ }
+ m_init = true;
+ // Try to resolve /proc/self/exe first
+- if (!(m_abspath = canonicalize_file_name("/proc/self/exe")))
+- // Try argv[0]
+- if (!(m_abspath = canonicalize_file_name(*argv[0])))
++ if (!(m_abspath = *argv[0]))
+ goto critical;
+
+ temp = strdup(const_cast<const char* const>(m_abspath));
diff --git a/games/xptools/pkg-descr b/games/xptools/pkg-descr
new file mode 100644
index 000000000000..5ad0a46852b6
--- /dev/null
+++ b/games/xptools/pkg-descr
@@ -0,0 +1,7 @@
+The X-Plane Scenery Tools (XPTools) code base is the source code tree for all
+of the Laminar Research scenery creation/editing tools. This code does not
+include X-Plane and the "X-Apps" (PlaneMaker, WorldMaker, AirfoilMaker, and
+Briefer). It does include source to the ac3d x-plane plugin, WED, the various
+tools, and our global scenery generator.
+
+WWW: https://developer.x-plane.com/code/
diff --git a/games/xptools/pkg-message b/games/xptools/pkg-message
new file mode 100644
index 000000000000..78b5a566934d
--- /dev/null
+++ b/games/xptools/pkg-message
@@ -0,0 +1,16 @@
+X-Plane itself does not need to be installed before using WED. However, WED will
+require that you choose the X-Plane folder before it will allow you to do
+anything. Create a working directory with the following structure before
+starting WED for the first time.
+
+working directory <-- Pick a name
+ |--Custom Scenery
+ |--Global Scenery
+ |--Resources
+ |--default scenery
+
+You can create it with the following commands:
+
+$ mkdir working_directory
+$ cd working_directory
+$ mkdir -p 'Custom Scenery' 'Global Scenery' 'Resources/default scenery'
diff --git a/games/xptools/pkg-plist b/games/xptools/pkg-plist
new file mode 100644
index 000000000000..3c4746b294f1
--- /dev/null
+++ b/games/xptools/pkg-plist
@@ -0,0 +1,10 @@
+bin/DDSTool
+bin/DSFTool
+bin/MeshTool
+bin/ObjConverter
+bin/ObjView
+bin/RenderFarm
+bin/RenderFarmUI
+bin/WED
+bin/XGrinder
+bin/XPlaneSupportLin.p