diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 6c747fd1c..04bf2f95f 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -99,6 +99,8 @@ jobs: - name: Install Mozilla static library run: | oolite/ShellScripts/Linux/install_mozilla_js.sh system + echo "/usr/local/lib" | tee -a /etc/ld.so.conf + ldconfig - name: Build Oolite env: SEMVER: ${{ needs.common.outputs.SEMVER }} diff --git a/.github/workflows/test_builds.yaml b/.github/workflows/test_builds.yaml index a7ad6f47e..ebf28ae4c 100644 --- a/.github/workflows/test_builds.yaml +++ b/.github/workflows/test_builds.yaml @@ -36,6 +36,8 @@ jobs: - name: Build GNUstep run: | ShellScripts/Linux/build_gnustep.sh system + echo "/usr/local/lib" | tee -a /etc/ld.so.conf + ldconfig - name: Install Mozilla static library run: | ShellScripts/Linux/install_mozilla_js.sh system @@ -81,6 +83,8 @@ jobs: - name: Install Mozilla static library run: | ShellScripts/Linux/install_mozilla_js.sh system + echo "/usr/local/lib64" | tee -a /etc/ld.so.conf + ldconfig - name: Build and test Oolite if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name run: | @@ -123,6 +127,8 @@ jobs: - name: Install Mozilla static library run: | ShellScripts/Linux/install_mozilla_js.sh system + echo "/usr/local/lib" | tee -a /etc/ld.so.conf + ldconfig - name: Build and test Oolite if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name run: | diff --git a/.gitignore b/.gitignore index bfb5ba252..355e7554a 100644 --- a/.gitignore +++ b/.gitignore @@ -23,11 +23,6 @@ deps/libpng # Build products build/ -oolite.app -obj.spk -obj.win.spk -obj.spk.dbg -obj.win.spk.dbg tools/icosmesh/obj doxygen/ libobjc2/ diff --git a/Doc/ExternalLibrariesSourceCodeChanges.txt b/Doc/ExternalLibrariesSourceCodeChanges.txt deleted file mode 100644 index 1718c6c48..000000000 --- a/Doc/ExternalLibrariesSourceCodeChanges.txt +++ /dev/null @@ -1,129 +0,0 @@ -Modifications to external libraries' source code for running Oolite -------------------------------------------------------------------- - -The various ports of Oolite are using a number of external libraries for graphics, sound, input and event handling. Throughout development, certain changes to the source code of these libraries have been deemed necessary, either to enable Oolite to run in a more efficient and independent manner, or simply to fix issues that occurred as a result of these external libraries themselves. Of these libraries, the ones that have to be rebuilt specifically for Oolite, together with the main reasons/areas changed for this reason are: - -1. gnustep-base v1.20.1 (Windows) - bug in NSInteger definition, change to dictionary format of NSUserDefaults, fix for integer truncation of integers to 32-bit when parsing XML plists (bug #32495 on the gnustep.org bugtracker) and changes to facilitate native Obj-C exceptions support. Also, fix bug in the stack grabbing code at NSDebug.m so that correct stack traces can be obtained also on Windows XP and later. -2. SDL v1.2.13 (Windows) – window resizing issues, backported fix for setting gamma crash, haptic devices support, mousewheel delta support, fix for Alt key state when returning from Alt-Tab, support for OpenGL float pixel format types. -3. SpiderMonkey v1.85 (all platforms) - certain JS macro definitions required by Oolite not guaranteed or non-existent in standard library. -4. eSpeak v1.43.03 (Windows) - Special build of the Windows speech synthesis libespeak.dll to enable asynchronous playback. Also, defaults the eSpeak data directory to Resources/espeak-data. - -The changes made in the source code of each of these libraries are as follows: - -1. gnustep-base v1.20.1 (Windows) - -- GSConfig.h (build generated file): In the section reading -/* - * Integer type with same size as a pointer - */ -typedef unsigned int gsuaddr; -typedef int gssaddr; -typedef gsuaddr gsaddr; - -Change -typedef gsuaddr gsaddr; -to -typedef gssaddr gsaddr; -to fix incorrect definition of NSInteger. - -- The NSUserDefaults system dictionary (.GNUstepDefaults) is written in XML format in GNUstep 1.20.1. This is inconvenient for Oolite, where the more human-friendly OpenStep format for plists is used. The static BOOL writeDictionary(NSDictionary *dict, NSString *file) function, at around line 157 of the NSUserDefaults.m file is therefore changed to read as below: -data = [NSPropertyListSerialization dataFromPropertyList: dict - //format: NSPropertyListXMLFormat_v1_0 // no XML format, use OpenStep istead - format: NSPropertyListOpenStepFormat - errorDescription: &err]; - -- When parsing XML plists, integers are truncated to 32-bit, effectively prohibiting the correct parsing of long long or unsigned long long values. The fix applied in the gnustep-base-1_20.dll distributed with Oolite in order to address this is: -a) Changing line 309 of NSPropertyList.m of the GNUstep base source code distribution from -ASSIGN(plist, [NSNumber numberWithInt: [value intValue]]); -to -ASSIGN(plist, [NSNumber numberWithLongLong: [value longLongValue]]); -and b) Changing line 1103 of the same file from -result = [[NSNumber alloc] initWithLong: atol(buf)]; -to -result = [[NSNumber alloc] initWithLongLong: atoll(buf)]; - -- The stack backtrace grabbing code in NSDebug.m works for Linux but fails on Windows. The GSPrivateStackAddresses function has been modified to use the WinAPI CaptureStackBacktrace method, so that it returns a correct stack backtrace also on Windows (64-bit only, 32-bit version not modified because we want to keep backwards compatibility as much as possible). The modified function is as follows: -NSMutableArray * GSPrivateStackAddresses(void) -{ - NSMutableArray *stack; - NSAutoreleasePool *pool; - -#if HAVE_BACKTRACE - void *addresses[1024]; - int n = backtrace(addresses, 1024); - int i; - - stack = [NSMutableArray arrayWithCapacity: n]; - pool = [NSAutoreleasePool new]; - for (i = 0; i < n; i++) - { - [stack addObject: [NSValue valueWithPointer: addresses[i]]]; - } -#else // Windows code here - unsigned i; - const int kMaxCallers = 62; - void* callers[kMaxCallers]; - unsigned n = CaptureStackBackTrace(0, kMaxCallers, callers, NULL); - - stack = [NSMutableArray arrayWithCapacity: n]; - pool = [NSAutoreleasePool new]; - for (i = 0; i < n; i++) - { - [stack addObject: [NSValue valueWithPointer: callers[i]]]; - } -#endif // HAVE_BACKTRACE - RELEASE(pool); - return stack; -} - -- The GNUstep objc-1.dll runtime has been rebuilt with native Obj-C exception support. To do this on Windows, the patch which provides the void (*_objc_unexpected_exception) (id exception) callback hook to the runtime is required for versions of gcc older than 4.4.0. The patch can be downloaded from http://gcc.gnu.org/bugzilla/attachment.cgi?id=17365. Also, the gcc source header unwind-pe.h must be visible to exception.c in order for the build of libobjc to succeed. - -The full source code of GNUstep 1.20.1 is available from -ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-base-1.20.1.tar.gz - - - -2. SDL v1.2.13 (Windows) - -The files OOSDLdll_x64.patch and OOSDLdll_x86.patch contain all the changes required for re-creating the SDL.dll used by Oolite on Windows. To apply the patches, you will need to have OoliteDevelopmentEnvironment - Light Edition installed, downloadable from https://drive.google.com/file/d/12xoD3sT1D9yDmOBPp0DKJ0HXWD4-dJjd/view?usp=sharing. Instructions for setting it up can be found at http://www.aegidian.org/bb/viewtopic.php?t=5943. Then, download the SDL-1.2.13 source code from https://sourceforge.net/projects/libsdl/files/SDL/1.2.13/SDL-1.2.13.tar.gz/download, extract the folder SDL-1.2.13 to an empty directory, then copy the appropriate patch file to that same directory. Finally, from the Oolite Development Environment console, cd to that folder and execute 'patch -s -d SDL-1.2.13 -p1 < OOSDLdll_x64.patch' or 'patch -s -d SDL-1.2.13 -p1 < OOSDLdll_x86.patch' and you are ready to cd to the updated SDL-1.2.13 folder and run 'make' inside it in order to build SDL.dll. -The changes in brief: -- Enabled window resizing without side effects like texture corruption in the Windows port of Oolite. -- Fixed crash occurring when attempting to set the screen gamma value. This fix occurred in a later version of SDL and was backported to the version used with the Windows port of Oolite. -- Backported haptic devices support from later SDL version. This allows force feedback joysticks to work in the game. -- Added mousewheel delta support in the Windows port of Oolite for smoother mousewheel end-user experience. -- Fixed Alt key state not being recognized correctly when returning to the app via Alt-Tab. This is a fix backported from SDL 1.2.15. -- Added capability to accept float pixel types when creating OpenGL window. This is required for HDR output. - - - -3. SpiderMonkey v1.85 (all platforms) - -- Specific build settings for Oolite are required. Library rebuilt with the following macros defined as shown below: - JS_THREADSAFE defined on Mac and Linux debug builds. - MOZ_TRACE_JSCALLS defined in order to enable full JavaScript profiling. -The entire source code of the library can be downloaded from ftp://anonymous@ftp.mozilla.org/pub/firefox/releases/4.0/source/firefox-4.0.source.tar.bz2 - - - -4. eSpeak v1.43.03 (Windows) - -- The libespeak.dll has been custom-built for the Windows port of Oolite to enable asynchronous playback and to also default the eSpeak data files folder to Resources/espeak-data. The source files that need to be changed for this to happen can be found inside deps/Windows-x86-deps/OOeSpeakWin32DLLBuild. The instructions for building this library, for those interested, are as follows: - - You will need to have OoliteDevelopmentEnvironment - Light Edition installed, obtainable from the links mentioned earlier in this document. - - Download espeak-1.43.03-source.zip either from http://espeak.sourceforge.net/download.html or directly from its repository ( http://sourceforge.net/projects/espeak/files/espeak/espeak-1.43/espeak-1.43.03-source.zip/download ). - - Unzip the file to a folder of choice, maintaining the directory structure. We'll refer to this folder as . - - Copy the files - Makefile - gettimeofday.c - speak_lib.cpp - speech.h - from deps/Windows-x86-deps/OOeSpeakWin32DLLBuild to /src. - - Rename the file /src/portaudio19.h to portaudio.h. - - Copy the file speak_lib.h from /platforms/windows/windows_dll/src to /src. - - Start up MinGW/MSYS and change working directory to the /src folder. - - Execute 'make libespeak.dll' from the command prompt. - - The library should compile and at the end of the build you should have a file named libespeak.dll (the actual binary) and the import library file libespeak.dll.a, for use when you want to link libespeak.dll to your project. - - - - -Certain other Oolite dependencies are built with specific project settings on the Mac platform, without further changes to their source code. These libraries are libpng (uses also a custom pngusr.h header for the Mac version) and libogg/libvorbis. Also, the Mac debug support uses a modified version of RBSplitView, mostly to enable it to build on 64-bit Mac OS X. diff --git a/Doc/FAQ.TXT b/Doc/FAQ.TXT deleted file mode 100644 index 9942e62ec..000000000 --- a/Doc/FAQ.TXT +++ /dev/null @@ -1,149 +0,0 @@ -Oolite-Linux Frequently Asked Questions -======================================= - -Note: Long answers to questions about installing and gameplay can be -found in README.TXT and PLAYING.TXT respectively. - -General questions about Oolite for any platform ------------------------------------------------ -1. What's the point of the game? -To fly from planet to planet, buying and selling goods, shooting pirates -or committing acts of piracy. There's no goal other than perhaps to achieve -the rank of ELITE. - -1.1. I'm still confused, how do I play? -Have a look at Ian Bell's Flight Training Manual for the original BBC Elite, -some of Oolite's control keys are different from the original, so be sure -to read it alongside the Oolite Controls Wiki section. -( http://www.iancgbell.clara.net/elite/ ) -( http://wiki.alioth.net/index.php/Oolite_Keyboard_Controls ) - -1.2. What do the various colors represent on the radar? -White - unpowered items that can't mass-lock the in-system drive. -Green/Yellow - navigation buoys. -Yellow - powered craft. -Red - powered craft identified as hostile. -Green - space stations. -Green/Red - thargoids -Purple - police -Blue/Red - police on intercept -Red/Yellow - active mine (about to detonate) - -1.3. Why are the ships so slow? It takes up to half-an-hour to get to the -spacestation when you enter a system! -Oolite is a simulation game — one based on a game design that comes from -a time before 'twitch' gaming. That said, there are plenty of ways to speed -up your game and cut that journey time dramatically. For the full story -read this post on the Oolite Bulletin Board. -( http://aegidian.org/bb/viewtopic.php?t=301 ) - -1.4. My keyboard doesn't have a particular key used by Oolite, what can -I do to change the keys? -Oolite reads a key configuration file called keyconfig.plist that (from v1.40) -you can find at /AddOns/Config/keyconfig.plist (previous versions of -Oolite can also read this file but you have to create it first). You -can open this file in any text editor and change the ASCII values of -the keys used to suit your own preferences. - -2. Does it work on Mac OS X 10.2 (Jaguar)? -Yes, from version 1.20 to version 1.51 Oolite works with Mac OS X 10.2.8. -There are still has some problems with Speech Synthesis and handling -events in full-screen mode though, so you're advised not to use those -options. -Keeping Oolite compatible with 10.2.8 has been a task with diminishing -returns for me, and from v1.52 I will only be supporting Mac OS X 10.3 -and higher. - -3. Is there a port for the PC or Linux? -Yes. Some people are working on this, porting my code to GNUStep and SDL. -You can find links to their work under 'Ports' in the nav-bar to the left - -4. I have a question not answered here, where can I get help? -At the Oolite Bulletin Boards, the Elite Bulletin Board System, or by -emailing the author. -Oolite BBS: http://aegidian.org/bb -Elite BBS: http://www.alioth.net/cgi-bin/bbs.pl?siteId=1&action=show -Author: -Linux port: / - - -Linux Specific Questions ------------------------- -1. Why does Oolite use GNUstep? -Oolite was written for the Macintosh and was at 'production level' for about -a year before the Linux port was started. Mac OS X is essentially what -NeXTstep/OpenStep became when Apple bought NeXT. Oolite was written in -Objective-C using Cocoa (the Macintosh Objective-C libraries). GNUstep -provide the same Objective-C classes that are used by Mac OS X for building -utilities and applications. -To not need GNUstep, Oolite would have to be totally rewritten from scratch. -There was a project early on to make a Win32 port by converting objc to C++ -automatically, but the project seems to have vanished. It is likely that -the mechanical conversion of objc to C++ would be the easy bit - then -you still have to re-implement Cocoa/GNUstep as C++ classes; a task -of truly epic proportions. -Even if it was practical, it would mean that any new features implemented -for a C++ version of the game would have to be backported into the ObjC -version of the game on the Mac, a much more troublesome task than the -simple code merges that are possible now, as the GNUstep code and -Mac OS X code are 99% the same. - -2. What are the positives of using GNUstep? -A well developed object oriented library for Objective-C, plus the just mentioned commonality with the OS X code base which forms the -root of Oolite. -Oolite probably also has the distinction of being the only proper -GNUstep OpenGL game :-) - -3. What are the downsides of using GNUstep? -Most Linux users don't have GNUstep installed. This is easily solved with -the dependency pack that comes with this Oolite binary installer, but it -does mean Oolite uses a bit more memory than you'd expect if the game -was written just with C and SDL/OpenGL, and the performance probably -takes a bit of a hit because Objective-C uses more 'real' message passing -than languages like C++. However, I do have a 5 year old laptop I do -tests on, and it runs fine on that. - -4. What distros will Oolite run on? -Hopefully any distro that came out within the last couple of years -with a 2.4 or 2.6 kernel. -The package you have now is known to run on: -- Gentoo -- Fedora Core 2 -- CentOS 4.1 -- Ubuntu 5.04 -- Debian Sid (Sept 2005) -- Knoppix 3.7 (with the 2.4 kernel) - -5. What dependencies do I need? -Aside from X, you'll need accelerated OpenGL. The game plays well with -relatively modest accelerated 3D hardware - the frame rate is acceptable -on thte Radeon Mobility M6 on older laptops, and I've found it playable -on HP/Compaq 'business' PCs such as the d510 which has cheap integrated -onboard Intel graphics. Of course it plays VERY well on my development -system with is a P4 with a GeForce 4 Ti 4200. -Aside from that, you shouldn't need any additional software dependencies -since most of the libraries are part of the dependencies pack that's -included with this package. - -6. Where can I get the source code for the game? -You can get the full game source from the following two places: -FTP: ftp://ftp.alioth.net/oolite (look for the 'src' tarballs) -HTTP: http://oolite-linux.berlios.de - -You can also get the latest source by anonymous SVN - see -http://oolite-linux.berlios.de for more details. - -Source code (mainly tarballs) for the dependency pack can be found -at ftp.alioth.net/oolite-depends-source - -7. What about other (non x86) architectures? -Sadly, I don't have any non-x86 architecture systems I can install Linux on -to build the game. However, binaries for other architectures are always -welcome - please contact if you've successfully built -and run the game on non-x86 platforms. You shouldn't run into endian-ness -problems as it already runs on macppc under OS X, but I've heard the odd -report that building GNUstep on 64-bit archs failed - but if you have -an amd64 system - please try and build it and let me know the results! -(Additionally, last time I tried to build GNUstep on Fedora Core 4 it failed -due to an internal compiler error in gcc 4) - diff --git a/Doc/PORTING.TXT b/Doc/PORTING.TXT deleted file mode 100644 index ff3f0fae9..000000000 --- a/Doc/PORTING.TXT +++ /dev/null @@ -1,104 +0,0 @@ -Porting Oolite -============== - -Oolite is portable to any platform that supports SDL and GNUstep. It is -known to run on Linux, FreeBSD 5 and 6 and SGI IRIX. (The OS X version -is the 'canonical' version - Oolite appeared on Mac OS X first and was -later ported). It also runs under Windows. - -Oolite doesn't care about the endian-ness of the architecture - so far, -it is known to have run on PowerPC, Intel/amd x86, amd x86_64 (and -presumably Intel's emt64 when it's available) and 64-bit MIPS. - -Oolite uses the BSD strl* string functions. These aren't included in -GNU's libc, so make sure that src/BSDCompat files are included in your -build if you are using a libc that doesn't have the strl* functions. - -Making binary packages for your platform -======================================== -There is a tarball installer system. To generate a tarball installer -for your platform, run 'tools/mktarballs'. The result is deposited in -TarballPackages off the root of this repository. - -There should be a directory 'deps/OPSYS-CPU-deps', where OPSYS is -the OS reported by 'uname' with no flags, and CPU is the result of -'uname -p' (for i686 etc. this is converted to x86). If you are making -a new dependency bundle for your platform, deps/OPSYS-CPU-deps should -contain the following: - -In the root: - -install A shell script that installs Oolite on the user's computer. -oolite.src A shell script fragment that is used to make the shell - script 'oolite' that runs the game. -oolite-update.src A shell script fragment that can rsync updates. -OoliteReadMe.pdf Brief players guide. -OoliteRS.pdf Players Reference Sheet. -README.TXT Readme for your platform. - -Subdirectories: -oolite-deps - GNUstep A minimalist set of GNUstep run time files - lib Shared libraries that support the game - -If your platform does not yet have this dependencies directory, you can -model yours on the Linux-deps directory. Most things will be the -same. - -Issues you may encounter when building Oolite on a new platform -=============================================================== - -Symptom: -Altitude bar drawn right across the screen, time under the scanner -showing stupid value (it should be something like NNNNNNN:NN:NN:NN), -probably no rotating Cobra showing on startup (and no view out of the -window when you launch your ship) - -Cause: -Bad maths. -floor(), part of the standard C math library, is returning funny values -or your int type is not at least 32 bits wide. -Make sure #include is done in all applicable files; for Linux -this was put in oolite-linux.h which is included by every file. - -Check that floor() returns a sensible value by writing a short program that -does: - -int result; -double thing=180058016009.741669; -result=floor(thing / 86400.0); -printf("Result is %d and thing is %f\n", result, thing); - -Result should equal 2084004. Try it including math.h and not including -math.h and note any differences. If it gives the right result with math.h -but the wrong result without, then you've not included math.h - -In the case that your int type is only 16 bits, this will probably work: -#define int long - -and put it in your equivalent of oolite-linux.h. - -Additional info: see the manpage for floor(). - -TODO: Include an assertion on startup that causes the game to exit -immediately with an error message describing the problem if floor() -doesn't return the correct value. I'll only bother if this problem -keeps cropping up. An error message that can be reported is much -better than a vague description of these symptoms by some guy who -just wants to play the game. --------------------------------------------------------------------------- - -Symptom: Floating point exceptions - -Cause: Some rhs of / and % expressions are turning out to be zero (I -assume this isn't the case on OS X). In some instances, the simple -fix of doing an if(rhs_of_expression)... before the div or mod -operation is appropriate. It's probably best to look for the root -cause of why the rhs is zero in the first place to check that it's not -harmless and you're not going to hide a new problem or hide the root -cause by doing this test. - -The location of the exception is easily found by doing 'make debug=yes' -and doing 'debugapp oolite.debug' and then looking at the line of code -it crashes in. - diff --git a/Doc/README_LINUX.TXT b/Doc/README_LINUX.TXT deleted file mode 100644 index 5f4806744..000000000 --- a/Doc/README_LINUX.TXT +++ /dev/null @@ -1,109 +0,0 @@ -Oolite-Linux -============ - -This repository contains the files required to build Oolite for Linux, -GNUstep and OpenGL. It should be easily portable to FreeBSD. - -0. Pre-requisites - -- Objective-C. On Fedora Core, 'up2date -i gcc-objc' installs. - -- SDL Development libraries. (Currently used only for sound). Most -distros have this pre-installed or as an easy-to-install package. -Also, SDL_Mixer and SDL_Image are required (they are standard SDL -libraries, but most Linux distros don't install them by default) - -- GNUstep Development libraries. I advise you build GNUstep from source -since some prepackaged versions don't have a new enough NSOpenGLView. -It builds easily from source so don't panic. - -Tip: Get the GNUstep Startup Version. Everything you need in one -package. Make sure you do: - -PATH=$PATH:. - -before running make when you build GNUstep Startup, because it depends -on running a shell script in the current directory. - -Hardware OpenGL support is a must. Oolite linux was tested on the -following machines - a 2GHz P4 with a GeForce 4ti and an old Compaq -733MHz P3 with ATi Radeon Mobility. It ran fine on both machines. -I have heard reports of bad things happening with ATi graphics -cards, but only off one person (textures didn't display), and another -person with a Matrox graphics card had problems with the text. - -Building -======== -Type: -make - -If this fails and you're certain you have GNUstep's development -stuff installed, make sure you have this in your .bashrc or -equivalent: - -. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh - -GNUstep tells you this if you build it but you won't have been told -if you've installed your distro's GNUstep binaries :-) - -Running -======= -Type: -openapp oolite - -or -openapp oolite.debug -if you built with 'make debug=yes'. - -Troubleshooting -=============== -I suggest you go through some of the GNUstep tutorials and make sure these -build and run successfully to ensure your build and runtime environment -is sane. Also, there's a little (and rather nasty) environment tester -on ftp.alioth.net/oolite/gl-gnustep.tar.gz. If you're having problems -I recommend you get this running first; it's relatively simple and should -expose any problems your installation has without possible Oolite problems -clouding your view. - -Is it borked for you? -===================== -If you find it's borked, please post a message on the oolite-linux -forum (see http://aegidian.org/bb). Please provide a backtrace if you -have one, screenshots, and describe weirdness with sound. Also provide -log messages from the console. Better still, if you have a fix, send -us the patch! - -Modifications from OSX Oolite -============================= - -Makefiles: -GNUmakefile and GNUmakefile.postamble. -The former controls compilation and linking, and the latter copies -data files (PNG images, plists, dat files) into oolite.app/Contents/Resources. -PlayerEntity_Additions.m, PlayerEntity_contracts.m, ShipEntity_AI.m - - These just #include "PlayerEntity (contracts).m" etc. because - spaces and brackets really suck in the Makefile and shell. -#ifdefs - - All over the code you'll see #ifdef GNUSTEP ... #else .... #endif - If you grep for these, you can see where work has to be done. - I've usually put a TODO: comment line in these (many of them are not - filled in). I've not #ifdef'd out any methods - I've left at least - a stub if there's nothing to put in there . - -Addition of Comparison.m/h from ObjectiveLib -(see http://objectivelib.sourceforge.net). ObjectiveLib is an LGPL'd -set of libraries to add functionality to GNUstep. Comparison.h/m -implements a category of NSObject that adds isEqualTo:, isGreaterThan:, -isGreaterThanOrEqualTo:, isLessThan:, isLessThanOrEqualTo:, isNotEqualTo: -methods. It looked like a relatively simple category, so rather -than creating a dependency on the whole of ObjectiveLib, I decided -to just add these two files. - -Sound uses SDL instead of the AppKit's sound (the sound daemon crashes). -Graphics use SDL instead of NSOpenGLView. - - -Notes for the terminally insane -=============================== -See PORTING.TXT - it's useful to read this if you're tinkering on Linux -and not porting. It may save you grief. diff --git a/Doc/SpidermonkeyChanges.txt b/Doc/SpidermonkeyChanges.txt new file mode 100644 index 000000000..e04e7adca --- /dev/null +++ b/Doc/SpidermonkeyChanges.txt @@ -0,0 +1,9 @@ +Modifications to Spidermonkey for running Oolite +------------------------------------------------------------------- + +SpiderMonkey v1.85 (all platforms) - certain JS macro definitions required by Oolite not guaranteed or non-existent in standard library. + +- Specific build settings for Oolite are required. Library rebuilt with the following macros defined as shown below: + JS_THREADSAFE defined on Mac and Linux debug builds. + MOZ_TRACE_JSCALLS defined in order to enable full JavaScript profiling. +The entire source code of the library can be downloaded from ftp://anonymous@ftp.mozilla.org/pub/firefox/releases/4.0/source/firefox-4.0.source.tar.bz2 diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100755 index 924164683..000000000 --- a/GNUmakefile +++ /dev/null @@ -1,143 +0,0 @@ -include $(GNUSTEP_MAKEFILES)/common.make -include config.make - -vpath %.m src/SDL:src/Core:src/Core/Entities:src/Core/Materials:src/Core/Scripting:src/Core/OXPVerifier:src/Core/Debug -vpath %.h src/SDL:src/Core:src/Core/Entities:src/Core/Materials:src/Core/Scripting:src/Core/OXPVerifier:src/Core/Debug:src/Core/MiniZip -vpath %.c src/SDL:src/Core:src/Core/Debug:src/Core/MiniZip:src/SDL/EXRSnapshotSupport -vpath %.cpp src/SDL/EXRSnapshotSupport -GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_USER_ROOT) -ifeq ($(GNUSTEP_HOST_OS),mingw32) - GNUSTEP_OBJ_DIR_NAME := $(GNUSTEP_OBJ_DIR_NAME).win -endif -GNUSTEP_OBJ_DIR_BASENAME := $(GNUSTEP_OBJ_DIR_NAME) - -COMPILER_TYPE := $(shell $(CC) -dM -E - < /dev/null | grep -q "__clang__" && echo "clang" || echo "gcc") -ifeq ($(COMPILER_TYPE),gcc) - $(info Detected: GCC build) -else - $(info Detected: Clang build) -endif - -ifeq ($(GNUSTEP_HOST_OS),mingw32) - vpath %.rc src/SDL/OOResourcesWin - - WIN_DEPS_DIR = deps/Windows-deps/x86_64 - JS_INC_DIR = $(WIN_DEPS_DIR)/JS32ECMAv5/include - JS_LIB_DIR = $(WIN_DEPS_DIR)/JS32ECMAv5/lib - ifeq ($(debug),yes) - JS_IMPORT_LIBRARY = js32ECMAv5dbg.dll # to use jsdbg, gcc builds need ADDITIONAL_CFLAGS, ADDITIONAL_OBJCFLAGS: -DSTATIC_JS_API - else - JS_IMPORT_LIBRARY = js - endif - - SPEECH_LIBRARY_NAME = espeak-ng - OPENAL_LIBRARY_NAME = openal - LIBPNG_LIBRARY_NAME = png - - ADDITIONAL_INCLUDE_DIRS += -Isrc/SDL -Isrc/Core -Isrc/Core/Scripting -Isrc/Core/Materials -Isrc/Core/Entities -Isrc/Core/OXPVerifier -Isrc/Core/Debug -Isrc/Core/Tables -Isrc/Core/MiniZip -Isrc/SDL/EXRSnapshotSupport - ADDITIONAL_OBJC_LIBS += -lglu32 -lopengl32 -l$(OPENAL_LIBRARY_NAME).dll -l$(LIBPNG_LIBRARY_NAME).dll -lSDL3 -lvorbisfile.dll -lvorbis.dll -lz -lgnustep-base -l$(JS_IMPORT_LIBRARY) -lnspr4 -ldwmapi -lwinmm -mwindows - ADDITIONAL_CFLAGS += -DWIN32 -DWINVER=0x0A00 - ADDITIONAL_OBJCFLAGS += -DWIN32 -DXP_WIN -DWINVER=0x0A00 -# oolite_LIB_DIRS += -L$(GNUSTEP_LOCAL_ROOT)/lib -L$(WIN_DEPS_DIR)/lib -L$(JS_LIB_DIR) - - ifeq ($(ESPEAK),yes) - ADDITIONAL_OBJC_LIBS += -l$(SPEECH_LIBRARY_NAME).dll - ADDITIONAL_OBJCFLAGS +=-DHAVE_LIBESPEAK=1 - GNUSTEP_OBJ_DIR_NAME := $(GNUSTEP_OBJ_DIR_NAME).spk - endif - -# Clang can generate .pdb files compatible with native Windows debug tools - ifeq ($(COMPILER_TYPE),clang) - ifeq ($(pdb),yes) - ADDITIONAL_CFLAGS += -g -gcodeview - ADDITIONAL_OBJCFLAGS += -g -gcodeview - ADDITIONAL_CCFLAGS += -g -gcodeview - ADDITIONAL_LDFLAGS += -Wl,-pdb= - endif - else - ADDITIONAL_OBJCFLAGS += -std=gnu99 - endif - -else - - ifeq ($(debug),yes) - LIBJS = jsdbg_static - else - LIBJS = js_static - endif - - # 2. Define the search roots (highest priority first) - SEARCH_ROOTS = \ - build/mozilla_js \ - $(HOME)/.local \ - /usr/local \ - /app - - # 3. Find the first path that contains the SPECIFIC library we need (js_static vs jsdbg_static) - # We check both 'lib' and 'lib64' inside each root to handle Fedora vs Kubuntu/Arch - FOUND_LIB_DIR := $(firstword $(foreach root,$(SEARCH_ROOTS), \ - $(if $(wildcard $(root)/lib/lib$(LIBJS).a),$(root)/lib,) \ - $(if $(wildcard $(root)/lib64/lib$(LIBJS).a),$(root)/lib64,) \ - )) - - # 4. If a valid library directory is found, sync the include folder - ifneq ($(FOUND_LIB_DIR),) - # abspath cleans up the path (e.g., build/mozilla_js/lib/../include becomes build/mozilla_js/include) - FOUND_INC_DIR := $(abspath $(FOUND_LIB_DIR)/../include) - - ADDITIONAL_INCLUDE_DIRS += -I$(FOUND_INC_DIR) - ADDITIONAL_OBJC_LIBS += -L$(FOUND_LIB_DIR) - endif - - ADDITIONAL_CFLAGS += -ggdb3 - ADDITIONAL_OBJCFLAGS += -ggdb3 - ADDITIONAL_LDFLAGS += -ggdb3 - - ADDITIONAL_INCLUDE_DIRS += -Isrc/SDL -Isrc/Core -Isrc/Core/Scripting -Isrc/Core/Materials -Isrc/Core/Entities -Isrc/Core/OXPVerifier -Isrc/Core/Debug -Isrc/Core/Tables -Isrc/Core/MiniZip - ADDITIONAL_OBJC_LIBS += -lGLU -lGL -lX11 -lgnustep-base -lopenal -lz -lvorbisfile -lpng -lnspr4 -lSDL3 -l$(LIBJS) - ADDITIONAL_OBJCFLAGS += -DLINUX -DXP_UNIX - ADDITIONAL_LDFLAGS += -Wl,-rpath,'$$ORIGIN' - - ifeq ($(ESPEAK),yes) - ADDITIONAL_OBJC_LIBS += -lespeak-ng - ADDITIONAL_OBJCFLAGS += -DHAVE_LIBESPEAK=1 - GNUSTEP_OBJ_DIR_NAME := $(GNUSTEP_OBJ_DIR_NAME).spk - endif - - ifeq ($(OO_JAVASCRIPT_TRACE),yes) - ADDITIONAL_OBJCFLAGS += -DMOZ_TRACE_JSCALLS=1 - endif - - ifeq ($(COMPILER_TYPE),gcc) - ADDITIONAL_OBJCFLAGS += -std=gnu99 - ADDITIONAL_LDFLAGS += -fuse-ld=bfd - else - ADDITIONAL_LDFLAGS += -fuse-ld=lld - endif -endif - -VER_FULL := $(shell ./ShellScripts/common/get_version.sh) -ADDITIONAL_CFLAGS += -DOO_VERSION_FULL=\"$(VER_FULL)\" -ADDITIONAL_OBJCFLAGS += -DOO_VERSION_FULL=\"$(VER_FULL)\" -# link time optimizations -ifeq ($(lto),yes) - ifeq ($(COMPILER_TYPE),clang) - ADDITIONAL_CFLAGS += -flto=thin - ADDITIONAL_OBJCFLAGS += -flto=thin - ADDITIONAL_LDFLAGS += -flto=thin -Wl,--thinlto-cache-dir=build/thinlto_cache - else - ADDITIONAL_CFLAGS += -flto=auto - ADDITIONAL_OBJCFLAGS += -flto=auto - ADDITIONAL_LDFLAGS += -flto=auto - endif -endif - -OBJC_PROGRAM_NAME = oolite - -include flags.make -include files.make - - -include $(GNUSTEP_MAKEFILES)/objc.make -include GNUmakefile.postamble - diff --git a/GNUmakefile.postamble b/GNUmakefile.postamble deleted file mode 100644 index 8a6f54fd8..000000000 --- a/GNUmakefile.postamble +++ /dev/null @@ -1,23 +0,0 @@ -# GNUmakefile.postamble: Runs after-compilation scripts. -# These copy all the base data files to where Oolite expects them -# - -POST_BUILD_ENV = \ - OBJC_PROGRAM_NAME="$(OBJC_PROGRAM_NAME)" \ - GNUSTEP_OBJ_DIR_NAME="$(GNUSTEP_OBJ_DIR_NAME)" \ - GNUSTEP_HOST_OS="$(GNUSTEP_HOST_OS)" \ - GNUSTEP_HOST_CPU="$(GNUSTEP_HOST_CPU)" \ - MINGW_PREFIX="$(MINGW_PREFIX)" \ - DEBUG="$(debug)" \ - DEPLOYMENT_RELEASE_CONFIGURATION="$(DEPLOYMENT_RELEASE_CONFIGURATION)" \ - ESPEAK="$(ESPEAK)" \ - USE_DEPS="$(use_deps)" \ - STRIP_BIN="$(strip)" \ - VER_FULL="$(VER_FULL)" - -after-all:: - @$(POST_BUILD_ENV) ShellScripts/common/post_build.sh - -after-clean:: - $(RM) -rf $(GNUSTEP_OBJ_DIR_BASENAME) $(addprefix $(GNUSTEP_OBJ_DIR_BASENAME), .spk .dbg .spk.dbg) - $(RM) -rf build/thinlto_cache diff --git a/Makefile b/Makefile index e5c02f74f..54c74d32b 100755 --- a/Makefile +++ b/Makefile @@ -1,93 +1,97 @@ -include config.make +# Use bash as the explicit shell and enable strict error handling for safety +SHELL := /bin/bash +.SHELLFLAGS := -eu -o pipefail -c +NATIVE_FILE ?= clang.ini + +# Modern, self-documenting help target. +# It parses the '##' comments next to targets automatically. .PHONY: help -help: - @echo "This is a helper-Makefile to make compiling Oolite easier." - @echo "Below you will find a list of available build targets." - @echo "Syntax: make -f Makefile [build target]" - @echo "Usage example: make -f Makefile release" - @echo - @echo "Development Targets:" - @echo " release - builds a test release executable in oolite.app/oolite" - @echo " release-deployment - builds a release executable in oolite.app/oolite" - @echo " release-snapshot - builds a snapshot release in oolite.app/oolite" - @echo " debug - builds a debug executable in oolite.app/oolite.dbg" - @echo " all - builds the above targets" - @echo " clean - removes all generated files" - @echo - @echo "Packaging Targets:" - @echo - @echo " Linux AppImage:" - @echo " pkg-appimage - builds a test-release appimage" - @echo " pkg-appimage-deployment - builds a release appimage" - @echo " pkg-appimage-snapshot - builds a snapshot appimage" - @echo - @echo " Windows NSIS Installer:" - @echo " pkg-win - builds a test-release version" - @echo " pkg-win-deployment - builds a release version" - @echo " pkg-win-snapshot - builds a snapshot version" - - -# Here are our default targets -# +help: ## Show this help message + @echo "Usage: make [target]" + @echo "" + @echo "Targets:" + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-25s\033[0m %s\n", $$1, $$2}' + +# Macro for Meson workflow +define meson_build + meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) --reconfigure 2>/dev/null || meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) + meson compile -C build/meson_$(2) + meson install -C build/meson_$(2) +endef + +# Helper macro for syncing OXP files cleanly +define sync_debug_oxp + mkdir -p build/meson_$(1)/oolite.app/AddOns + rm -rf build/meson_$(1)/oolite.app/AddOns/Basic-debug.oxp + cp -rf DebugOXP/Debug.oxp build/meson_$(1)/oolite.app/AddOns/Basic-debug.oxp +endef + +## +## Development Targets +## + .PHONY: release -release: - $(MAKE) -f GNUmakefile debug=no strip=yes lto=yes - mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp +release: ## Build a test release executable + $(call meson_build,-Ddebug=false -Dstrip_bin=true -Db_lto=true,release) + $(call sync_debug_oxp,release) .PHONY: release-deployment -release-deployment: - $(MAKE) -f GNUmakefile DEPLOYMENT_RELEASE_CONFIGURATION=yes debug=no strip=yes lto=yes +release-deployment: ## Build a release deployment executable + $(call meson_build,-Ddeployment_release_configuration=true -Ddebug=false -Dstrip_bin=true -Db_lto=true,deployment) .PHONY: release-snapshot -release-snapshot: - $(MAKE) -f GNUmakefile SNAPSHOT_BUILD=yes debug=no - mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp +release-snapshot: ## Build a snapshot release executable + $(call meson_build,-Dsnapshot_build=true -Ddebug=false -Dstrip_bin=false,snapshot) + $(call sync_debug_oxp,snapshot) .PHONY: debug -debug: - $(MAKE) -f GNUmakefile debug=yes strip=no - mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp +debug: ## Build a debug executable + $(call meson_build,-Ddebug=true -Dstrip_bin=false,debug) + $(call sync_debug_oxp,debug) .PHONY: test -test: release-snapshot +test: release-snapshot ## Run test suite tests/run_test.sh .PHONY: clean -clean: - $(MAKE) -f GNUmakefile clean - $(RM) -rf oolite.app +clean: ## Remove all generated build artifacts + $(RM) -rf build/meson_* .PHONY: all -all: release release-deployment release-snapshot debug +all: release release-deployment release-snapshot debug ## Build all standard development targets .PHONY: remake remake: clean all -# Here are our AppImage targets -# +## +## Packaging Targets +## + +.PHONY: pkg-flatpak +pkg-flatpak: ## Package a Flatpak application + ./installers/flatpak/create_flatpak.sh + .PHONY: pkg-appimage -pkg-appimage: release - installers/appimage/create_appimage.sh "test" +pkg-appimage: release ## Package a test release AppImage + installers/appimage/create_appimage.sh meson_release/oolite.app "test" .PHONY: pkg-appimage-deployment -pkg-appimage-deployment: release-deployment - installers/appimage/create_appimage.sh +pkg-appimage-deployment: release-deployment ## Package a deployment AppImage + installers/appimage/create_appimage.sh meson_deployment/oolite.app .PHONY: pkg-appimage-snapshot -pkg-appimage-snapshot: release-snapshot - installers/appimage/create_appimage.sh "dev" +pkg-appimage-snapshot: release-snapshot ## Package a snapshot AppImage + installers/appimage/create_appimage.sh meson_snapshot/oolite.app "dev" -# And here are our NSIS targets -# .PHONY: pkg-win -pkg-win: release - installers/win32/create_nsis.sh "test" +pkg-win: release ## Package a Windows NSIS test release installer + installers/win32/create_nsis.sh meson_release/oolite.app "test" .PHONY: pkg-win-deployment -pkg-win-deployment: release-deployment - installers/win32/create_nsis.sh +pkg-win-deployment: release-deployment ## Package a Windows NSIS deployment installer + installers/win32/create_nsis.sh meson_deployment/oolite.app .PHONY: pkg-win-snapshot -pkg-win-snapshot: release-snapshot - installers/win32/create_nsis.sh "dev" +pkg-win-snapshot: release-snapshot ## Package a Windows NSIS snapshot installer + installers/win32/create_nsis.sh meson_snapshot/oolite.app "dev" \ No newline at end of file diff --git a/README.md b/README.md index 7b98760f9..44a3ba468 100644 --- a/README.md +++ b/README.md @@ -133,28 +133,26 @@ The completed build (executable and games files) can be found in the oolite.app Subsequently, you can clean and build as follows: ```bash -make -f Makefile clean -make -f Makefile release -j$(nproc) +make clean +make release ``` You can run a test from your Bash or MSYS2 prompt as follows: ```bash -make -f Makefile test +make test ``` -On Linux, you will need to run this beforehand: `source /usr/local/share/GNUstep/Makefiles/GNUstep.sh` +Other targets are release-deployment for a production release and release-snapshot for a debug release. -On Windows, this is set up be default in the shell: `source $MINGW_PREFIX/share/GNUstep/Makefiles/GNUstep.sh` -Other targets are release-deployment for a production release and release-snapshot for a debug release. ### Other Linux Make Targets This target builds an AppImage for testing which can be found in build: ```bash -make -f Makefile pkg-appimage -j$(nproc) +make pkg-appimage ``` The target pkg-appimage-deployment is the production release, while pkg-appimage-snapshot is for debugging. @@ -162,7 +160,16 @@ The target pkg-appimage-deployment is the production release, while pkg-appimage This target builds a Flatpak which can be found in build: ```bash -make -f Makefile pkg-flatpak -j$(nproc) +make pkg-flatpak +``` + +Although there is a top level Makefile, the underlying build system is Meson. You can run the deployment +build directly using Meson build commands like this: + +```bash +meson setup build/meson_deployment -Ddeployment_release_configuration=true -Ddebug=false -Dstrip_bin=true -Db_lto=true --native-file clang.ini --reconfigure +meson compile -C build/meson_deployment +meson install -C build/meson_deployment ``` ### Mac OS @@ -178,14 +185,6 @@ provides a similar API to what is available on Mac. Objective-C is supported by CLion and Visual Studio Code. The language can be easily picked up by programmers familiar with C or C++ with which it is interoperable. -### Troubleshooting - -- If you get compiler errors, you can try compiling with: - -```bash -make -f Makefile release OBJCFLAGS="-fobjc-exceptions -Wno-format-security" -j$(nproc) -``` - ## Contents of repository Oolite for all platforms can be built from this repository. Here is a quick @@ -199,7 +198,6 @@ guide to the source tree. - **Resources**: Game assets and resource files for Mac and GNUstep application bundles - **Schemata**: Plist schema files for the [OXP Verifier](http://wiki.alioth.net/index.php/OXP_howto#OXP_Verifier) - **src**: Objective-C and C sources, incuding header files - - **BSDCompat**: Support for BSDisms that gnu libc doesn't have (strl*) - **Cocoa**: Files that are only compiled on Mac OS X - **Core**: Files that are compiled on all platforms - **SDL**: Files that are only compiled for platforms that use SDL diff --git a/ShellScripts/Linux/install_freedesktop_fn.sh b/ShellScripts/Linux/install_freedesktop_fn.sh index 8fe1c3af8..a7d4f1b8f 100644 --- a/ShellScripts/Linux/install_freedesktop_fn.sh +++ b/ShellScripts/Linux/install_freedesktop_fn.sh @@ -12,9 +12,10 @@ printenv | sort install_freedesktop() { # Install metainfo (eg. for FlatHub and AppImageHub) - # $1: app folder (destination) - # $2: debug symbol folder - # $3: appdata or metainfo + # $1: oolite.app directory path (source) + # $2: app folder (destination) + # $3: debug symbol folder + # $4: appdata or metainfo local err_msg="❌ Error: Failed to" @@ -23,33 +24,32 @@ install_freedesktop() { source ../common/get_version.sh - echo "Installing metainfo to to $1" + echo "Installing metainfo to to $2" - local PROGDIR="../../oolite.app" - local APPBIN="$1/bin" - local APPSHR="$1/share" + local APPBIN="$2/bin" + local APPSHR="$2/share" # Install binaries and scripts - install -D "$PROGDIR/oolite" "$APPBIN/oolite" || { echo "$err_msg install oolite binary" >&2; return 1; } - if [[ -f "$PROGDIR/oolite.debug" ]]; then - install -D "$PROGDIR/oolite.debug" "$1/$2/oolite.debug" || { echo "$err_msg install oolite debug symbols" >&2; return 1; } + install -D "$1/oolite" "$APPBIN/oolite" || { echo "$err_msg install oolite binary" >&2; return 1; } + if [[ -f "$1/oolite.debug" ]]; then + install -D "$1/oolite.debug" "$2/$3/oolite.debug" || { echo "$err_msg install oolite debug symbols" >&2; return 1; } fi - install -D "$PROGDIR/run_oolite.sh" "$APPBIN/run_oolite.sh" || { echo "$err_msg install run_oolite.sh" >&2; return 1; } + install -D "$1/run_oolite.sh" "$APPBIN/run_oolite.sh" || { echo "$err_msg install run_oolite.sh" >&2; return 1; } # Resources copy mkdir -p "$APPBIN/Resources" - cp -rf "$PROGDIR/Resources/." "$APPBIN/Resources/" || { echo "$err_msg copy Resources folder" >&2; return 1; } + cp -rf "$1/Resources/." "$APPBIN/Resources/" || { echo "$err_msg copy Resources folder" >&2; return 1; } # AddOns copy if folder exists in oolite.app - if [ -d "$PROGDIR/AddOns" ]; then + if [ -d "$1/AddOns" ]; then mkdir -p "$APPBIN/AddOns" - cp -rf "$PROGDIR/AddOns/." "$APPBIN/AddOns/" || { echo "$err_msg copy AddOns folder" >&2; return 1; } + cp -rf "$1/AddOns/." "$APPBIN/AddOns/" || { echo "$err_msg copy AddOns folder" >&2; return 1; } fi rm -f "$APPBIN/Resources/GNUstep.conf.orig" install -D "GNUstep.conf.template" "$APPBIN/Resources/GNUstep.conf.template" || { echo "$err_msg GNUstep template" >&2; return 1; } - APP_METAINFO="$APPSHR/metainfo/space.oolite.Oolite.$3.xml" + APP_METAINFO="$APPSHR/metainfo/space.oolite.Oolite.$4.xml" install -D ../../installers/FreeDesktop/space.oolite.Oolite.metainfo.xml.template "$APP_METAINFO" || { echo "$err_msg metainfo template" >&2; return 1; } sed -i "s/@VER@/${VERSION}/g" "$APP_METAINFO" @@ -63,7 +63,7 @@ install_freedesktop() { # Desktop and Icon install -D ../../installers/FreeDesktop/space.oolite.Oolite.desktop "$APPSHR/applications/space.oolite.Oolite.desktop" || { echo "$err_msg desktop file" >&2; return 1; } - install -D "$PROGDIR/Resources/Textures/oolite-logo1.png" "$APPSHR/icons/hicolor/256x256/apps/space.oolite.Oolite.png" || { echo "$err_msg icon file" >&2; return 1; } + install -D "$1/Resources/Textures/oolite-logo1.png" "$APPSHR/icons/hicolor/256x256/apps/space.oolite.Oolite.png" || { echo "$err_msg icon file" >&2; return 1; } popd -} +} \ No newline at end of file diff --git a/ShellScripts/Linux/install_package_fn.sh b/ShellScripts/Linux/install_package_fn.sh index fb2830131..1bbf3be44 100644 --- a/ShellScripts/Linux/install_package_fn.sh +++ b/ShellScripts/Linux/install_package_fn.sh @@ -23,6 +23,13 @@ install_package() { "cmake") PKG_NAME="cmake" ;; + "meson") + case "$CURRENT_DISTRO" in + debian) PKG_NAME="meson ninja-build" ;; + redhat) PKG_NAME="meson ninja-build" ;; + arch) PKG_NAME="meson ninja" ;; + esac ;; + "gnutls-dev") case "$CURRENT_DISTRO" in debian) PKG_NAME="libgnutls28-dev" ;; diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index 02fea097b..7f7230574 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -25,6 +25,9 @@ run_script() { if ! install_package cmake; then return 1 fi + if ! install_package meson; then + return 1 + fi if ! install_package gnutls-dev; then return 1 fi diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index 5fed83a83..cf5226b83 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -59,6 +59,8 @@ run_script() { pacboy -S pcaudiolib --noconfirm pacboy -S espeak-ng --noconfirm pacman -S make --noconfirm + pacboy -S meson --noconfirm + pacboy -S ninja --noconfirm pacboy -S nsis --noconfirm if [[ -z "$1" || "$1" == "clang" ]]; then diff --git a/ShellScripts/common/build_oolite.sh b/ShellScripts/common/build_oolite.sh index b67687e44..eedece906 100755 --- a/ShellScripts/common/build_oolite.sh +++ b/ShellScripts/common/build_oolite.sh @@ -7,9 +7,6 @@ run_script() { local SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$SCRIPT_DIR" - export CC=clang - export CXX=clang++ - cd ../.. if [[ -z "$1" ]]; then @@ -18,30 +15,8 @@ run_script() { TARGET=$1 fi - local SHARE - if [[ -z "$MINGW_PREFIX" ]]; then - SHARE="build/gnustep/share" - if [[ ! -d "$SHARE" ]]; then - SHARE="$HOME/.local/share" - if [[ ! -d "$SHARE" ]]; then - SHARE="/usr/local/share" - fi - fi - else - SHARE="${MINGW_PREFIX}/share" - fi - - local GNUSTEP_SH="$SHARE/GNUstep/Makefiles/GNUstep.sh" - - if [[ -f "$GNUSTEP_SH" ]]; then - source "$GNUSTEP_SH" - else - echo "❌ Could not find GNUstep.sh in $SHARE!" - return 1 - fi - - make -f Makefile clean - if ! make -f Makefile $TARGET -j$(nproc); then + make clean + if ! make $TARGET; then echo "❌ Oolite build failed!" >&2 return 1 fi diff --git a/ShellScripts/common/mkmanifest.sh b/ShellScripts/common/mkmanifest.sh index 1d380a8b6..f40d22970 100755 --- a/ShellScripts/common/mkmanifest.sh +++ b/ShellScripts/common/mkmanifest.sh @@ -15,18 +15,20 @@ fi . $OOLITE_VERSION_FILE echo "{" -echo " title = \"Oolite core\";" -echo " identifier = \"org.oolite.oolite\";" -echo " " -echo " version = \"$VER_FULL\";" +echo " title = \"Oolite core\";" +echo " identifier = \"org.oolite.oolite\";" +echo " " +echo " version = \"$VER_FULL\";" +echo " git_remote_url = \"$(git config --get remote.origin.url)\";" +echo " git_commit_hash = \"$(git rev-parse HEAD)\";" if [ "$DEPLOYMENT_RELEASE_CONFIGURATION" = "yes" ]; then - echo " debug_functionality_support = no;" + echo " debug_functionality_support = no;" else - echo " debug_functionality_support = yes;" + echo " debug_functionality_support = yes;" fi -echo " required_oolite_version = \"$OOLITE_VERSION\";" -echo " " -echo " license = \"GPL 2+ / CC-BY-NC-SA 3.0 - see LICENSE.md for details\";" -echo " author = \"Giles Williams, Jens Ayton and contributors\";" -echo " information_url = \"https://oolite.space/\";" +echo " required_oolite_version = \"$OOLITE_VERSION\";" +echo " " +echo " license = \"GPL 2+ / CC-BY-NC-SA 3.0 - see LICENSE.md for details\";" +echo " author = \"Giles Williams, Jens Ayton and contributors\";" +echo " information_url = \"https://oolite.space/\";" echo "}" diff --git a/ShellScripts/common/post_build.sh b/ShellScripts/common/post_build.sh index 65a567033..3c9643318 100755 --- a/ShellScripts/common/post_build.sh +++ b/ShellScripts/common/post_build.sh @@ -2,38 +2,22 @@ # Processes Oolite data files after compilation run_script() { - # All variables declared local to avoid global scope pollution local SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$SCRIPT_DIR" > /dev/null cd ../.. - local EXT="" - local OS_EXT="" - if [[ "$GNUSTEP_HOST_OS" == "mingw32" ]]; then - # Windows only executable extension - OS_EXT=".exe" - # Debug extension if needed - if [[ "$DEBUG" == "yes" ]]; then - EXT=".dbg" - fi - fi - - # Paths and binary names - local PROGDIR="${OBJC_PROGRAM_NAME}.app" - local SRC_BIN="${OBJC_PROGRAM_NAME}${OS_EXT}" - local DEST_BIN="${OBJC_PROGRAM_NAME}${EXT}${OS_EXT}" - + set -x + PROGDIR="$(dirname "$PROGPATH")" mkdir -p "$PROGDIR/Resources" ShellScripts/common/mkmanifest.sh > "$PROGDIR/Resources/manifest.plist" cp -fu src/Cocoa/Info-Oolite.plist "$PROGDIR/Resources/Info-gnustep.plist" - cp -fu "$GNUSTEP_OBJ_DIR_NAME/$SRC_BIN" "$PROGDIR/$DEST_BIN" # Voice Data if [[ "$ESPEAK" == "yes" ]]; then - if [[ "$GNUSTEP_HOST_OS" == "mingw32" ]]; then + if [[ "$HOST_OS" == "windows" ]]; then # Windows espeak-ng-data cp -rfu "$MINGW_PREFIX/share/espeak-ng-data" "$PROGDIR/Resources" else @@ -70,37 +54,38 @@ run_script() { # Strip binary if requested if [[ "$STRIP_BIN" == "yes" ]]; then - if [[ "$GNUSTEP_HOST_OS" == "mingw32" ]]; then + if [[ "$HOST_OS" == "windows" ]]; then # Windows: Standard GNU strip is safest for PE/COFF - strip "$PROGDIR/$DEST_BIN" + strip "$PROGPATH" else # Linux - cp -f "$GNUSTEP_OBJ_DIR_NAME/$SRC_BIN" "$PROGDIR/$DEST_BIN" + DEBUGPATH="$PROGDIR/$(basename "$PROGPATH").debug" # Extract symbols to file - objcopy --only-keep-debug "$PROGDIR/$DEST_BIN" "$PROGDIR/$DEST_BIN.debug" + objcopy --only-keep-debug "$PROGPATH" "$DEBUGPATH" # Compress the debug sections in the symbol file - objcopy --compress-debug-sections=zlib-gnu "$PROGDIR/$DEST_BIN.debug" + objcopy --compress-debug-sections=zlib-gnu "$DEBUGPATH" # strip the binary - strip -R .comment "$PROGDIR/$DEST_BIN" + strip -R .comment "$PROGPATH" # Add the debug link - objcopy --add-gnu-debuglink="$PROGDIR/$DEST_BIN.debug" "$PROGDIR/$DEST_BIN" + objcopy --add-gnu-debuglink="$DEBUGPATH" "$PROGPATH" fi - elif [[ "$GNUSTEP_HOST_OS" == "linux-gnu" ]]; then + elif [[ "$HOST_OS" == "linux" ]]; then # Compress the debug sections in the binary - objcopy --compress-debug-sections=zlib-gnu "$PROGDIR/$DEST_BIN" + objcopy --compress-debug-sections=zlib-gnu "$PROGPATH" fi - if [[ "$GNUSTEP_HOST_OS" == "mingw32" ]]; then + if [[ "$HOST_OS" == "windows" ]]; then # Determine and copy DLL dependencies - ldd "$PROGDIR/$DEST_BIN" | grep "$MINGW_PREFIX" | awk '{print $3}' | xargs -I {} cp -rfu {} "$PROGDIR" + UNIX_PREFIX=$(cygpath -u "$MINGW_PREFIX") + ldd "$PROGPATH" | grep "$UNIX_PREFIX" | awk '{print $3}' | xargs -I {} cp -rfu {} "$PROGDIR" else # Copy Linux-specific wrapper script cp -fu ShellScripts/Linux/run_oolite.sh "$PROGDIR" - local GNUSTEP_CONF=$(gnustep-config --variable=GNUSTEP_CONFIG_FILE) + local GNUSTEP_CONF="$GNUSTEP_FOLDER/etc/GNUstep/GNUstep.conf" install -D "$GNUSTEP_CONF" "$PROGDIR/Resources/GNUstep.conf.orig" || { echo "$err_msg GNUstep config" >&2; return 1; } # If we're using GNUstep libraries that aren't in a system folder copy them - ldd "$PROGDIR/$DEST_BIN" | \ + ldd "$PROGPATH" | \ grep -E "libgnustep-base|libobjc\.so\." | \ grep -vE "^[[:space:]]*.*=>[[:space:]]*/(usr/(local/)?|lib(64)?/)" | \ awk '{print $3}' | \ diff --git a/clang.ini b/clang.ini new file mode 100644 index 000000000..d1a76cc11 --- /dev/null +++ b/clang.ini @@ -0,0 +1,7 @@ +[binaries] +c = 'clang' +cpp = 'clang++' +objc = 'clang' +c_ld = 'lld' +cpp_ld = 'lld' +objc_ld = 'lld' \ No newline at end of file diff --git a/config.make b/config.make deleted file mode 100644 index ec5d7e6fc..000000000 --- a/config.make +++ /dev/null @@ -1,23 +0,0 @@ -# -# This file contains makefile configuration options for Oolite builds -# -# This file is sourced by both GNUmakefile and Makefile -# -# Any options can be overridden on the command-line: -# $ make debug=yes DOCKING_CLEARANCE=no -# $ make -f Makefile LIBJS_OPT=yes -# - -VERBOSE = yes -CP = cp - -# Setting the build parameters independently. We need everything set as below for the full test release configuration. -NO_SHADERS = no -ESPEAK = yes -OO_CHECK_GL_HEAVY = no -OO_EXCLUDE_DEBUG_SUPPORT = no -OO_OXP_VERIFIER_ENABLED = yes -OO_LOCALIZATION_TOOLS = yes -DEBUG_GRAPHVIZ = yes -OO_JAVASCRIPT_TRACE = yes -OO_FOV_INFLIGHT_CONTROL_ENABLED = no diff --git a/files.make b/files.make deleted file mode 100644 index d061e9ba5..000000000 --- a/files.make +++ /dev/null @@ -1,292 +0,0 @@ -oolite_C_FILES = \ - legacy_random.c \ - OOTCPStreamDecoder.c \ - OOPlanetData.c \ - ioapi.c \ - unzip.c - -ifeq ($(GNUSTEP_HOST_OS),mingw32) - oolite_C_FILES += \ - miniz.c - - oolite_WINDRES_FILES = \ - OOResourcesWin.rc -endif - -oolite_CC_FILES = \ - OOSaveEXRSnapshot.cpp - -OOLITE_DEBUG_FILES = \ - OODebugMonitor.m \ - OODebugStandards.m \ - OODebugSupport.m \ - OODebugTCPConsoleClient.m \ - OOJSConsole.m \ - OOProfilingStopwatch.m \ - OOTCPStreamDecoderAbstractionLayer.m - -OOLITE_ENTITY_FILES = \ - DockEntity.m \ - DustEntity.m \ - Entity.m \ - OOEntityWithDrawable.m \ - OOParticleSystem.m \ - PlanetEntity.m \ - PlayerEntity.m \ - PlayerEntityContracts.m \ - PlayerEntityControls.m \ - PlayerEntityLegacyScriptEngine.m \ - PlayerEntityLoadSave.m \ - PlayerEntityScriptMethods.m \ - PlayerEntitySound.m \ - PlayerEntityStickMapper.m \ - PlayerEntityStickProfile.m \ - PlayerEntityKeyMapper.m \ - ProxyPlayerEntity.m \ - OOBreakPatternEntity.m \ - ShipEntity.m \ - ShipEntityAI.m \ - ShipEntityScriptMethods.m \ - SkyEntity.m \ - StationEntity.m \ - OOSunEntity.m \ - WormholeEntity.m \ - OOLightParticleEntity.m \ - OOFlasherEntity.m \ - OOExhaustPlumeEntity.m \ - OOSparkEntity.m \ - OOECMBlastEntity.m \ - OOPlanetEntity.m \ - OOPlasmaShotEntity.m \ - OOPlasmaBurstEntity.m \ - OOFlashEffectEntity.m \ - OOExplosionCloudEntity.m \ - ShipEntityLoadRestore.m \ - OOLaserShotEntity.m \ - OOQuiriumCascadeEntity.m \ - OORingEffectEntity.m \ - OOVisualEffectEntity.m \ - OOWaypointEntity.m - -OOLITE_GRAPHICS_DRAWABLE_FILES = \ - OODrawable.m \ - OOPlanetDrawable.m \ - OOMesh.m - -OOLITE_GRAPHICS_MATERIAL_FILES = \ - OOMaterialSpecifier.m \ - OOBasicMaterial.m \ - OODefaultShaderSynthesizer.m \ - OOMaterial.m \ - OONullTexture.m \ - OOPlanetTextureGenerator.m \ - OOStandaloneAtmosphereGenerator.m \ - OOPNGTextureLoader.m \ - OOShaderMaterial.m \ - OOShaderProgram.m \ - OOShaderUniform.m \ - OOShaderUniformMethodType.m \ - OOSingleTextureMaterial.m \ - OOTexture.m \ - OOConcreteTexture.m \ - OOTextureGenerator.m \ - OOTextureLoader.m \ - OOPixMap.m \ - OOTextureScaling.m \ - OOPixMapChannelOperations.m \ - OOMultiTextureMaterial.m \ - OOMaterialConvenienceCreators.m \ - OOCombinedEmissionMapGenerator.m \ - OOPixMapTextureLoader.m - -OOLITE_GRAPHICS_MISC_FILES = \ - OOCrosshairs.m \ - OODebugGLDrawing.m \ - OOGraphicsResetManager.m \ - OOOpenGL.m \ - OOOpenGLStateManager.m \ - OOOpenGLExtensionManager.m \ - OOOpenGLMatrixManager.m \ - OOProbabilisticTextureManager.m \ - OOSkyDrawable.m \ - OOTextureSprite.m \ - OOPolygonSprite.m \ - OOConvertCubeMapToLatLong.m - -OOLITE_MATHS_FILES = \ - CollisionRegion.m \ - OOMeshToOctreeConverter.m \ - Octree.m \ - OOHPVector.m \ - OOMatrix.m \ - OOQuaternion.m \ - OOVector.m \ - OOVoxel.m - -OOLITE_OXP_VERIFIER_FILES = \ - OOAIStateMachineVerifierStage.m \ - OOCheckDemoShipsPListVerifierStage.m \ - OOCheckEquipmentPListVerifierStage.m \ - OOCheckJSSyntaxVerifierStage.m \ - OOCheckPListSyntaxVerifierStage.m \ - OOCheckRequiresPListVerifierStage.m \ - OOCheckShipDataPListVerifierStage.m \ - OOFileScannerVerifierStage.m \ - OOModelVerifierStage.m \ - OOOXPVerifier.m \ - OOOXPVerifierStage.m \ - OOPListSchemaVerifier.m \ - OOTextureVerifierStage.m - -OOLITE_RSRC_MGMT_FILES = \ - OldSchoolPropertyListWriting.m \ - OOCache.m \ - OOCacheManager.m \ - OOConvertSystemDescriptions.m \ - OOOXZManager.m \ - OOPListParsing.m \ - OOSystemDescriptionManager.m \ - ResourceManager.m \ - TextureStore.m - -OOLITE_SCRIPTING_FILES = \ - EntityOOJavaScriptExtensions.m \ - OOJavaScriptEngine.m \ - OOJSEngineTimeManagement.m \ - OOJSEngineDebuggerHelpers.m \ - OOConstToJSString.m \ - OOJSCall.m \ - OOJSClock.m \ - OOJSDock.m \ - OOJSEntity.m \ - OOJSEquipmentInfo.m \ - OOJSExhaustPlume.m \ - OOJSFlasher.m \ - OOJSFunction.m \ - OOJSGlobal.m \ - OOJSInterfaceDefinition.m \ - OOJSGuiScreenKeyDefinition.m \ - OOJSManifest.m \ - OOJSMission.m \ - OOJSMissionVariables.m \ - OOJSOolite.m \ - OOJSPlanet.m \ - OOJSPlayer.m \ - OOJSPlayerShip.m \ - OOJSPopulatorDefinition.m \ - OOJSQuaternion.m \ - OOJSScript.m \ - OOJSShip.m \ - OOJSShipGroup.m \ - OOJSSound.m \ - OOJSSoundSource.m \ - OOJSSpecialFunctions.m \ - OOJSStation.m \ - OOJSSun.m \ - OOJSSystem.m \ - OOJSSystemInfo.m \ - OOJSTimer.m \ - OOJSVisualEffect.m \ - OOJSVector.m \ - OOJSWorldScripts.m \ - OOJSWormhole.m \ - OOJSWaypoint.m \ - OOLegacyScriptWhitelist.m \ - OOPListScript.m \ - OOScript.m \ - OOScriptTimer.m \ - OOJSFrameCallbacks.m \ - OOJSFont.m - -OOLITE_SOUND_FILES = \ - OOOpenALController.m \ - OOMusicController.m \ - OOSoundSource.m \ - OOSoundSourcePool.m \ - OOALMusic.m \ - OOALSound.m \ - OOALSoundChannel.m \ - OOALSoundMixer.m \ - OOALSoundDecoder.m \ - OOALBufferedSound.m \ - OOALStreamedSound.m - - -OOLITE_UI_FILES = \ - GuiDisplayGen.m \ - HeadUpDisplay.m \ - OOEncodingConverter.m - -OO_UTILITY_FILES = \ - Comparison.m \ - NSDataOOExtensions.m \ - NSDictionaryOOExtensions.m \ - NSFileManagerOOExtensions.m \ - NSMutableDictionaryOOExtensions.m \ - NSScannerOOExtensions.m \ - NSStringOOExtensions.m \ - NSThreadOOExtensions.m \ - NSNumberOOExtensions.m \ - OOAsyncQueue.m \ - OOAsyncWorkManager.m \ - OOCollectionExtractors.m \ - OOColor.m \ - OOConstToString.m \ - OOCPUInfo.m \ - OOEntityFilterPredicate.m \ - OOExcludeObjectEnumerator.m \ - OOFilteringEnumerator.m \ - OOIsNumberLiteral.m \ - OOLogging.m \ - OOLogHeader.m \ - OOLogOutputHandler.m \ - OOPriorityQueue.m \ - OOProbabilitySet.m \ - OOShipGroup.m \ - OOStringExpander.m \ - OOStringParsing.m \ - OOWeakReference.m \ - OOWeakSet.m \ - OOXMLExtensions.m \ - OODeepCopy.m \ - OORegExpMatcher.m \ - NSObjectOOExtensions.m - -OOLITE_MISC_FILES = \ - AI.m \ - AIGraphViz.m \ - GameController.m \ - GameController+SDLFullScreen.m \ - NSUserDefaults+Override.m \ - OOJoystickManager.m \ - OOJoystickProfile.m \ - OOSDLJoystickManager.m \ - main.m \ - MyOpenGLView.m \ - OOCharacter.m \ - OOCocoa.m \ - OOCommodities.m \ - OOCommodityMarket.m \ - OOEquipmentType.m \ - OOMouseInteractionMode.m \ - OORoleSet.m \ - OOShipLibraryDescriptions.m \ - OOShipRegistry.m \ - OOSpatialReference.m \ - OOTrumble.m \ - Universe.m - -oolite_OBJC_FILES = \ - $(OOLITE_DEBUG_FILES) \ - $(OOLITE_ENTITY_FILES) \ - $(OOLITE_GRAPHICS_DRAWABLE_FILES) \ - $(OOLITE_GRAPHICS_MATERIAL_FILES) \ - $(OOLITE_GRAPHICS_MISC_FILES) \ - $(OOLITE_MATHS_FILES) \ - $(OOLITE_OXP_VERIFIER_FILES) \ - $(OOLITE_RSRC_MGMT_FILES) \ - $(OOLITE_SCRIPTING_FILES) \ - $(OOLITE_SOUND_FILES) \ - $(OOLITE_UI_FILES) \ - $(OO_UTILITY_FILES) \ - $(OOLITE_MISC_FILES) diff --git a/flags.make b/flags.make deleted file mode 100644 index 348ea6544..000000000 --- a/flags.make +++ /dev/null @@ -1,72 +0,0 @@ -ifeq ($(profile),yes) - ADDITIONAL_CFLAGS += -pg - ADDITIONAL_OBJCFLAGS += -pg - ifeq ($(GNUSTEP_HOST_OS),mingw32) - ADDITIONAL_CFLAGS += -g - ADDITIONAL_OBJCFLAGS += -g - endif -endif -ifeq ($(debug),yes) - ADDITIONAL_CFLAGS += -O0 - ADDITIONAL_OBJCFLAGS += -O0 - ifeq ($(GNUSTEP_HOST_OS),mingw32) - ADDITIONAL_CFLAGS += -g - ADDITIONAL_OBJCFLAGS += -g - endif - GNUSTEP_OBJ_DIR_NAME := $(GNUSTEP_OBJ_DIR_NAME).dbg - ADDITIONAL_CFLAGS += -DDEBUG -DOO_DEBUG -DOO_CHECK_GL_HEAVY=1 - ADDITIONAL_OBJCFLAGS += -DDEBUG -DOO_DEBUG -DOO_CHECK_GL_HEAVY=1 -endif - -# these are common settings for both test and deployment release configurations -ifeq ($(NO_SHADERS),yes) - ADDITIONAL_CFLAGS += -DNO_SHADERS=1 - ADDITIONAL_OBJCFLAGS += -DNO_SHADERS=1 -endif - -# DEPLOYMENT_RELEASE_CONFIGURATION value is passed from Makefile. Note that the deployment release settings -# are forced, while test release settings are adjustable. -ifeq ($(DEPLOYMENT_RELEASE_CONFIGURATION),yes) - ADDITIONAL_CFLAGS += -DNDEBUG - ADDITIONAL_OBJCFLAGS += -DNDEBUG - ADDITIONAL_CFLAGS += -DOO_CHECK_GL_HEAVY=0 - ADDITIONAL_OBJCFLAGS += -DOO_CHECK_GL_HEAVY=0 - ADDITIONAL_CFLAGS += -DOO_OXP_VERIFIER_ENABLED=0 - ADDITIONAL_OBJCFLAGS += -DOO_OXP_VERIFIER_ENABLED=0 - ADDITIONAL_CFLAGS += -DOO_LOCALIZATION_TOOLS=0 - ADDITIONAL_OBJCFLAGS += -DOO_LOCALIZATION_TOOLS=0 - ADDITIONAL_CFLAGS += -DDEBUG_GRAPHVIZ=0 - ADDITIONAL_OBJCFLAGS += -DDEBUG_GRAPHVIZ=0 - ADDITIONAL_CFLAGS += -DOO_FOV_INFLIGHT_CONTROL_ENABLED=0 - ADDITIONAL_OBJCFLAGS += -DOO_FOV_INFLIGHT_CONTROL_ENABLED=0 -else - ifeq ($(OO_CHECK_GL_HEAVY),yes) - ADDITIONAL_CFLAGS += -DOO_CHECK_GL_HEAVY=1 - ADDITIONAL_OBJCFLAGS += -DOO_CHECK_GL_HEAVY=1 - endif - ifeq ($(OO_EXCLUDE_DEBUG_SUPPORT),yes) - ADDITIONAL_CFLAGS += -DNDEBUG - ADDITIONAL_OBJCFLAGS += -DNDEBUG - endif - ifeq ($(OO_OXP_VERIFIER_ENABLED),yes) - ADDITIONAL_CFLAGS += -DOO_OXP_VERIFIER_ENABLED=1 - ADDITIONAL_OBJCFLAGS += -DOO_OXP_VERIFIER_ENABLED=1 - endif - ifeq ($(OO_LOCALIZATION_TOOLS),yes) - ADDITIONAL_CFLAGS += -DOO_LOCALIZATION_TOOLS=1 - ADDITIONAL_OBJCFLAGS += -DOO_LOCALIZATION_TOOLS=1 - endif - ifeq ($(DEBUG_GRAPHVIZ),yes) - ADDITIONAL_CFLAGS += -DDEBUG_GRAPHVIZ=1 - ADDITIONAL_OBJCFLAGS += -DDEBUG_GRAPHVIZ=1 - endif - ifeq ($(OO_FOV_INFLIGHT_CONTROL_ENABLED),yes) - ADDITIONAL_CFLAGS += -DOO_FOV_INFLIGHT_CONTROL_ENABLED=1 - ADDITIONAL_OBJCFLAGS += -DOO_FOV_INFLIGHT_CONTROL_ENABLED=1 - endif -endif - -ifeq ($(SNAPSHOT_BUILD), yes) - ADDITIONAL_CFLAGS += -DSNAPSHOT_BUILD -DOOLITE_SNAPSHOT_VERSION=\"$(VERSION_STRING)\" - ADDITIONAL_OBJCFLAGS += -DSNAPSHOT_BUILD -DOOLITE_SNAPSHOT_VERSION=\"$(VERSION_STRING)\" -endif diff --git a/gcc.ini b/gcc.ini new file mode 100644 index 000000000..01203c2d8 --- /dev/null +++ b/gcc.ini @@ -0,0 +1,7 @@ +[binaries] +c = 'gcc' +cpp = 'g++' +objc = 'gcc' +c_ld = 'bfd' +cpp_ld = 'bfd' +objc_ld = 'bfd' \ No newline at end of file diff --git a/installers/appimage/create_appimage.sh b/installers/appimage/create_appimage.sh index e6305730e..99a2dd2a3 100755 --- a/installers/appimage/create_appimage.sh +++ b/installers/appimage/create_appimage.sh @@ -24,8 +24,9 @@ run_script() { local APPSHR="$APPDIR/share" rm -rf "$APPDIR" + local ABS_OOLITEDIR=$(realpath -m "$1") local ABS_APPDIR=$(realpath -m "$APPDIR") - if ! install_freedesktop "$ABS_APPDIR" bin appdata; then + if ! install_freedesktop "$ABS_OOLITEDIR" "$ABS_APPDIR" bin appdata; then return 1 fi @@ -43,8 +44,8 @@ run_script() { local DESKTOP="$APPSHR/applications/space.oolite.Oolite.desktop" export DESKTOP local SUFFIX - if (( $# == 1 )); then - SUFFIX="_${1}-${VER_FULL}" + if (( $# == 2 )); then + SUFFIX="_${2}-${VER_FULL}" else SUFFIX="-$VER_FULL" fi @@ -74,8 +75,8 @@ run_script() { if [[ ! -x "$LINTER_BIN" ]] || [[ ! -f "$EXCLUDE_LIST" ]]; then echo "📥 Downloading AppDir linter and excludelist..." - curl -o "$LINTER_BIN" -L https://raw.githubusercontent.com/AppImage/AppImages/master/appdir-lint.sh || { echo "❌ Linter download failed" >&2; exit 1; } - curl -o "$EXCLUDE_LIST" -L https://raw.githubusercontent.com/AppImage/AppImages/master/excludelist || { echo "❌ Excludelist download failed" >&2; exit 1; } + curl -o "$LINTER_BIN" -L https://raw.githubusercontent.com/AppImage/AppImages/master/appdir-lint.sh || { echo "❌ Linter download failed" >&2; return 1; } + curl -o "$EXCLUDE_LIST" -L https://raw.githubusercontent.com/AppImage/AppImages/master/excludelist || { echo "❌ Excludelist download failed" >&2; return 1; } chmod +x "$LINTER_BIN" fi @@ -88,7 +89,7 @@ run_script() { APPIMAGETOOL_BIN="./appimagetool" if [ ! -x "$APPIMAGETOOL_BIN" ]; then echo "📥 appimagetool not found. Downloading..." - curl -o "$APPIMAGETOOL_BIN" -L https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage || { echo "❌ appimagetool download failed" >&2; exit 1; } + curl -o "$APPIMAGETOOL_BIN" -L https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage || { echo "❌ appimagetool download failed" >&2; return 1; } chmod +x "$APPIMAGETOOL_BIN" fi diff --git a/installers/flatpak/flatpak_build.sh b/installers/flatpak/flatpak_build.sh index d22b38f73..701be2252 100755 --- a/installers/flatpak/flatpak_build.sh +++ b/installers/flatpak/flatpak_build.sh @@ -12,9 +12,10 @@ source ShellScripts/Linux/install_freedesktop_fn.sh export ADDITIONAL_CFLAGS="-DBUILD_DATE='\"$CPP_DATE\"'" export ADDITIONAL_OBJCFLAGS="-DBUILD_DATE='\"$CPP_DATE\"'" -make -f Makefile release-deployment -j$FLATPAK_BUILDER_N_JOBS +make release-deployment -j$FLATPAK_BUILDER_N_JOBS -install_freedesktop /app lib/debug/bin metainfo +ABS_OOLITEDIR=$(realpath -m "build/meson_deployment/oolite.app") +install_freedesktop $ABS_OOLITEDIR /app lib/debug/bin metainfo # Ensure the destination directory exists mkdir -p /app/lib/debug/source/oolite # Copy the src directory recursively diff --git a/installers/win32/OOlite.nsi b/installers/win32/OOlite.nsi index f3e85ec2d..0f24d7858 100644 --- a/installers/win32/OOlite.nsi +++ b/installers/win32/OOlite.nsi @@ -26,7 +26,7 @@ ; We use M.m.R.S: M-major, m-minor, R-revision, S-subversion !define VER ${VERSION} !ifndef DST -!define DST ..\..\oolite.app +!define DST ${OOLITE_DIR} !endif !ifndef OUTDIR !define OUTDIR . diff --git a/installers/win32/create_nsis.sh b/installers/win32/create_nsis.sh index c00ce9bf0..01b700879 100644 --- a/installers/win32/create_nsis.sh +++ b/installers/win32/create_nsis.sh @@ -47,10 +47,13 @@ run_script() { export VER_NSIS=$VER_FULL; fi + local OOLITE_DIR="../$1" + OOLITE_DIR="${OOLITE_DIR//\//\\}" # Passing arguments cause problems with some versions of NSIS. # Because of this, we generate them into a separate file and include them. echo "; Version Definitions for Oolite" > OoliteVersions.nsh echo "; NOTE - This file is auto-generated by the Makefile, any manual edits will be overwritten" >> OoliteVersions.nsh + echo "!define OOLITE_DIR ${OOLITE_DIR}" >> OoliteVersions.nsh echo "!define VER_MAJ ${VER_MAJ}" >> OoliteVersions.nsh echo "!define VER_MIN ${VER_MIN}" >> OoliteVersions.nsh echo "!define VER_REV ${VER_REV}" >> OoliteVersions.nsh @@ -61,9 +64,9 @@ run_script() { echo "!define BUILDTIME \"${BUILDTIME}\"" >> OoliteVersions.nsh echo "!define BUILDHOST_IS64BIT 1" >> OoliteVersions.nsh - if [[ "$1" == "dev" ]]; then + if [[ "$2" == "dev" ]]; then echo "!define SNAPSHOT 1" >> OoliteVersions.nsh - elif [[ "$1" != "test" ]]; then + elif [[ "$2" != "test" ]]; then echo "!define DEPLOYMENT 1" >> OoliteVersions.nsh fi diff --git a/libjs.make b/libjs.make deleted file mode 100644 index 55334b8fc..000000000 --- a/libjs.make +++ /dev/null @@ -1,65 +0,0 @@ -# -# This makefile is used to build the Javascript dependency for Oolite -# -# This Makefile is used to download and build the Javascript library -# for use by Oolite. -# Depending on invocation, a debug or release (default) version of the -# library will be built. -# -# To use: -# $ make -f libjs.make debug=(yes|no) - -include config.make - -LIBJS_SRC_DIR = deps/mozilla/js/src -LIBJS_CONFIG_FLAGS = --disable-shared-js -LIBJS_CONFIG_FLAGS += --enable-threadsafe -LIBJS_CONFIG_FLAGS += --with-system-nspr -LIBJS_CONFIG_FLAGS += --disable-tests -ifeq ($(OO_JAVASCRIPT_TRACE),yes) - LIBJS_CONFIG_FLAGS += --enable-trace-jscalls -endif -ifeq ($(debug),yes) - LIBJS_BUILD_DIR = $(LIBJS_SRC_DIR)/build-debug - LIBJS_CONFIG_FLAGS += --enable-debug - LIBJS_CONFIG_FLAGS += --disable-optimize - LIBJS_BUILD_FLAGS = -else - LIBJS_BUILD_DIR = $(LIBJS_SRC_DIR)/build-release - LIBJS_BUILD_FLAGS = -endif -LIBJS = $(LIBJS_BUILD_DIR)/libjs_static.a -LIBJS_BUILD_STAMP = $(LIBJS_BUILD_DIR)/build_stamp -LIBJS_CONFIG_STAMP = $(LIBJS_BUILD_DIR)/config_stamp - - -.PHONY: all -all: $(LIBJS) - -$(LIBJS): $(LIBJS_BUILD_STAMP) - -$(LIBJS_BUILD_STAMP): $(LIBJS_CONFIG_STAMP) - @echo - @echo "Building Javascript library..." - @echo - $(MAKE) -C $(LIBJS_BUILD_DIR) $(LIBJS_BUILD_FLAGS) - touch $@ - -$(LIBJS_CONFIG_STAMP): - @echo - @echo "Configuring Javascript library..." - @echo - mkdir -p $(LIBJS_BUILD_DIR) - cd $(LIBJS_BUILD_DIR) && ../configure $(LIBJS_CONFIG_FLAGS) - touch $@ - -.PHONY: clean -clean: - -$(MAKE) -C $(LIBJS_BUILD_DIR) clean - -$(RM) $(LIBJS_BUILD_STAMP) - -# This target also removes the configuration status, forcing -# a reconfiguration. Use this after changing LIBJS_CONFIG_FLAGS -.PHONY: distclean -distclean: - -$(RM) -r $(LIBJS_BUILD_DIR) diff --git a/meson.build b/meson.build new file mode 100644 index 000000000..62534cd4e --- /dev/null +++ b/meson.build @@ -0,0 +1,150 @@ +project( + 'oolite', + ['c', 'cpp', 'objc'], + meson_version: '>= 1.4.0', + version: run_command( + 'bash', + files('ShellScripts/common/get_version.sh'), + check: true, + ).stdout().strip(), + default_options: [ + 'prefix=' + meson.current_build_dir() / 'oolite.app', + 'bindir=', + 'datadir=', + 'optimization=2', + ], +) + +# ------------------------------------------------------------------------------ +# Compiler Setup & Baseline Arguments +# ------------------------------------------------------------------------------ +cc = meson.get_compiler('c') +host_os = host_machine.system() +is_windows = (host_os == 'windows' or host_os == 'cygwin') + +c_family = ['c', 'cpp', 'objc'] + +version_string = meson.project_version() +add_project_arguments( + '-DOO_VERSION_FULL="@0@"'.format(version_string), + '-DGNUSTEP_BASE_LIBRARY=1', + language: c_family, +) +add_project_arguments( + '-fexceptions', + '-fobjc-exceptions', + language: 'objc', +) + +if cc.get_id() == 'clang' + add_project_arguments( + '-DGNUSTEP_RUNTIME=1', + '-D_NONFRAGILE_ABI=1', + '-fobjc-runtime=gnustep-2.2', + '-fblocks', + language: 'objc', + ) +else + add_project_arguments('-std=gnu99', language: ['c', 'objc']) + add_project_arguments( + '-DGNU_RUNTIME=1', + '-fobjc-runtime=gcc', + language: 'objc', + ) +endif + +is_debug = (get_option('optimization') == '0' or get_option('debug')) +if is_debug + add_project_arguments( + '-O0', + '-DDEBUG', + '-DOO_DEBUG', + '-DOO_CHECK_GL_HEAVY=1', + language: c_family, + ) +endif + +if get_option('no_shaders') + add_project_arguments('-DNO_SHADERS=1', language: c_family) +endif + +if get_option('deployment_release_configuration') + add_project_arguments( + '-DNDEBUG', + '-DOO_CHECK_GL_HEAVY=0', + '-DOO_OXP_VERIFIER_ENABLED=0', + '-DOO_LOCALIZATION_TOOLS=0', + '-DDEBUG_GRAPHVIZ=0', + '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=0', + language: c_family, + ) +else + if get_option('oo_check_gl_heavy') + add_project_arguments('-DOO_CHECK_GL_HEAVY=1', language: c_family) + endif + if get_option('oo_exclude_debug_support') + add_project_arguments('-DNDEBUG', language: c_family) + endif + if get_option('oo_oxp_verifier_enabled') + add_project_arguments('-DOO_OXP_VERIFIER_ENABLED=1', language: c_family) + endif + if get_option('oo_localization_tools') + add_project_arguments('-DOO_LOCALIZATION_TOOLS=1', language: c_family) + endif + if get_option('debug_graphviz') + add_project_arguments('-DDEBUG_GRAPHVIZ=1', language: c_family) + endif + if get_option('oo_fov_inflight_control_enabled') + add_project_arguments( + '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1', + language: c_family, + ) + endif +endif + +if get_option('snapshot_build') + add_project_arguments( + '-DSNAPSHOT_BUILD', + '-DOOLITE_SNAPSHOT_VERSION="@0@"'.format(version_string), + language: c_family, + ) +endif + +if get_option('oo_javascript_trace') + add_project_arguments('-DMOZ_TRACE_JSCALLS=1', language: c_family) +endif + +extra_link_args = [] +if get_option('b_lto') + if cc.get_id() == 'clang' + add_project_arguments('-flto=thin', language: c_family) + extra_link_args += [ + '-flto=thin', + '-Wl,--thinlto-cache-dir=thinlto_cache', + ] + else + add_project_arguments('-flto=auto', language: c_family) + extra_link_args += ['-flto=auto'] + endif +endif + +subdir('src') + +install_env_args = [ + 'PROGPATH=' + join_paths( + meson.global_build_root() / 'oolite.app', + get_option('bindir'), + 'oolite', + ), + 'HOST_OS=' + host_os, + 'DEBUG=' + (get_option('debug') ? 'yes' : 'no'), + 'DEPLOYMENT_RELEASE_CONFIGURATION=' + ( + get_option('deployment_release_configuration') ? 'yes' : 'no' + ), + 'ESPEAK=' + (get_option('espeak') ? 'yes' : 'no'), + 'STRIP_BIN=' + (get_option('strip_bin') ? 'yes' : 'no'), + 'VER_FULL=' + version_string, + 'GNUSTEP_FOLDER=' + gnustep_folder, +] +post_build_script = find_program('ShellScripts/common/post_build.sh') +meson.add_install_script('env', install_env_args, post_build_script.full_path()) diff --git a/meson.options b/meson.options new file mode 100644 index 000000000..fe9e654bc --- /dev/null +++ b/meson.options @@ -0,0 +1,45 @@ +# ============================================================================== +# Oolite Build Options +# ============================================================================== + +# Core Engine Features +option('no_shaders', type: 'boolean', value: false, + description: 'Disable shader support entirely') + +option('espeak', type: 'boolean', value: true, + description: 'Enable eSpeak-ng text-to-speech support') + +option('oo_javascript_trace', type: 'boolean', value: true, + description: 'Enable Mozilla SpiderMonkey JavaScript call tracing') + +option('oo_fov_inflight_control_enabled', type: 'boolean', value: false, + description: 'Enable in-flight Field of View (FOV) control adjustments') + +# Debugging and Heavy Instrumentation +option('oo_check_gl_heavy', type: 'boolean', value: false, + description: 'Enable heavy OpenGL error checking and validation checks') + +option('oo_exclude_debug_support', type: 'boolean', value: false, + description: 'Force exclude developer debug features (strips diagnostic tools)') + +option('oo_oxp_verifier_enabled', type: 'boolean', value: true, + description: 'Enable Oolite Expansion Pack (OXP) checking and verification stages') + +option('oo_localization_tools', type: 'boolean', value: true, + description: 'Enable development tools for processing and extracting localizations') + +option('debug_graphviz', type: 'boolean', value: true, + description: 'Enable AI state-machine graph visualization via GraphViz syntax output') + +# Release Variant Control +option('deployment_release_configuration', type: 'boolean', value: false, + description: 'Force a strict production deployment setup (overrides and disables most debugging instrumentation)') + +option('snapshot_build', type: 'boolean', value: false, + description: 'Mark the compilation as a development snapshot build') + +option('strip_bin', type: 'boolean', value: false, description: 'Enable stripping') + +# Windows Specific Customizations +option('pdb', type: 'boolean', value: false, + description: 'Windows Clang builds only: Generate native .pdb debug symbol files') \ No newline at end of file diff --git a/src/Core/Debug/meson.build b/src/Core/Debug/meson.build new file mode 100644 index 000000000..171460527 --- /dev/null +++ b/src/Core/Debug/meson.build @@ -0,0 +1,14 @@ +# Generated Meson configuration for sub-module: Debug + +my_sources += files( + 'OODebugMonitor.m', + 'OODebugStandards.m', + 'OODebugSupport.m', + 'OODebugTCPConsoleClient.m', + 'OOJSConsole.m', + 'OOTCPStreamDecoder.c', + 'OOTCPStreamDecoderAbstractionLayer.m', +) + +my_includes += include_directories('.') + diff --git a/src/Core/Entities/meson.build b/src/Core/Entities/meson.build new file mode 100644 index 000000000..15c77d558 --- /dev/null +++ b/src/Core/Entities/meson.build @@ -0,0 +1,48 @@ +# Generated Meson configuration for sub-module: Entities + +my_sources += files( + 'DockEntity.m', + 'DustEntity.m', + 'Entity.m', + 'OOBreakPatternEntity.m', + 'OOECMBlastEntity.m', + 'OOEntityWithDrawable.m', + 'OOExhaustPlumeEntity.m', + 'OOExplosionCloudEntity.m', + 'OOFlashEffectEntity.m', + 'OOFlasherEntity.m', + 'OOLaserShotEntity.m', + 'OOLightParticleEntity.m', + 'OOParticleSystem.m', + 'OOPlanetEntity.m', + 'OOPlasmaBurstEntity.m', + 'OOPlasmaShotEntity.m', + 'OOQuiriumCascadeEntity.m', + 'OORingEffectEntity.m', + 'OOSparkEntity.m', + 'OOSunEntity.m', + 'OOVisualEffectEntity.m', + 'OOWaypointEntity.m', + 'PlanetEntity.m', + 'PlayerEntity.m', + 'PlayerEntityContracts.m', + 'PlayerEntityControls.m', + 'PlayerEntityKeyMapper.m', + 'PlayerEntityLegacyScriptEngine.m', + 'PlayerEntityLoadSave.m', + 'PlayerEntityScriptMethods.m', + 'PlayerEntitySound.m', + 'PlayerEntityStickMapper.m', + 'PlayerEntityStickProfile.m', + 'ProxyPlayerEntity.m', + 'ShipEntity.m', + 'ShipEntityAI.m', + 'ShipEntityLoadRestore.m', + 'ShipEntityScriptMethods.m', + 'SkyEntity.m', + 'StationEntity.m', + 'WormholeEntity.m', +) + +my_includes += include_directories('.') + diff --git a/src/Core/Materials/meson.build b/src/Core/Materials/meson.build new file mode 100644 index 000000000..cf6f130c9 --- /dev/null +++ b/src/Core/Materials/meson.build @@ -0,0 +1,30 @@ +# Generated Meson configuration for sub-module: Materials + +my_sources += files( + 'OOBasicMaterial.m', + 'OOCombinedEmissionMapGenerator.m', + 'OOConcreteTexture.m', + 'OODefaultShaderSynthesizer.m', + 'OOMaterial.m', + 'OOMaterialConvenienceCreators.m', + 'OOMaterialSpecifier.m', + 'OOMultiTextureMaterial.m', + 'OONullTexture.m', + 'OOPNGTextureLoader.m', + 'OOPixMap.m', + 'OOPixMapChannelOperations.m', + 'OOPixMapTextureLoader.m', + 'OOPlanetTextureGenerator.m', + 'OOShaderMaterial.m', + 'OOShaderProgram.m', + 'OOShaderUniform.m', + 'OOShaderUniformMethodType.m', + 'OOSingleTextureMaterial.m', + 'OOStandaloneAtmosphereGenerator.m', + 'OOTexture.m', + 'OOTextureGenerator.m', + 'OOTextureLoader.m', +) + +my_includes += include_directories('.') + diff --git a/src/Core/MiniZip/meson.build b/src/Core/MiniZip/meson.build new file mode 100644 index 000000000..f040cb31c --- /dev/null +++ b/src/Core/MiniZip/meson.build @@ -0,0 +1,9 @@ +# Generated Meson configuration for sub-module: MiniZip + +my_sources += files( + 'ioapi.c', + 'unzip.c', +) + +my_includes += include_directories('.') + diff --git a/src/Core/OOCocoa.h b/src/Core/OOCocoa.h index 5e09e2996..e114648e2 100644 --- a/src/Core/OOCocoa.h +++ b/src/Core/OOCocoa.h @@ -45,7 +45,7 @@ MA 02110-1301, USA. #include #import -#ifdef GNUSTEP +#ifdef GNUSTEP_BASE_LIBRARY #define OOLITE_GNUSTEP 1 #if (GNUSTEP_BASE_MAJOR_VERSION == 1 && GNUSTEP_BASE_MINOR_VERSION < 28) diff --git a/src/Core/OOLogOutputHandler.m b/src/Core/OOLogOutputHandler.m index 3b85893ca..676b940bc 100644 --- a/src/Core/OOLogOutputHandler.m +++ b/src/Core/OOLogOutputHandler.m @@ -148,7 +148,7 @@ void OOLogOutputHandlerInit(void) { OOLog(@"logging.nsLogFilter.install.failed", @"Failed to install NSLog() filter; system messages will not be logged in log file."); } -#elif GNUSTEP +#elif GNUSTEP_BASE_LIBRARY NSRecursiveLock *lock = GSLogLock(); [lock lock]; _NSLog_printf_handler = OONSLogPrintfHandler; @@ -175,7 +175,7 @@ void OOLogOutputHandlerClose(void) _NSSetLogCStringFunction(sDefaultLogCStringFunction); sDefaultLogCStringFunction = NULL; } -#elif GNUSTEP +#elif GNUSTEP_BASE_LIBRARY NSRecursiveLock *lock = GSLogLock(); [lock lock]; _NSLog_printf_handler = NULL; diff --git a/src/Core/OOOpenGLOnly.h b/src/Core/OOOpenGLOnly.h index 9d2299ac7..89b4b4e4f 100644 --- a/src/Core/OOOpenGLOnly.h +++ b/src/Core/OOOpenGLOnly.h @@ -26,7 +26,7 @@ MA 02110-1301, USA. */ #ifndef OOLITE_SDL -#if (!OOLITE_MAC_OS_X && GNUSTEP) +#if (!OOLITE_MAC_OS_X && GNUSTEP_BASE_LIBRARY) #define OOLITE_SDL 1 #endif #endif diff --git a/src/Core/OXPVerifier/meson.build b/src/Core/OXPVerifier/meson.build new file mode 100644 index 000000000..f938b4872 --- /dev/null +++ b/src/Core/OXPVerifier/meson.build @@ -0,0 +1,20 @@ +# Generated Meson configuration for sub-module: OXPVerifier + +my_sources += files( + 'OOAIStateMachineVerifierStage.m', + 'OOCheckDemoShipsPListVerifierStage.m', + 'OOCheckEquipmentPListVerifierStage.m', + 'OOCheckJSSyntaxVerifierStage.m', + 'OOCheckPListSyntaxVerifierStage.m', + 'OOCheckRequiresPListVerifierStage.m', + 'OOCheckShipDataPListVerifierStage.m', + 'OOFileScannerVerifierStage.m', + 'OOModelVerifierStage.m', + 'OOOXPVerifier.m', + 'OOOXPVerifierStage.m', + 'OOPListSchemaVerifier.m', + 'OOTextureVerifierStage.m', +) + +my_includes += include_directories('.') + diff --git a/src/Core/Scripting/meson.build b/src/Core/Scripting/meson.build new file mode 100644 index 000000000..98f759905 --- /dev/null +++ b/src/Core/Scripting/meson.build @@ -0,0 +1,54 @@ +# Generated Meson configuration for sub-module: Scripting + +my_sources += files( + 'EntityOOJavaScriptExtensions.m', + 'OOConstToJSString.m', + 'OOJSCall.m', + 'OOJSClock.m', + 'OOJSDock.m', + 'OOJSEngineDebuggerHelpers.m', + 'OOJSEngineTimeManagement.m', + 'OOJSEntity.m', + 'OOJSEquipmentInfo.m', + 'OOJSExhaustPlume.m', + 'OOJSFlasher.m', + 'OOJSFont.m', + 'OOJSFrameCallbacks.m', + 'OOJSFunction.m', + 'OOJSGlobal.m', + 'OOJSGuiScreenKeyDefinition.m', + 'OOJSInterfaceDefinition.m', + 'OOJSManifest.m', + 'OOJSMission.m', + 'OOJSMissionVariables.m', + 'OOJSOolite.m', + 'OOJSPlanet.m', + 'OOJSPlayer.m', + 'OOJSPlayerShip.m', + 'OOJSPopulatorDefinition.m', + 'OOJSQuaternion.m', + 'OOJSScript.m', + 'OOJSShip.m', + 'OOJSShipGroup.m', + 'OOJSSound.m', + 'OOJSSoundSource.m', + 'OOJSSpecialFunctions.m', + 'OOJSStation.m', + 'OOJSSun.m', + 'OOJSSystem.m', + 'OOJSSystemInfo.m', + 'OOJSTimer.m', + 'OOJSVector.m', + 'OOJSVisualEffect.m', + 'OOJSWaypoint.m', + 'OOJSWorldScripts.m', + 'OOJSWormhole.m', + 'OOJavaScriptEngine.m', + 'OOLegacyScriptWhitelist.m', + 'OOPListScript.m', + 'OOScript.m', + 'OOScriptTimer.m', +) + +my_includes += include_directories('.') + diff --git a/src/Core/Tables/meson.build b/src/Core/Tables/meson.build new file mode 100644 index 000000000..d0e81374c --- /dev/null +++ b/src/Core/Tables/meson.build @@ -0,0 +1,3 @@ +# Generated Meson build file for Tables + +my_includes += include_directories('.') diff --git a/src/Core/meson.build b/src/Core/meson.build new file mode 100644 index 000000000..dcea7f361 --- /dev/null +++ b/src/Core/meson.build @@ -0,0 +1,115 @@ +# Generated Meson configuration for sub-module: Core + +my_sources += files( + 'AI.m', + 'AIGraphViz.m', + 'CollisionRegion.m', + 'GameController.m', + 'GuiDisplayGen.m', + 'HeadUpDisplay.m', + 'NSDataOOExtensions.m', + 'NSDictionaryOOExtensions.m', + 'NSFileManagerOOExtensions.m', + 'NSMutableDictionaryOOExtensions.m', + 'NSNumberOOExtensions.m', + 'NSObjectOOExtensions.m', + 'NSScannerOOExtensions.m', + 'NSStringOOExtensions.m', + 'NSThreadOOExtensions.m', + 'NSUserDefaults+Override.m', + 'OOALBufferedSound.m', + 'OOALMusic.m', + 'OOALSound.m', + 'OOALSoundChannel.m', + 'OOALSoundDecoder.m', + 'OOALSoundMixer.m', + 'OOALStreamedSound.m', + 'OOAsyncQueue.m', + 'OOAsyncWorkManager.m', + 'OOCPUInfo.m', + 'OOCache.m', + 'OOCacheManager.m', + 'OOCharacter.m', + 'OOCocoa.m', + 'OOCollectionExtractors.m', + 'OOColor.m', + 'OOCommodities.m', + 'OOCommodityMarket.m', + 'OOConstToString.m', + 'OOConvertCubeMapToLatLong.m', + 'OOConvertSystemDescriptions.m', + 'OOCrosshairs.m', + 'OODebugGLDrawing.m', + 'OODeepCopy.m', + 'OODrawable.m', + 'OOEncodingConverter.m', + 'OOEntityFilterPredicate.m', + 'OOEquipmentType.m', + 'OOExcludeObjectEnumerator.m', + 'OOFilteringEnumerator.m', + 'OOGraphicsResetManager.m', + 'OOHPVector.m', + 'OOIsNumberLiteral.m', + 'OOJoystickManager.m', + 'OOJoystickProfile.m', + 'OOLogHeader.m', + 'OOLogOutputHandler.m', + 'OOLogging.m', + 'OOMatrix.m', + 'OOMesh.m', + 'OOMeshToOctreeConverter.m', + 'OOMouseInteractionMode.m', + 'OOMusicController.m', + 'OOOXZManager.m', + 'OOOpenALController.m', + 'OOOpenGL.m', + 'OOOpenGLExtensionManager.m', + 'OOOpenGLMatrixManager.m', + 'OOOpenGLStateManager.m', + 'OOPListParsing.m', + 'OOPlanetData.c', + 'OOPlanetDrawable.m', + 'OOPolygonSprite.m', + 'OOPriorityQueue.m', + 'OOProbabilisticTextureManager.m', + 'OOProbabilitySet.m', + 'OOProfilingStopwatch.m', + 'OOQuaternion.m', + 'OORegExpMatcher.m', + 'OORoleSet.m', + 'OOShipGroup.m', + 'OOShipLibraryDescriptions.m', + 'OOShipRegistry.m', + 'OOSkyDrawable.m', + 'OOSoundSource.m', + 'OOSoundSourcePool.m', + 'OOSpatialReference.m', + 'OOStringExpander.m', + 'OOStringParsing.m', + 'OOSystemDescriptionManager.m', + 'OOTextureScaling.m', + 'OOTextureSprite.m', + 'OOTrumble.m', + 'OOVector.m', + 'OOVoxel.m', + 'OOWeakReference.m', + 'OOWeakSet.m', + 'OOXMLExtensions.m', + 'Octree.m', + 'OldSchoolPropertyListWriting.m', + 'ResourceManager.m', + 'TextureStore.m', + 'Universe.m', + 'legacy_random.c', +) + +my_includes += include_directories('.') + +# Enter child subdirectories +subdir('Debug') +subdir('Entities') +subdir('Materials') +subdir('MiniZip') +subdir('OXPVerifier') +subdir('Scripting') +subdir('Tables') diff --git a/src/SDL/Comparison.h b/src/SDL/Comparison.h index 55e55aacc..38c3a4a95 100644 --- a/src/SDL/Comparison.h +++ b/src/SDL/Comparison.h @@ -40,7 +40,7 @@ * You may contact the author at will_mason@users.sourceforge.net. */ -#if defined(GNUSTEP) +#if defined(GNUSTEP_BASE_LIBRARY) #if !defined(__COMPARISON_OL_GUARD) #define __COMPARISON_OL_GUARD diff --git a/src/SDL/Comparison.m b/src/SDL/Comparison.m index 8bcca0c82..b9f0914a0 100644 --- a/src/SDL/Comparison.m +++ b/src/SDL/Comparison.m @@ -40,7 +40,7 @@ * You may contact the author at will_mason@users.sourceforge.net. */ -#if defined(GNUSTEP) +#if defined(GNUSTEP_BASE_LIBRARY) #include "Comparison.h" #include diff --git a/src/SDL/EXRSnapshotSupport/meson.build b/src/SDL/EXRSnapshotSupport/meson.build new file mode 100644 index 000000000..758d74b39 --- /dev/null +++ b/src/SDL/EXRSnapshotSupport/meson.build @@ -0,0 +1,14 @@ +# Generated Meson configuration for sub-module: EXRSnapshotSupport + +my_sources += files( + 'OOSaveEXRSnapshot.cpp', +) + +if host_machine.system() == 'windows' + my_sources += files( + 'miniz.c', + ) +endif + +my_includes += include_directories('.') + diff --git a/src/SDL/MyOpenGLView.m b/src/SDL/MyOpenGLView.m index d4bdeb217..c6cb2de0b 100644 --- a/src/SDL/MyOpenGLView.m +++ b/src/SDL/MyOpenGLView.m @@ -692,7 +692,7 @@ - (BOOL) inFullScreenMode return fullScreen; } -#ifdef GNUSTEP +#ifdef GNUSTEP_BASE_LIBRARY - (void) setFullScreenMode:(BOOL)fsm { fullScreen = fsm; diff --git a/src/SDL/OOResourcesWin/OOResourcesWin.rc b/src/SDL/OOResourcesWin/OOResourcesWin.rc index c5cce5dcc..c25da84ba 100644 --- a/src/SDL/OOResourcesWin/OOResourcesWin.rc +++ b/src/SDL/OOResourcesWin/OOResourcesWin.rc @@ -1,4 +1,4 @@ #include "OOResourcesWin.h" CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "oolite.exe.manifest" -IDI_OOLITE ICON "installers/win32/oolite.ico" +IDI_OOLITE ICON "../../../installers/win32/oolite.ico" diff --git a/src/SDL/OOResourcesWin/meson.build b/src/SDL/OOResourcesWin/meson.build new file mode 100644 index 000000000..e01c87867 --- /dev/null +++ b/src/SDL/OOResourcesWin/meson.build @@ -0,0 +1,7 @@ +if host_machine.system() == 'windows' + windows = import('windows') + my_sources += windows.compile_resources('OOResourcesWin.rc') +endif + +my_includes += include_directories('.') + diff --git a/src/SDL/main.m b/src/SDL/main.m index 6f4efb347..9a40c232a 100644 --- a/src/SDL/main.m +++ b/src/SDL/main.m @@ -23,7 +23,7 @@ */ -#ifdef GNUSTEP +#ifdef GNUSTEP_BASE_LIBRARY #import #if (GNUSTEP_BASE_MAJOR_VERSION == 1 && (GNUSTEP_BASE_MINOR_VERSION == 24 && GNUSTEP_BASE_SUBMINOR_VERSION >= 9) || (GNUSTEP_BASE_MINOR_VERSION > 24)) || (GNUSTEP_BASE_MAJOR_VERSION > 1) #import @@ -67,7 +67,7 @@ */ int main(int argc, char *argv[]) { -#ifdef GNUSTEP +#ifdef GNUSTEP_BASE_LIBRARY int i; #if (GNUSTEP_BASE_MAJOR_VERSION == 1 && (GNUSTEP_BASE_MINOR_VERSION == 24 && GNUSTEP_BASE_SUBMINOR_VERSION >= 9) || (GNUSTEP_BASE_MINOR_VERSION > 24)) || (GNUSTEP_BASE_MAJOR_VERSION > 1) diff --git a/src/SDL/meson.build b/src/SDL/meson.build new file mode 100644 index 000000000..f9c2ac74c --- /dev/null +++ b/src/SDL/meson.build @@ -0,0 +1,15 @@ +# Generated Meson configuration for sub-module: SDL + +my_sources += files( + 'Comparison.m', + 'GameController+SDLFullScreen.m', + 'MyOpenGLView.m', + 'OOSDLJoystickManager.m', + 'main.m', +) + +my_includes += include_directories('.') + +# Enter child subdirectories +subdir('EXRSnapshotSupport') +subdir('OOResourcesWin') diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 000000000..73fa157ac --- /dev/null +++ b/src/meson.build @@ -0,0 +1,146 @@ +oolite_deps = [ + dependency('sdl3'), + dependency('libpng'), + dependency('openal'), + dependency('vorbisfile'), + dependency('vorbis'), + dependency('nspr'), + dependency('zlib'), +] + +if get_option('espeak') + oolite_deps += [dependency('espeak-ng')] + add_project_arguments('-DHAVE_LIBESPEAK=1', language: c_family) +endif + +gnustep_folder = '' # Not needed for Windows +my_sources = [] +my_includes = [] + +if is_windows + add_project_arguments( + '-DWIN32', + '-DXP_WIN', + '-DWINVER=0x0A00', + language: c_family, + ) + extra_link_args += ['-mwindows'] + + if cc.get_id() == 'clang' and get_option('pdb') + add_project_arguments('-g', '-gcodeview', language: c_family) + extra_link_args += ['-Wl,-pdb='] + endif + + win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'dbg' : '' + dep_libs = [ + 'glu32', + 'opengl32', + 'dwmapi', + 'winmm', + 'ws2_32', + 'objc', + 'gnustep-base', + 'js' + win_js_suffix, + ] + foreach lib : dep_libs + oolite_deps += [cc.find_library(lib, required: true)] + endforeach + if (cc.get_id() == 'gcc') + add_project_arguments('-DSTATIC_JS_API', language: c_family) + endif + +else + add_project_arguments('-ggdb3', '-DLINUX', '-DXP_UNIX', language: c_family) + extra_link_args += ['-ggdb3'] + + oolite_deps += [ + dependency('gl'), + dependency('glu'), + dependency('x11'), + ] + + fs = import('fs') + project_root = meson.project_source_root() + home_local = join_paths(fs.expanduser('~'), '.local') + + candidate_roots = [ + {'abs': project_root, 'rel': '..'}, + {'abs': home_local, 'rel': home_local}, + {'abs': '/usr/local', 'rel': '/usr/local'}, + {'abs': '/app', 'rel': '/app'}, + ] + js_name = is_debug ? 'jsdbg_static' : 'js_static' + js_lib = disabler() + gs_lib = disabler() + objc_lib = disabler() + js_inc = '' + gs_inc = '' + foreach root : candidate_roots + if not js_lib.found() + js_sub = (root['abs'] == project_root) ? 'build/mozilla_js' : '' + js_folder = root['abs'] / js_sub + lib_check = cc.find_library( + js_name, + dirs: [js_folder / 'lib', js_folder / 'lib64'], + required: false, + ) + if lib_check.found() + js_lib = lib_check + js_inc = root['rel'] / js_sub / 'include' + endif + endif + + if not gs_lib.found() + gs_sub = (root['abs'] == project_root) ? 'build/gnustep' : '' + gnustep_folder = root['abs'] / gs_sub + test_dirs = [gnustep_folder / 'lib', gnustep_folder / 'lib64'] + lib_check = cc.find_library( + 'gnustep-base', + dirs: test_dirs, + required: false, + ) + if lib_check.found() + gs_lib = lib_check + objc_lib = cc.find_library( + 'objc', + dirs: test_dirs, + required: true, + ) + gs_inc = root['rel'] / gs_sub / 'include' + endif + endif + + if js_lib.found() and gs_lib.found() + break + endif + endforeach + + if not js_lib.found() + error('Required dependency "@0@" was not found.'.format(js_name)) + endif + if not gs_lib.found() + error('Required dependency "gnustep-base" was not found.') + endif + + inc_dir = include_directories([js_inc, gs_inc], is_system: true) + oolite_deps += declare_dependency( + dependencies: [js_lib, gs_lib, objc_lib], + include_directories: inc_dir, + ) +endif + +# Enter child subdirectories +subdir('Core') +subdir('SDL') + +oolite_bin = executable( + 'oolite', + my_sources, + include_directories: my_includes, + dependencies: oolite_deps, + win_subsystem: 'windows', + link_args: extra_link_args, + build_rpath: '$ORIGIN', + install_rpath: '$ORIGIN', + install: true, +) diff --git a/tests/launch_snapshot.py b/tests/launch_snapshot.py index 82f2af7e1..d0148e67d 100644 --- a/tests/launch_snapshot.py +++ b/tests/launch_snapshot.py @@ -195,10 +195,10 @@ def run_test(bin_name, test_output): if __name__ == "__main__": parser = argparse.ArgumentParser(description="Oolite Automation Tester") parser.add_argument( - "--path", default="./oolite.app", help="Path to the Oolite directory (default: ./oolite.app)" + "--path", default="./", help="Path to the Oolite directory (default: ./)" ) parser.add_argument( - "--test_output", default="./oolite.app/test_output", help="Path to test output (default: ./oolite.app/test_output)" + "--test_output", default="./test_output", help="Path to test output (default: ./test_output)" ) args = parser.parse_args() diff --git a/tests/run_test.sh b/tests/run_test.sh index 7e1402c05..61621b314 100755 --- a/tests/run_test.sh +++ b/tests/run_test.sh @@ -22,7 +22,8 @@ run_script() { local SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$SCRIPT_DIR" - local TARGET_DIR=$(readlink -f "../oolite.app") + local BUILD_TYPE="${1:-snapshot}" + local TARGET_DIR=$(readlink -f "../build/meson_${BUILD_TYPE}/oolite.app") if [[ -n "$MSYSTEM" ]]; then local MESA_DLL="${MSYSTEM_PREFIX}/bin/opengl32.dll" if [[ -f "$MESA_DLL" ]]; then @@ -31,7 +32,7 @@ run_script() { fi fi - local TEST_OUTPUT="$TARGET_DIR/test_output" + local TEST_OUTPUT="$TARGET_DIR/../test_output" rm -rf "$TEST_OUTPUT" mkdir -p "$TEST_OUTPUT" local OOLITE_LOG="$TEST_OUTPUT/Latest.log"