Skip to content

Commit 614fa88

Browse files
committed
feat (libcurl): Tore out custom-built libcurl and libssl on Mac & Linux, using the system-provided version instead
This necessitated tearing out support for self-signed certificates, since they won't work with the Mac's security policy provider.
1 parent 2512413 commit 614fa88

21 files changed

+249
-130
lines changed

Building.md

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
The X-Plane Scenery Tools are available as source code, as well as binaries. This article describes how to get, compile, and modify the scenery tools code. See also the [Scenery Tools Bug Database](http://developer.x-plane.com/scenery-tools-bug-database/ "Scenery Tools Bug Database").
2+
3+
## Contents
4+
5+
- [Setting Up Your Build Environment](#setting-up-your-build-environment)
6+
- [macOS](#macos)
7+
- [Windows](#windows)
8+
- [Using MinGW on Windows](#using-mingw-on-windows)
9+
- [Linux](#linux)
10+
- [Getting the Source Code](#getting-the-source-code)
11+
- [Compiling the Program](#compiling-the-program)
12+
- [Building Libraries (Mac, Linux, and MinGW only)](#building-libraries-mac-linux-and-mingw-only)
13+
- [Building the Applications on Linux or MinGW](#building-the-applications-on-linux-or-mingw)
14+
- [Building on Windows Using Visual Studio](#building-on-windows-using-visual-studio)
15+
- [Building on macOS Using XCode](#building-on-macos-using-xcode)
16+
17+
18+
## Setting Up Your Build Environment
19+
20+
The X-Plane scenery tools code (XPTools) can be compiled for Mac, Windows, or Linux. Before you can work on the tools, you may need to get/update your development environment.
21+
22+
### macOS
23+
24+
To build on macOS, you’ll need at least macOS 10.12 (Sierra) and the latest version of Xcode ([free in the Mac App Store](https://apps.apple.com/us/app/xcode/id497799835?mt=12)) your OS supports.
25+
26+
You also need a command-line version of [CMake](http://www.cmake.org/) installed. The easiest way to get CMake is via [Homebrew](https://brew.sh): `$ brew install cmake`
27+
28+
### Windows
29+
30+
There are two choices for toolchains on Windows.
31+
32+
1. If you want to work on WED 1.3 or later (i.e., any version we’ve shipped for years now) you can use [Visual Studio](https://visualstudio.microsoft.com/vs/features/cplusplus/) 2017 or later (the free Community edition is fine). This is the easier, and recommended option.
33+
2. If you want to work on older versions of WED (pre-1.3) you will need to use MinGW.
34+
35+
In addition to the standard installation of Microsoft Visual Studio Community, you’ll also need some kind of Git client; [Git GUI](http://msysgit.github.io/) is a simple choice, and the command-line syntax listed here will work in the “GIT Bash” shell that comes with it.
36+
37+
The rest of this section covers using MinGW—if you’re using Visual Studio (recommended), jump ahead to [Getting the source code](#getting-the-source-code).
38+
39+
#### Using MinGW on Windows
40+
41+
**WARNING:** Make sure there are no spaces in the paths up to the code on Windows! The Makefile does not handle this case yet. You may want to consider this when installing the tools.
42+
43+
MinGW is the supported compiler—you will need to set up a full mingw environment with GCC 4.2.x or newer. The simplest way to do that is with the XPTools Environment Installer, which can be downloaded [here](http://dev.x-plane.com/download/tools/xptools-env-installer-1.2.0.exe).
44+
45+
The installer is a net-installer—that is, it will download the latest components to the build environment. The build environment is entirely self-contained – simply delete it when done – it does not install any registry keys, COM components, or other global “stuff”.
46+
47+
To start the environment, run `startenv.bat` from the root of the installation directory. It will put you automatically in the Scenery Tools Source directory if you choosed to download the sources during the installation, or into your home directory if you skipped that step.
48+
49+
To update the build environment itself (i.e. when we added a new gcc release for example) just start the environment and execute following commands:
50+
51+
cd /
52+
git pull origin master:master
53+
54+
This however might fail when we update bash or git in the environment because Windows locks files which are currently in use. In this case just re-run the Buildenvironment Installer over an existing installation to update the environment (you will need an installer version >= 1.1.1 for this to work).
55+
56+
Similary you can update the Scenery Tools source tree with:
57+
58+
cd /xptools
59+
git pull origin master:master
60+
61+
Note that you aren’t on the master branch after a fresh installation, but a specific commit because the Scenery Tools tree is registered as a git submodule in the build environment. Therefore you need to make sure that you switch to the master branch before building the tools after updating the tree (you need to do this only once after a fresh installation):
62+
63+
cd /xptools
64+
git checkout master
65+
66+
### Linux
67+
68+
You will need GCC 7, along with a few other packages:
69+
70+
* gnu make
71+
* gnu coreutils
72+
* binutils, binutils-devel if applicable for libbfd.a
73+
* libmpfr-devel
74+
* qt4-devel
75+
* mesa-libGL-devel, mesa-libGLU-devel or the proprietary variants from ATI or NVidia
76+
* libcurl4-openssl-dev
77+
78+
* * *
79+
80+
## Getting the Source Code
81+
82+
The source code now lives on [GitHub](https://github.com/X-Plane/xptools)! You can browse the code online, download it, or clone it using all of the standard GitHub techniques. Clone the complete repo like this:
83+
84+
git clone --recurse-submodules https://github.com/X-Plane/xptools.git
85+
86+
(Note that `--recurse-submodules` is necessary to also get the libraries to build from source.)
87+
88+
If you don’t want a complete clone of the code, you can of course use GitHub to just download a ZIP of the most recent code, or download any major release; binary tools releases have matching tags in the repo.
89+
90+
* * *
91+
92+
## Compiling the Program
93+
94+
The scenery tools source code depends on a large number of third party libraries; to make cross-platform development easier, they live in a Git sub-module (`libs` for Mac, Linux, and MinGW, `msvc_libs` for Visual Studio on Windows).
95+
96+
### Building Libraries (Mac, Linux, and MinGW only)
97+
98+
(This step is not necessary when using MSVC to build WorldEditor 1.3 or newer on Windows.)
99+
100+
The first time you want to compile, you need to first download and compile your libraries. From your repository you can do this:
101+
102+
git submodule update --init
103+
cd libs
104+
make -j
105+
106+
The libraries can take 20-30 minutes to compile!
107+
108+
### Building the Applications on Linux or MinGW
109+
110+
I tried to make this process as simple as possible. First of all make sure that you have following prerequisites installed:
111+
112+
* development packages of libbfd (mostly included in binutils), libmpfr, libz and boost
113+
* gcc 7
114+
* gnu make
115+
116+
then just do a
117+
118+
make -j
119+
120+
in the Scenery Tools root directory. After awhile, the output can be found under
121+
122+
[xptools dir]/build/[platform]/[configuration]
123+
124+
The platform is determined automatically (when building on Linux it is Linux of course). The configuration defaults to `debug_opt`. You can specify the configuration when building the tools this way:
125+
126+
make conf=[configuration]
127+
128+
where `[configuration]` can be one of the following:
129+
130+
* `release`
131+
* `release_opt`
132+
* `debug`
133+
* `debug_opt`
134+
135+
The `_opt` variants are built with `-O2` set, the others with `-O0`. `release` variants are built with `-DDEV=0` set, while `debug` variants have `-DDEV=1`.
136+
137+
To clean the tree you can do:
138+
139+
* `make clean`, this just deletes the `build` directory
140+
* `make distclean`, this deletes the `build` directory and the built 3rd-party libraries located in `libs/local`
141+
142+
You can also build a single tool or a set of tools like this:
143+
144+
conf=release_opt make [tool_1] [tool_2] [...tool_n]
145+
146+
Available tools are:
147+
148+
* `ac3d`
149+
* `DDSTool`
150+
* `DSFTool`
151+
* `MeshTool`
152+
* `ObjConverter`
153+
* `ObjView`
154+
* `RenderFarm`
155+
* `RenderFarmUI`
156+
* `WED`
157+
* `XGrinder`
158+
159+
### Building on Windows Using Visual Studio
160+
161+
The MSVC solution file (`.sln`) can be found in `msvc/XPTools.sln`, and it contains projects that build WorldEditor and the reset of the tools. The MSVC project uses the standard debug and release targets.
162+
163+
### Building on macOS Using XCode
164+
165+
The XCode project is in the root of the repo, `SceneryTools.xcodeproj`. There is one target for each of the scenery tools—simply pick a configuration, target, and build.
166+
167+
**Important**: Before building on the Mac for the first time, you must build the libraries as described above.
168+

README.md

+30-17
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,48 @@ of the Laminar Research scenery creation/editing tools. This does not
66
include X-Plane, Plane Maker, or Airfoil Maker. It does include source to WorldEditor (WED),
77
and our global scenery generator RenderFarm, and other tools.
88

9-
The latest info on basic usage of this repository can be found [on the X-Plane
10-
Developer site](https://developer.x-plane.com/code/).
9+
Contents
10+
-------------------------------------------------------------------------------
1111

12+
- [Licensing and Copyright](#licensing-and-copyright)
13+
- [Building the Applications](#building-the-applications)
14+
- [Contributing Using Git & GitHub](#contributing-using-git--github)
15+
- [Top Level File Structure](#top-level-file-structure)
16+
- [Documentation](#documentation)
17+
- [Mailing List/Contact](#mailing-listcontact)
1218

1319
Licensing and Copyright
1420
-------------------------------------------------------------------------------
1521

1622
The code original to Laminar Research lives in the sub-directory "src" and is licensed
17-
under the MIT/X11 license. If you find a source file with no copyright, or double/
18-
conflicting copyright, please report this (see contact info below)—this is
19-
probably a clerical error.
23+
under the MIT/X11 license. If you find a source file with no copyright, or double/conflicting
24+
copyright, please report this (see contact info below)—this is probably a clerical error.
2025

21-
The directory `libs` contains tarballs of a number of publicly available open
22-
source libraries—they are included for convenience in building. I believe
23-
that all of the libsrc libraries are under either an MIT/X11-type or GPL-type
26+
[The `libs` submodule](https://github.com/X-Plane/xptools_libs) contains tarballs of a number
27+
of publicly available open-source libraries—they are included for convenience in building.
28+
To the best of our knowledge, all libraries are under either an MIT/X11-type or GPL-type
2429
license—if you find a library that is incompatible with WED's licensing,
2530
please report this.
2631

27-
Build materials are in the root directory.
32+
[Building the Applications](Building.md)
33+
-------------------------------------------------------------------------------
34+
35+
See [Building.md](Building.md) for setup, build instructions, and dev environment setup.
36+
37+
We do our best to keep `master` building all projects and in general be release-ready,
38+
but to get a stable release, use a tag associated with some kind of beta or release milestone.
2839

29-
Building
40+
41+
Contributing Using Git & GitHub
3042
-------------------------------------------------------------------------------
3143

32-
[See the Developer site](https://developer.x-plane.com/code/) for setup,
33-
build instructions, and dev environment setup.
44+
If you’d like to contribute to the project, you can do so by forking the repo on GitHub and making a pull request. (If you’re new to Git or GitHub, have a look at [the GitHub guides](https://guides.github.com), especially “Hello World” and the Git Handbook.)
45+
46+
In general, the repo’s `master` branch reflects the current state of development, while release branches are used for staging and patching binary releases (so, for instance, `wed_230_release` is the release branch for WED version 2.3). There are also corresponding tags for public releases (e.g., `wed_231r1`).
47+
48+
Starting a new development branch based on the tip of `master` is probably a good idea to avoid merge conflicts. I encourage the use of `git rebase` after pulling new changes and updating the master branch to have your local development branch up-to-date, unless you have people pulling from your repository. In that case, merging `master` back to your development branch is a better choice because rebasing causes the creation of new commits with new SHA1 checksums which might distort the workflow of users pulling from your repository.
3449

35-
If you have the "latest" version of the code, some projects may not build,
36-
or may not build in release mode. To get a stable release, use a tag
37-
associated with some kind of beta or release milestone.
50+
Once you’ve finished your work and you think it’s time to submit your changes, you can use the GitHub UI to submit a pull request.
3851

3952
Top Level File Structure
4053
-------------------------------------------------------------------------------
@@ -74,7 +87,7 @@ Documentation about sub-modules of the code are typically in a file called
7487
README in the directory being documented. For example,
7588
see src/XESCore/README.txt for notes on the XESCore package.
7689

77-
Contact
90+
Mailing List/Contact
7891
-------------------------------------------------------------------------------
7992

80-
ben at x-plane.com
93+
We have a private Slack, as well as a private “Google Groups” email list to communicate about development of WED and other tools. To get involved, shoot Tyler an email at his first name at X-Plane.com.

SceneryTools.xcodeproj/project.pbxproj

+12-12
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
02DE8F05241FC479003E72C5 /* bucketalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 02DE8EEA241FC439003E72C5 /* bucketalloc.c */; };
167167
02F4A70C204E6F4700E241B3 /* worldmap.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 02F4A70A204E6F1700E241B3 /* worldmap.jpg */; };
168168
2F1515C61D0BA700002224B1 /* WED_MetaDataKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2F1515C41D0BA700002224B1 /* WED_MetaDataKeys.cpp */; };
169+
2F2135C92593A53700762DB7 /* libcurl.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 2F2135C82593A53600762DB7 /* libcurl.tbd */; };
169170
2F8378A01D070F000033848D /* CACHE_DomainPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2F83789E1D070F000033848D /* CACHE_DomainPolicy.cpp */; };
170171
2FD1A6C7237A0D7400B4F651 /* CmdLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FD1A6C5237A0D7400B4F651 /* CmdLine.cpp */; };
171172
2FD1A6C8237A0D7400B4F651 /* CmdLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FD1A6C5237A0D7400B4F651 /* CmdLine.cpp */; };
@@ -1200,6 +1201,7 @@
12001201
20286C33FDCF999611CA2CEA /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
12011202
2F1515C41D0BA700002224B1 /* WED_MetaDataKeys.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WED_MetaDataKeys.cpp; sourceTree = "<group>"; };
12021203
2F1515C51D0BA700002224B1 /* WED_MetaDataKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WED_MetaDataKeys.h; sourceTree = "<group>"; };
1204+
2F2135C82593A53600762DB7 /* libcurl.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcurl.tbd; path = usr/lib/libcurl.tbd; sourceTree = SDKROOT; };
12031205
2F83789E1D070F000033848D /* CACHE_DomainPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CACHE_DomainPolicy.cpp; sourceTree = "<group>"; };
12041206
2F83789F1D070F000033848D /* CACHE_DomainPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CACHE_DomainPolicy.h; sourceTree = "<group>"; };
12051207
2FD1A6C5237A0D7400B4F651 /* CmdLine.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CmdLine.cpp; sourceTree = "<group>"; };
@@ -2334,6 +2336,7 @@
23342336
isa = PBXFrameworksBuildPhase;
23352337
buildActionMask = 2147483647;
23362338
files = (
2339+
2F2135C92593A53700762DB7 /* libcurl.tbd in Frameworks */,
23372340
D604AEB01C0E364E006DC1F0 /* AppKit.framework in Frameworks */,
23382341
D6ED373D0B67964D00D5484E /* OpenGL.framework in Frameworks */,
23392342
0269A8561FF5F8F10085A37C /* Carbon.framework in Frameworks */,
@@ -2433,6 +2436,7 @@
24332436
D6BC361B0AB22C84003949C5 /* src */,
24342437
20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */,
24352438
195DF8CFFE9D517E11CA2CBB /* Products */,
2439+
2F2135C72593A53600762DB7 /* Frameworks */,
24362440
);
24372441
name = SceneryTools;
24382442
sourceTree = "<group>";
@@ -2448,6 +2452,14 @@
24482452
name = "External Frameworks and Libraries";
24492453
sourceTree = "<group>";
24502454
};
2455+
2F2135C72593A53600762DB7 /* Frameworks */ = {
2456+
isa = PBXGroup;
2457+
children = (
2458+
2F2135C82593A53600762DB7 /* libcurl.tbd */,
2459+
);
2460+
name = Frameworks;
2461+
sourceTree = "<group>";
2462+
};
24512463
D60734500D197AF600E08F61 /* MeshTool */ = {
24522464
isa = PBXGroup;
24532465
children = (
@@ -5529,9 +5541,6 @@
55295541
libs/local/lib/libjpeg.a,
55305542
libs/local/lib/libgeotiff.a,
55315543
libs/local/lib/libsquish.a,
5532-
libs/local/lib/libcrypto.a,
5533-
libs/local/lib/libssl.a,
5534-
libs/local/lib/libcurl.a,
55355544
);
55365545
PRODUCT_BUNDLE_IDENTIFIER = com.laminar_research.WED;
55375546
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";
@@ -6047,9 +6056,6 @@
60476056
libs/local/lib/libjpeg.a,
60486057
libs/local/lib/libgeotiff.a,
60496058
libs/local/lib/libsquish.a,
6050-
libs/local/lib/libcrypto.a,
6051-
libs/local/lib/libssl.a,
6052-
libs/local/lib/libcurl.a,
60536059
);
60546060
PRODUCT_BUNDLE_IDENTIFIER = com.laminar_research.WED;
60556061
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";
@@ -6091,9 +6097,6 @@
60916097
libs/local/lib/libjpeg.a,
60926098
libs/local/lib/libgeotiff.a,
60936099
libs/local/lib/libsquish.a,
6094-
libs/local/lib/libcrypto.a,
6095-
libs/local/lib/libssl.a,
6096-
libs/local/lib/libcurl.a,
60976100
);
60986101
PRODUCT_BUNDLE_IDENTIFIER = com.laminar_research.WED;
60996102
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";
@@ -6223,9 +6226,6 @@
62236226
libs/local/lib/libjpeg.a,
62246227
libs/local/lib/libgeotiff.a,
62256228
libs/local/lib/libsquish.a,
6226-
libs/local/lib/libcrypto.a,
6227-
libs/local/lib/libssl.a,
6228-
libs/local/lib/libcurl.a,
62296229
);
62306230
PRODUCT_BUNDLE_IDENTIFIER = com.laminar_research.WED;
62316231
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";

makerules/WED

+2-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ else
1717
LIBS += -lfltk -lfltk_gl -lGL
1818
endif #FLTK_STATIC
1919
LIBS += -lGLU -ldl -lpthread
20+
LIBS += -lcurl
2021
endif #PLAT_LINUX
2122

2223
ifdef PLAT_MINGW
@@ -32,18 +33,14 @@ LIBS += -lcomdlg32
3233
LIBS += -luuid
3334
LIBS += -lws2_32
3435
LIBS += -lboost_thread
36+
LIBS += -lcurl
3537
endif #PLAT_MINGW
3638

3739
ifdef PLAT_DARWIN
3840
LDFLAGS += -framework Carbon -framework OpenGL -framework AppKit
3941
LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libboost_thread.a
4042
endif #PLAT_DARWIN
4143

42-
LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libcurl.a
43-
LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libssl.a
44-
LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libcrypto.a
45-
#LIBS := ./libs/local$(MULTI_SUFFIX)/lib/libCGAL.a
46-
#LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libCGAL_Core.a
4744
LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libexpat.a
4845
LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libsquish.a
4946
LIBS += ./libs/local$(MULTI_SUFFIX)/lib/libgeotiff.a

0 commit comments

Comments
 (0)