From c3263e9690f4c1c126539194ad58e88611d8cf1b Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 2 Jun 2026 19:46:49 +1200 Subject: [PATCH 01/22] Meson builds --- clang.ini | 7 ++ meson.build | 121 +++++++++++++++++++++++++ meson_options.txt | 43 +++++++++ src/Cocoa/meson.build | 10 ++ src/Core/Debug/meson.build | 14 +++ src/Core/Entities/meson.build | 48 ++++++++++ src/Core/Materials/meson.build | 30 ++++++ src/Core/MiniZip/meson.build | 9 ++ src/Core/OOCocoa.h | 2 +- src/Core/OOLogOutputHandler.m | 4 +- src/Core/OOOpenGLOnly.h | 2 +- src/Core/OXPVerifier/meson.build | 20 ++++ src/Core/Scripting/meson.build | 54 +++++++++++ src/Core/Tables/meson.build | 3 + src/Core/meson.build | 114 +++++++++++++++++++++++ src/SDL/Comparison.h | 2 +- src/SDL/Comparison.m | 2 +- src/SDL/EXRSnapshotSupport/meson.build | 14 +++ src/SDL/MyOpenGLView.m | 2 +- src/SDL/OOResourcesWin/meson.build | 4 + src/SDL/main.m | 4 +- src/SDL/meson.build | 15 +++ src/meson.build | 115 +++++++++++++++++++++++ 23 files changed, 630 insertions(+), 9 deletions(-) create mode 100644 clang.ini create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 src/Cocoa/meson.build create mode 100644 src/Core/Debug/meson.build create mode 100644 src/Core/Entities/meson.build create mode 100644 src/Core/Materials/meson.build create mode 100644 src/Core/MiniZip/meson.build create mode 100644 src/Core/OXPVerifier/meson.build create mode 100644 src/Core/Scripting/meson.build create mode 100644 src/Core/Tables/meson.build create mode 100644 src/Core/meson.build create mode 100644 src/SDL/EXRSnapshotSupport/meson.build create mode 100644 src/SDL/OOResourcesWin/meson.build create mode 100644 src/SDL/meson.build create mode 100644 src/meson.build 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/meson.build b/meson.build new file mode 100644 index 000000000..ee6e0ef12 --- /dev/null +++ b/meson.build @@ -0,0 +1,121 @@ +project('oolite', ['c', 'cpp', 'objc'], + version: run_command('ShellScripts/common/get_version.sh', check: true).stdout().strip(), + default_options: [ + 'optimization=2', + ] +) + +# ------------------------------------------------------------------------------ +# Dependencies & Compiler Setup +# ------------------------------------------------------------------------------ +cc = meson.get_compiler('c') +host_os = host_machine.system() +is_windows = (host_os == 'windows' or host_os == 'cygwin') + +# Global tracking arrays available to all downstream subdirs +extra_c_args = [] +extra_objc_args = [] +extra_link_args = [] + +# Resolve Linker Type +if cc.get_id() == 'clang' + extra_c_args += ['-Qunused-arguments'] + extra_objc_args += ['-Qunused-arguments'] +else + add_project_arguments('-std=gnu99', language: ['c', 'objc']) +endif + +# Pass the project version string +version_string = meson.project_version() +extra_c_args += '-DOO_VERSION_FULL="@0@"'.format(version_string) +extra_objc_args += '-DOO_VERSION_FULL="@0@"'.format(version_string) + +# ------------------------------------------------------------------------------ +# Flags matching flags.make Logic +# ------------------------------------------------------------------------------ +if get_option('optimization') == '0' or get_option('debug') + extra_c_args += ['-O0', '-DDEBUG', '-DOO_DEBUG', '-DOO_CHECK_GL_HEAVY=1'] + extra_objc_args += ['-O0', '-DDEBUG', '-DOO_DEBUG', '-DOO_CHECK_GL_HEAVY=1'] +endif + +if get_option('no_shaders') + extra_c_args += '-DNO_SHADERS=1' + extra_objc_args += '-DNO_SHADERS=1' +endif + +if get_option('deployment_release_configuration') + deployment_flags = [ + '-DNDEBUG', + '-DOO_CHECK_GL_HEAVY=0', + '-DOO_OXP_VERIFIER_ENABLED=0', + '-DOO_LOCALIZATION_TOOLS=0', + '-DDEBUG_GRAPHVIZ=0', + '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=0' + ] + extra_c_args += deployment_flags + extra_objc_args += deployment_flags +else + if get_option('oo_check_gl_heavy') + extra_c_args += '-DOO_CHECK_GL_HEAVY=1' + extra_objc_args += '-DOO_CHECK_GL_HEAVY=1' + endif + if get_option('oo_exclude_debug_support') + extra_c_args += '-DNDEBUG' + extra_objc_args += '-DNDEBUG' + endif + if get_option('oo_oxp_verifier_enabled') + extra_c_args += '-DOO_OXP_VERIFIER_ENABLED=1' + extra_objc_args += '-DOO_OXP_VERIFIER_ENABLED=1' + endif + if get_option('oo_localization_tools') + extra_c_args += '-DOO_LOCALIZATION_TOOLS=1' + extra_objc_args += '-DOO_LOCALIZATION_TOOLS=1' + endif + if get_option('debug_graphviz') + extra_c_args += '-DDEBUG_GRAPHVIZ=1' + extra_objc_args += '-DDEBUG_GRAPHVIZ=1' + endif + if get_option('oo_fov_inflight_control_enabled') + extra_c_args += '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1' + extra_objc_args += '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1' + endif +endif + +if get_option('snapshot_build') + extra_c_args += ['-DSNAPSHOT_BUILD', '-DOOLITE_SNAPSHOT_VERSION="@0@"'.format(version_string)] + extra_objc_args += ['-DSNAPSHOT_BUILD', '-DOOLITE_SNAPSHOT_VERSION="@0@"'.format(version_string)] +endif + +if get_option('oo_javascript_trace') + extra_objc_args += '-DMOZ_TRACE_JSCALLS=1' +endif + +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') + extra_objc_args += '-DHAVE_LIBESPEAK=1' +endif + +if get_option('b_lto') + if cc.get_id() == 'clang' + extra_c_args += '-flto=thin' + extra_objc_args += '-flto=thin' + extra_link_args += ['-flto=thin', '-Wl,--thinlto-cache-dir=build/thinlto_cache'] + else + extra_c_args += '-flto=auto' + extra_objc_args += '-flto=auto' + extra_link_args += '-flto=auto' + endif +endif + +# Descend into the target directories to trace source groupings natively +subdir('src') \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 000000000..70074f86d --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,43 @@ +# ============================================================================== +# 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') + +# 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/Cocoa/meson.build b/src/Cocoa/meson.build new file mode 100644 index 000000000..d704a78ab --- /dev/null +++ b/src/Cocoa/meson.build @@ -0,0 +1,10 @@ +# Generated Meson configuration for sub-module: Cocoa + +# Mac specific +#my_sources += files( +# 'MyOpenGLView.m', +# 'main.m', +#) + +my_includes += include_directories('.') + 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..b73909d82 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_RUNTIME #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..80dc32cb7 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_RUNTIME NSRecursiveLock *lock = GSLogLock(); [lock lock]; _NSLog_printf_handler = OONSLogPrintfHandler; @@ -175,7 +175,7 @@ void OOLogOutputHandlerClose(void) _NSSetLogCStringFunction(sDefaultLogCStringFunction); sDefaultLogCStringFunction = NULL; } -#elif GNUSTEP +#elif GNUSTEP_RUNTIME NSRecursiveLock *lock = GSLogLock(); [lock lock]; _NSLog_printf_handler = NULL; diff --git a/src/Core/OOOpenGLOnly.h b/src/Core/OOOpenGLOnly.h index 9d2299ac7..cb57c86b9 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_RUNTIME) #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..9583803a5 --- /dev/null +++ b/src/Core/meson.build @@ -0,0 +1,114 @@ +# 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', + '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..29ced062b 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_RUNTIME) #if !defined(__COMPARISON_OL_GUARD) #define __COMPARISON_OL_GUARD diff --git a/src/SDL/Comparison.m b/src/SDL/Comparison.m index 8bcca0c82..8af794b4d 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_RUNTIME) #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..f9e601957 100644 --- a/src/SDL/MyOpenGLView.m +++ b/src/SDL/MyOpenGLView.m @@ -692,7 +692,7 @@ - (BOOL) inFullScreenMode return fullScreen; } -#ifdef GNUSTEP +#ifdef GNUSTEP_RUNTIME - (void) setFullScreenMode:(BOOL)fsm { fullScreen = fsm; diff --git a/src/SDL/OOResourcesWin/meson.build b/src/SDL/OOResourcesWin/meson.build new file mode 100644 index 000000000..1f2ad9ff6 --- /dev/null +++ b/src/SDL/OOResourcesWin/meson.build @@ -0,0 +1,4 @@ +# Generated Meson configuration for sub-module: OOResourcesWin + +my_includes += include_directories('.') + diff --git a/src/SDL/main.m b/src/SDL/main.m index 6f4efb347..1d081152d 100644 --- a/src/SDL/main.m +++ b/src/SDL/main.m @@ -23,7 +23,7 @@ */ -#ifdef GNUSTEP +#ifdef GNUSTEP_RUNTIME #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_RUNTIME 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..2baa4ca70 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,115 @@ +# ------------------------------------------------------------------------------ +# Platform Target Platform Logic +# ------------------------------------------------------------------------------ + +my_sources = [] +my_includes = [] + +if is_windows + extra_c_args += ['-DWIN32', '-DWINVER=0x0A00'] + extra_objc_args += ['-DWIN32', '-DXP_WIN', '-DWINVER=0x0A00'] + extra_link_args += ['-mwindows'] + + if cc.get_id() == 'clang' and get_option('pdb') + extra_c_args += ['-g', '-gcodeview'] + extra_objc_args += ['-g', '-gcodeview'] + extra_link_args += ['-Wl,-pdb='] + endif + + oolite_deps += dependency('gnustep-base') + dep_libs = ['glu32', 'opengl32', 'dwmapi', 'winmm'] + foreach lib : dep_libs + oolite_deps += cc.find_library(lib) + endforeach + + my_includes += include_directories('deps/Windows-deps/x86_64/JS32ECMAv5/include') + win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'ECMAv5dbg' : 'ECMAv5' + js_lib_dir = meson.current_source_dir() + '/deps/Windows-deps/x86_64/JS32' + win_js_suffix + '/lib' + if (get_option('optimization') == '0' or get_option('debug')) and (cc.get_id() == 'gcc') + extra_c_args += '-DSTATIC_JS_API' + extra_objc_args += '-DSTATIC_JS_API' + endif + oolite_deps += cc.find_library('js32' + win_js_suffix, dirs: js_lib_dir) + +else + extra_c_args += ['-ggdb3'] + extra_objc_args += ['-ggdb3', '-DLINUX', '-DXP_UNIX'] + extra_link_args += ['-ggdb3'] + + oolite_deps += [ + dependency('gl'), + dependency('glu'), + dependency('x11'), + ] + + fs = import('fs') + home_local = join_paths(fs.expanduser('~'), '.local') + libraries_to_find = [ + { + 'name': (get_option('optimization') == '0' or get_option('debug')) ? 'jsdbg_static' : 'js_static', + 'roots': ['build/mozilla_js', home_local, '/usr/local', '/app'], + 'is_gnustep': false + }, + { + 'name': 'gnustep-base', + 'roots': ['build/gnustep', home_local, '/usr/local', '/app'], + 'is_gnustep': true + } + ] + foreach item : libraries_to_find + found_dep = false + + foreach root : item['roots'] + actual_root = root.substring(0, 1) == '/' ? root : join_paths(meson.current_source_dir(), root) + search_subdirs = ['lib', 'lib64'] + foreach libdir : search_subdirs + test_path = join_paths(actual_root, libdir) + lib_check = cc.find_library(item['name'], dirs: test_path, required: false) + + if lib_check.found() and not found_dep + include_target = join_paths(actual_root, 'include') + linked_objects = [lib_check] + gnustep_compile_flags = [] + if item['is_gnustep'] + gnustep_compile_flags = [ + '-DGNUSTEP_RUNTIME=1', + '-D_NONFRAGILE_ABI=1', + '-DGNUSTEP_BASE_LIBRARY=1', + '-fobjc-runtime=gnustep-2.2', + '-fblocks', + '-fexceptions', + '-fobjc-exceptions' + ] + linked_objects += cc.find_library('objc', dirs: test_path, required: true) + endif + + # Package everything cleanly together + oolite_deps += declare_dependency( + dependencies: linked_objects, + include_directories: include_directories(include_target), + # Inject arguments for compilation steps downstream natively + compile_args: gnustep_compile_flags + ) + found_dep = true + endif + endforeach + endforeach + endforeach +endif + +# Enter child subdirectories +subdir('SDL') +subdir('Core') +subdir('Cocoa') + +executable('oolite', + my_sources, + include_directories: my_includes, + dependencies: oolite_deps, + c_args: extra_c_args, + objc_args: extra_objc_args, + link_args: extra_link_args, + build_rpath: '$ORIGIN', + install_rpath: '$ORIGIN', + install: true +) From f07139be9f0fbeaebf88b499eadc28c6a5415fa1 Mon Sep 17 00:00:00 2001 From: mcarans Date: Wed, 3 Jun 2026 14:52:59 +1200 Subject: [PATCH 02/22] Meson build --- Makefile | 22 +++-- ShellScripts/common/build_oolite.sh | 27 +----- ShellScripts/common/mkmanifest.sh | 2 + ShellScripts/common/post_build.sh | 46 ++++------ meson.build | 128 ++++++++++++++++------------ meson_options.txt => meson.options | 2 + src/meson.build | 113 ++++++++++++++++-------- 7 files changed, 183 insertions(+), 157 deletions(-) rename meson_options.txt => meson.options (95%) diff --git a/Makefile b/Makefile index e5c02f74f..f0388e1f5 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -include config.make - .PHONY: help help: @echo "This is a helper-Makefile to make compiling Oolite easier." @@ -28,25 +26,34 @@ help: @echo " pkg-win-snapshot - builds a snapshot version" +NATIVE_FILE ?= clang.ini + +# Arguments: 1 = extra meson setup options, 2 = build directory suffix +define meson_build + meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) + meson compile -C build/meson_$(2) + meson install -C build/meson_$(2) +endef + # Here are our default targets # .PHONY: release release: - $(MAKE) -f GNUmakefile debug=no strip=yes lto=yes + $(call meson_build,-Ddebug=false -Dstrip_bin=true -Db_lto=true,release) mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp .PHONY: release-deployment release-deployment: - $(MAKE) -f GNUmakefile DEPLOYMENT_RELEASE_CONFIGURATION=yes debug=no strip=yes lto=yes + $(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 + $(call meson_build,-Dsnapshot_build=true -Ddebug=false -Dstrip_bin=false,snapshot) mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp .PHONY: debug debug: - $(MAKE) -f GNUmakefile debug=yes strip=no + $(call meson_build,-Ddebug=true -Dstrip_bin=false,debug) mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp .PHONY: test @@ -55,8 +62,7 @@ test: release-snapshot .PHONY: clean clean: - $(MAKE) -f GNUmakefile clean - $(RM) -rf oolite.app + $(RM) -rf build/meson_* .PHONY: all all: release release-deployment release-snapshot debug diff --git a/ShellScripts/common/build_oolite.sh b/ShellScripts/common/build_oolite.sh index b67687e44..054db518c 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 + if ! make -f Makefile $TARGET; then echo "❌ Oolite build failed!" >&2 return 1 fi diff --git a/ShellScripts/common/mkmanifest.sh b/ShellScripts/common/mkmanifest.sh index 1d380a8b6..f7403c980 100755 --- a/ShellScripts/common/mkmanifest.sh +++ b/ShellScripts/common/mkmanifest.sh @@ -19,6 +19,8 @@ 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;" else diff --git a/ShellScripts/common/post_build.sh b/ShellScripts/common/post_build.sh index 65a567033..2f5b6efe9 100755 --- a/ShellScripts/common/post_build.sh +++ b/ShellScripts/common/post_build.sh @@ -8,32 +8,16 @@ run_script() { 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}" - + 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,37 @@ 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" + ldd "$PROGPATH" | grep "$MINGW_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/meson.build b/meson.build index ee6e0ef12..4ee4a2d4e 100644 --- a/meson.build +++ b/meson.build @@ -1,23 +1,27 @@ -project('oolite', ['c', 'cpp', 'objc'], - version: run_command('ShellScripts/common/get_version.sh', check: true).stdout().strip(), - default_options: [ - 'optimization=2', - ] +project( + 'oolite', + ['c', 'cpp', 'objc'], + meson_version: '>= 1.4.0', + version: run_command('ShellScripts/common/get_version.sh', check: true).stdout().strip(), + default_options: [ + 'prefix=' + meson.current_build_dir() / 'oolite.app', + 'bindir=', + 'datadir=', + 'optimization=2', + ], ) # ------------------------------------------------------------------------------ -# Dependencies & Compiler Setup +# Compiler Setup # ------------------------------------------------------------------------------ cc = meson.get_compiler('c') host_os = host_machine.system() is_windows = (host_os == 'windows' or host_os == 'cygwin') -# Global tracking arrays available to all downstream subdirs extra_c_args = [] extra_objc_args = [] extra_link_args = [] -# Resolve Linker Type if cc.get_id() == 'clang' extra_c_args += ['-Qunused-arguments'] extra_objc_args += ['-Qunused-arguments'] @@ -25,22 +29,18 @@ else add_project_arguments('-std=gnu99', language: ['c', 'objc']) endif -# Pass the project version string version_string = meson.project_version() -extra_c_args += '-DOO_VERSION_FULL="@0@"'.format(version_string) -extra_objc_args += '-DOO_VERSION_FULL="@0@"'.format(version_string) +extra_c_args += ['-DOO_VERSION_FULL="@0@"'.format(version_string)] +extra_objc_args += ['-DOO_VERSION_FULL="@0@"'.format(version_string)] -# ------------------------------------------------------------------------------ -# Flags matching flags.make Logic -# ------------------------------------------------------------------------------ if get_option('optimization') == '0' or get_option('debug') extra_c_args += ['-O0', '-DDEBUG', '-DOO_DEBUG', '-DOO_CHECK_GL_HEAVY=1'] extra_objc_args += ['-O0', '-DDEBUG', '-DOO_DEBUG', '-DOO_CHECK_GL_HEAVY=1'] endif if get_option('no_shaders') - extra_c_args += '-DNO_SHADERS=1' - extra_objc_args += '-DNO_SHADERS=1' + extra_c_args += ['-DNO_SHADERS=1'] + extra_objc_args += ['-DNO_SHADERS=1'] endif if get_option('deployment_release_configuration') @@ -50,72 +50,90 @@ if get_option('deployment_release_configuration') '-DOO_OXP_VERIFIER_ENABLED=0', '-DOO_LOCALIZATION_TOOLS=0', '-DDEBUG_GRAPHVIZ=0', - '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=0' + '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=0', ] extra_c_args += deployment_flags extra_objc_args += deployment_flags else if get_option('oo_check_gl_heavy') - extra_c_args += '-DOO_CHECK_GL_HEAVY=1' - extra_objc_args += '-DOO_CHECK_GL_HEAVY=1' + extra_c_args += ['-DOO_CHECK_GL_HEAVY=1'] + extra_objc_args += ['-DOO_CHECK_GL_HEAVY=1'] endif if get_option('oo_exclude_debug_support') - extra_c_args += '-DNDEBUG' - extra_objc_args += '-DNDEBUG' + extra_c_args += ['-DNDEBUG'] + extra_objc_args += ['-DNDEBUG'] endif if get_option('oo_oxp_verifier_enabled') - extra_c_args += '-DOO_OXP_VERIFIER_ENABLED=1' - extra_objc_args += '-DOO_OXP_VERIFIER_ENABLED=1' + extra_c_args += ['-DOO_OXP_VERIFIER_ENABLED=1'] + extra_objc_args += ['-DOO_OXP_VERIFIER_ENABLED=1'] endif if get_option('oo_localization_tools') - extra_c_args += '-DOO_LOCALIZATION_TOOLS=1' - extra_objc_args += '-DOO_LOCALIZATION_TOOLS=1' + extra_c_args += ['-DOO_LOCALIZATION_TOOLS=1'] + extra_objc_args += ['-DOO_LOCALIZATION_TOOLS=1'] endif if get_option('debug_graphviz') - extra_c_args += '-DDEBUG_GRAPHVIZ=1' - extra_objc_args += '-DDEBUG_GRAPHVIZ=1' + extra_c_args += ['-DDEBUG_GRAPHVIZ=1'] + extra_objc_args += ['-DDEBUG_GRAPHVIZ=1'] endif if get_option('oo_fov_inflight_control_enabled') - extra_c_args += '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1' - extra_objc_args += '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1' + extra_c_args += ['-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1'] + extra_objc_args += ['-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1'] endif endif if get_option('snapshot_build') - extra_c_args += ['-DSNAPSHOT_BUILD', '-DOOLITE_SNAPSHOT_VERSION="@0@"'.format(version_string)] - extra_objc_args += ['-DSNAPSHOT_BUILD', '-DOOLITE_SNAPSHOT_VERSION="@0@"'.format(version_string)] + extra_c_args += [ + '-DSNAPSHOT_BUILD', + '-DOOLITE_SNAPSHOT_VERSION="@0@"'.format(version_string), + ] + extra_objc_args += [ + '-DSNAPSHOT_BUILD', + '-DOOLITE_SNAPSHOT_VERSION="@0@"'.format(version_string), + ] endif if get_option('oo_javascript_trace') - extra_objc_args += '-DMOZ_TRACE_JSCALLS=1' -endif - -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') - extra_objc_args += '-DHAVE_LIBESPEAK=1' + extra_objc_args += ['-DMOZ_TRACE_JSCALLS=1'] endif if get_option('b_lto') if cc.get_id() == 'clang' - extra_c_args += '-flto=thin' - extra_objc_args += '-flto=thin' - extra_link_args += ['-flto=thin', '-Wl,--thinlto-cache-dir=build/thinlto_cache'] + extra_c_args += ['-flto=thin'] + extra_objc_args += ['-flto=thin'] + extra_link_args += [ + '-flto=thin', + '-Wl,--thinlto-cache-dir=thinlto_cache', + ] else - extra_c_args += '-flto=auto' - extra_objc_args += '-flto=auto' - extra_link_args += '-flto=auto' + extra_c_args += ['-flto=auto'] + extra_objc_args += ['-flto=auto'] + extra_link_args += ['-flto=auto'] endif endif -# Descend into the target directories to trace source groupings natively -subdir('src') \ No newline at end of file +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.txt b/meson.options similarity index 95% rename from meson_options.txt rename to meson.options index 70074f86d..fe9e654bc 100644 --- a/meson_options.txt +++ b/meson.options @@ -38,6 +38,8 @@ option('deployment_release_configuration', type: 'boolean', value: false, 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/meson.build b/src/meson.build index 2baa4ca70..101d83be9 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,7 +1,22 @@ # ------------------------------------------------------------------------------ -# Platform Target Platform Logic +# Dependencies and platform specific logic # ------------------------------------------------------------------------------ +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')] + extra_objc_args += ['-DHAVE_LIBESPEAK=1'] +endif + my_sources = [] my_includes = [] @@ -16,20 +31,24 @@ if is_windows extra_link_args += ['-Wl,-pdb='] endif - oolite_deps += dependency('gnustep-base') + oolite_deps += [dependency('gnustep-base')] dep_libs = ['glu32', 'opengl32', 'dwmapi', 'winmm'] foreach lib : dep_libs - oolite_deps += cc.find_library(lib) + oolite_deps += [cc.find_library(lib)] endforeach - my_includes += include_directories('deps/Windows-deps/x86_64/JS32ECMAv5/include') + my_includes += [ + include_directories('deps/Windows-deps/x86_64/JS32ECMAv5/include'), + ] win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'ECMAv5dbg' : 'ECMAv5' js_lib_dir = meson.current_source_dir() + '/deps/Windows-deps/x86_64/JS32' + win_js_suffix + '/lib' - if (get_option('optimization') == '0' or get_option('debug')) and (cc.get_id() == 'gcc') - extra_c_args += '-DSTATIC_JS_API' - extra_objc_args += '-DSTATIC_JS_API' + if (get_option('optimization') == '0' or get_option('debug')) and ( + cc.get_id() == 'gcc' + ) + extra_c_args += ['-DSTATIC_JS_API'] + extra_objc_args += ['-DSTATIC_JS_API'] endif - oolite_deps += cc.find_library('js32' + win_js_suffix, dirs: js_lib_dir) + oolite_deps += [cc.find_library('js32' + win_js_suffix, dirs: js_lib_dir)] else extra_c_args += ['-ggdb3'] @@ -42,35 +61,46 @@ else dependency('x11'), ] + gnustep_folder = '' fs = import('fs') home_local = join_paths(fs.expanduser('~'), '.local') libraries_to_find = [ { 'name': (get_option('optimization') == '0' or get_option('debug')) ? 'jsdbg_static' : 'js_static', - 'roots': ['build/mozilla_js', home_local, '/usr/local', '/app'], - 'is_gnustep': false + 'build_subfolder': 'mozilla_js', }, { 'name': 'gnustep-base', - 'roots': ['build/gnustep', home_local, '/usr/local', '/app'], - 'is_gnustep': true - } + 'build_subfolder': 'gnustep', + }, ] foreach item : libraries_to_find found_dep = false - - foreach root : item['roots'] - actual_root = root.substring(0, 1) == '/' ? root : join_paths(meson.current_source_dir(), root) + foreach root : [ + 'build/' + item['build_subfolder'], + home_local, + '/usr/local', + '/app', + ] + actual_root = root.substring(0, 1) == '/' ? root : join_paths( + meson.current_source_dir(), + root, + ) search_subdirs = ['lib', 'lib64'] foreach libdir : search_subdirs test_path = join_paths(actual_root, libdir) - lib_check = cc.find_library(item['name'], dirs: test_path, required: false) + lib_check = cc.find_library( + item['name'], + dirs: test_path, + required: false, + ) if lib_check.found() and not found_dep include_target = join_paths(actual_root, 'include') linked_objects = [lib_check] gnustep_compile_flags = [] - if item['is_gnustep'] + if item['build_subfolder'] == 'gnustep' + gnustep_folder = actual_root gnustep_compile_flags = [ '-DGNUSTEP_RUNTIME=1', '-D_NONFRAGILE_ABI=1', @@ -78,18 +108,26 @@ else '-fobjc-runtime=gnustep-2.2', '-fblocks', '-fexceptions', - '-fobjc-exceptions' + '-fobjc-exceptions', + ] + linked_objects += [ + cc.find_library( + 'objc', + dirs: test_path, + required: true, + ), ] - linked_objects += cc.find_library('objc', dirs: test_path, required: true) endif - # Package everything cleanly together - oolite_deps += declare_dependency( - dependencies: linked_objects, - include_directories: include_directories(include_target), - # Inject arguments for compilation steps downstream natively - compile_args: gnustep_compile_flags - ) + oolite_deps += [ + declare_dependency( + dependencies: linked_objects, + include_directories: include_directories( + include_target, + ), + compile_args: gnustep_compile_flags, + ), + ] found_dep = true endif endforeach @@ -102,14 +140,15 @@ subdir('SDL') subdir('Core') subdir('Cocoa') -executable('oolite', - my_sources, - include_directories: my_includes, - dependencies: oolite_deps, - c_args: extra_c_args, - objc_args: extra_objc_args, - link_args: extra_link_args, - build_rpath: '$ORIGIN', - install_rpath: '$ORIGIN', - install: true +oolite_bin = executable( + 'oolite', + my_sources, + include_directories: my_includes, + dependencies: oolite_deps, + c_args: extra_c_args, + objc_args: extra_objc_args, + link_args: extra_link_args, + build_rpath: '$ORIGIN', + install_rpath: '$ORIGIN', + install: true, ) From 17efe057808663bc1aa697e6f26c5c918a7f76b4 Mon Sep 17 00:00:00 2001 From: mcarans Date: Wed, 3 Jun 2026 15:01:26 +1200 Subject: [PATCH 03/22] Add packages --- ShellScripts/Linux/install_package_fn.sh | 7 ++++++ ShellScripts/Linux/install_packages_root.sh | 3 +++ ShellScripts/Windows/install_deps.sh | 2 ++ ShellScripts/common/mkmanifest.sh | 26 ++++++++++----------- 4 files changed, 25 insertions(+), 13 deletions(-) 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/mkmanifest.sh b/ShellScripts/common/mkmanifest.sh index f7403c980..70963fc49 100755 --- a/ShellScripts/common/mkmanifest.sh +++ b/ShellScripts/common/mkmanifest.sh @@ -15,20 +15,20 @@ fi . $OOLITE_VERSION_FILE echo "{" -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)\";" +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 "}" From 8e98d43024efe6cea28a530e63ceae20c2bafda2 Mon Sep 17 00:00:00 2001 From: mcarans Date: Wed, 3 Jun 2026 20:13:15 +1200 Subject: [PATCH 04/22] Add debug --- ShellScripts/common/post_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellScripts/common/post_build.sh b/ShellScripts/common/post_build.sh index 2f5b6efe9..3cab8d772 100755 --- a/ShellScripts/common/post_build.sh +++ b/ShellScripts/common/post_build.sh @@ -2,12 +2,12 @@ # 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 ../.. + set -x PROGDIR="$(dirname "$PROGPATH")" mkdir -p "$PROGDIR/Resources" From 95761e64a8cf3b9869a5c155d91fe520b8ae78dc Mon Sep 17 00:00:00 2001 From: mcarans Date: Wed, 3 Jun 2026 20:19:02 +1200 Subject: [PATCH 05/22] Change run_command --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 4ee4a2d4e..498de23f8 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'oolite', ['c', 'cpp', 'objc'], meson_version: '>= 1.4.0', - version: run_command('ShellScripts/common/get_version.sh', check: true).stdout().strip(), + version: run_command('bash', files('ShellScripts/common/get_version.sh'), check: true).stdout().strip(), default_options: [ 'prefix=' + meson.current_build_dir() / 'oolite.app', 'bindir=', From db696b07f097bc0583adfc90e6e86d31e024e467 Mon Sep 17 00:00:00 2001 From: mcarans Date: Thu, 4 Jun 2026 15:39:32 +1200 Subject: [PATCH 06/22] Missing source file in meson --- ShellScripts/common/mkmanifest.sh | 4 +- meson.build | 102 +++++++++++++++--------------- src/Cocoa/meson.build | 10 --- src/Core/meson.build | 1 + src/meson.build | 42 ++++-------- 5 files changed, 67 insertions(+), 92 deletions(-) delete mode 100644 src/Cocoa/meson.build diff --git a/ShellScripts/common/mkmanifest.sh b/ShellScripts/common/mkmanifest.sh index 70963fc49..f40d22970 100755 --- a/ShellScripts/common/mkmanifest.sh +++ b/ShellScripts/common/mkmanifest.sh @@ -19,8 +19,8 @@ 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)\";" +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;" else diff --git a/meson.build b/meson.build index 498de23f8..25514286b 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,11 @@ project( 'oolite', ['c', 'cpp', 'objc'], meson_version: '>= 1.4.0', - version: run_command('bash', files('ShellScripts/common/get_version.sh'), check: true).stdout().strip(), + version: run_command( + 'bash', + files('ShellScripts/common/get_version.sh'), + check: true, + ).stdout().strip(), default_options: [ 'prefix=' + meson.current_build_dir() / 'oolite.app', 'bindir=', @@ -12,101 +16,105 @@ project( ) # ------------------------------------------------------------------------------ -# Compiler Setup +# Compiler Setup & Baseline Arguments # ------------------------------------------------------------------------------ cc = meson.get_compiler('c') host_os = host_machine.system() is_windows = (host_os == 'windows' or host_os == 'cygwin') -extra_c_args = [] -extra_objc_args = [] -extra_link_args = [] +c_family = ['c', 'cpp', 'objc'] if cc.get_id() == 'clang' - extra_c_args += ['-Qunused-arguments'] - extra_objc_args += ['-Qunused-arguments'] -else add_project_arguments('-std=gnu99', language: ['c', 'objc']) endif version_string = meson.project_version() -extra_c_args += ['-DOO_VERSION_FULL="@0@"'.format(version_string)] -extra_objc_args += ['-DOO_VERSION_FULL="@0@"'.format(version_string)] +add_project_arguments( + '-DOO_VERSION_FULL="@0@"'.format(version_string), + '-DGNUSTEP_RUNTIME=1', + language: c_family, +) + +add_project_arguments( + '-D_NONFRAGILE_ABI=1', + '-DGNUSTEP_BASE_LIBRARY=1', + '-fobjc-runtime=gnustep-2.2', + '-fblocks', + '-fexceptions', + '-fobjc-exceptions', + language: 'objc', +) if get_option('optimization') == '0' or get_option('debug') - extra_c_args += ['-O0', '-DDEBUG', '-DOO_DEBUG', '-DOO_CHECK_GL_HEAVY=1'] - extra_objc_args += ['-O0', '-DDEBUG', '-DOO_DEBUG', '-DOO_CHECK_GL_HEAVY=1'] + add_project_arguments( + '-O0', + '-DDEBUG', + '-DOO_DEBUG', + '-DOO_CHECK_GL_HEAVY=1', + language: c_family, + ) endif if get_option('no_shaders') - extra_c_args += ['-DNO_SHADERS=1'] - extra_objc_args += ['-DNO_SHADERS=1'] + add_project_arguments('-DNO_SHADERS=1', language: c_family) endif if get_option('deployment_release_configuration') - deployment_flags = [ + 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', - ] - extra_c_args += deployment_flags - extra_objc_args += deployment_flags + language: c_family, + ) else if get_option('oo_check_gl_heavy') - extra_c_args += ['-DOO_CHECK_GL_HEAVY=1'] - extra_objc_args += ['-DOO_CHECK_GL_HEAVY=1'] + add_project_arguments('-DOO_CHECK_GL_HEAVY=1', language: c_family) endif if get_option('oo_exclude_debug_support') - extra_c_args += ['-DNDEBUG'] - extra_objc_args += ['-DNDEBUG'] + add_project_arguments('-DNDEBUG', language: c_family) endif if get_option('oo_oxp_verifier_enabled') - extra_c_args += ['-DOO_OXP_VERIFIER_ENABLED=1'] - extra_objc_args += ['-DOO_OXP_VERIFIER_ENABLED=1'] + add_project_arguments('-DOO_OXP_VERIFIER_ENABLED=1', language: c_family) endif if get_option('oo_localization_tools') - extra_c_args += ['-DOO_LOCALIZATION_TOOLS=1'] - extra_objc_args += ['-DOO_LOCALIZATION_TOOLS=1'] + add_project_arguments('-DOO_LOCALIZATION_TOOLS=1', language: c_family) endif if get_option('debug_graphviz') - extra_c_args += ['-DDEBUG_GRAPHVIZ=1'] - extra_objc_args += ['-DDEBUG_GRAPHVIZ=1'] + add_project_arguments('-DDEBUG_GRAPHVIZ=1', language: c_family) endif if get_option('oo_fov_inflight_control_enabled') - extra_c_args += ['-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1'] - extra_objc_args += ['-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1'] + add_project_arguments( + '-DOO_FOV_INFLIGHT_CONTROL_ENABLED=1', + language: c_family, + ) endif endif if get_option('snapshot_build') - extra_c_args += [ + add_project_arguments( '-DSNAPSHOT_BUILD', '-DOOLITE_SNAPSHOT_VERSION="@0@"'.format(version_string), - ] - extra_objc_args += [ - '-DSNAPSHOT_BUILD', - '-DOOLITE_SNAPSHOT_VERSION="@0@"'.format(version_string), - ] + language: c_family, + ) endif if get_option('oo_javascript_trace') - extra_objc_args += ['-DMOZ_TRACE_JSCALLS=1'] + add_project_arguments('-DMOZ_TRACE_JSCALLS=1', language: c_family) endif +extra_link_args = [] if get_option('b_lto') if cc.get_id() == 'clang' - extra_c_args += ['-flto=thin'] - extra_objc_args += ['-flto=thin'] + add_project_arguments('-flto=thin', language: c_family) extra_link_args += [ '-flto=thin', '-Wl,--thinlto-cache-dir=thinlto_cache', ] else - extra_c_args += ['-flto=auto'] - extra_objc_args += ['-flto=auto'] + add_project_arguments('-flto=auto', language: c_family) extra_link_args += ['-flto=auto'] endif endif @@ -120,18 +128,12 @@ install_env_args = [ 'oolite', ), 'HOST_OS=' + host_os, - 'DEBUG=' + ( - get_option('debug') ? 'yes' : 'no' - ), + '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' - ), + 'ESPEAK=' + (get_option('espeak') ? 'yes' : 'no'), + 'STRIP_BIN=' + (get_option('strip_bin') ? 'yes' : 'no'), 'VER_FULL=' + version_string, 'GNUSTEP_FOLDER=' + gnustep_folder, ] diff --git a/src/Cocoa/meson.build b/src/Cocoa/meson.build deleted file mode 100644 index d704a78ab..000000000 --- a/src/Cocoa/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -# Generated Meson configuration for sub-module: Cocoa - -# Mac specific -#my_sources += files( -# 'MyOpenGLView.m', -# 'main.m', -#) - -my_includes += include_directories('.') - diff --git a/src/Core/meson.build b/src/Core/meson.build index 9583803a5..dcea7f361 100644 --- a/src/Core/meson.build +++ b/src/Core/meson.build @@ -11,6 +11,7 @@ my_sources += files( 'NSDictionaryOOExtensions.m', 'NSFileManagerOOExtensions.m', 'NSMutableDictionaryOOExtensions.m', + 'NSNumberOOExtensions.m', 'NSObjectOOExtensions.m', 'NSScannerOOExtensions.m', 'NSStringOOExtensions.m', diff --git a/src/meson.build b/src/meson.build index 101d83be9..082e4517b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,7 +1,3 @@ -# ------------------------------------------------------------------------------ -# Dependencies and platform specific logic -# ------------------------------------------------------------------------------ - oolite_deps = [ dependency('sdl3'), dependency('libpng'), @@ -14,25 +10,27 @@ oolite_deps = [ if get_option('espeak') oolite_deps += [dependency('espeak-ng')] - extra_objc_args += ['-DHAVE_LIBESPEAK=1'] + add_project_arguments('-DHAVE_LIBESPEAK=1', language: c_family) endif my_sources = [] my_includes = [] if is_windows - extra_c_args += ['-DWIN32', '-DWINVER=0x0A00'] - extra_objc_args += ['-DWIN32', '-DXP_WIN', '-DWINVER=0x0A00'] + add_project_arguments( + '-DWIN32', + '-DXP_WIN', + '-DWINVER=0x0A00', + language: c_family, + ) extra_link_args += ['-mwindows'] if cc.get_id() == 'clang' and get_option('pdb') - extra_c_args += ['-g', '-gcodeview'] - extra_objc_args += ['-g', '-gcodeview'] + add_project_arguments('-g', '-gcodeview', language: c_family) extra_link_args += ['-Wl,-pdb='] endif - oolite_deps += [dependency('gnustep-base')] - dep_libs = ['glu32', 'opengl32', 'dwmapi', 'winmm'] + dep_libs = ['gnustep-base', 'glu32', 'opengl32', 'dwmapi', 'winmm'] foreach lib : dep_libs oolite_deps += [cc.find_library(lib)] endforeach @@ -45,14 +43,12 @@ if is_windows if (get_option('optimization') == '0' or get_option('debug')) and ( cc.get_id() == 'gcc' ) - extra_c_args += ['-DSTATIC_JS_API'] - extra_objc_args += ['-DSTATIC_JS_API'] + add_project_arguments('-DSTATIC_JS_API', language: c_family) endif oolite_deps += [cc.find_library('js32' + win_js_suffix, dirs: js_lib_dir)] else - extra_c_args += ['-ggdb3'] - extra_objc_args += ['-ggdb3', '-DLINUX', '-DXP_UNIX'] + add_project_arguments('-ggdb3', '-DLINUX', '-DXP_UNIX', language: c_family) extra_link_args += ['-ggdb3'] oolite_deps += [ @@ -98,18 +94,8 @@ else if lib_check.found() and not found_dep include_target = join_paths(actual_root, 'include') linked_objects = [lib_check] - gnustep_compile_flags = [] if item['build_subfolder'] == 'gnustep' gnustep_folder = actual_root - gnustep_compile_flags = [ - '-DGNUSTEP_RUNTIME=1', - '-D_NONFRAGILE_ABI=1', - '-DGNUSTEP_BASE_LIBRARY=1', - '-fobjc-runtime=gnustep-2.2', - '-fblocks', - '-fexceptions', - '-fobjc-exceptions', - ] linked_objects += [ cc.find_library( 'objc', @@ -125,7 +111,6 @@ else include_directories: include_directories( include_target, ), - compile_args: gnustep_compile_flags, ), ] found_dep = true @@ -136,17 +121,14 @@ else endif # Enter child subdirectories -subdir('SDL') subdir('Core') -subdir('Cocoa') +subdir('SDL') oolite_bin = executable( 'oolite', my_sources, include_directories: my_includes, dependencies: oolite_deps, - c_args: extra_c_args, - objc_args: extra_objc_args, link_args: extra_link_args, build_rpath: '$ORIGIN', install_rpath: '$ORIGIN', From b571b01155d8d0450c2d2cbc7df1a8851a37a8c3 Mon Sep 17 00:00:00 2001 From: mcarans Date: Thu, 4 Jun 2026 16:28:26 +1200 Subject: [PATCH 07/22] See if this helps with errors --- .github/workflows/test_builds.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_builds.yaml b/.github/workflows/test_builds.yaml index a7ad6f47e..a32736a6a 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 /etc/ld.so.conf.d/gnustep.conf + ldconfig - name: Install Mozilla static library run: | ShellScripts/Linux/install_mozilla_js.sh system From a1293a9110bf104e5b7aa0a8cfe364c97d4a6f55 Mon Sep 17 00:00:00 2001 From: mcarans Date: Thu, 4 Jun 2026 17:19:02 +1200 Subject: [PATCH 08/22] Fix Linux tests --- .github/workflows/build-all.yaml | 2 ++ .github/workflows/test_builds.yaml | 8 ++++++-- Makefile | 12 +++++++++--- tests/run_test.sh | 5 +++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 6c747fd1c..4234f1b8c 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 + sudo 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 a32736a6a..45f7660af 100644 --- a/.github/workflows/test_builds.yaml +++ b/.github/workflows/test_builds.yaml @@ -36,8 +36,8 @@ jobs: - name: Build GNUstep run: | ShellScripts/Linux/build_gnustep.sh system - echo "/usr/local/lib" | tee /etc/ld.so.conf.d/gnustep.conf - ldconfig + echo "/usr/local/lib" | tee -a /etc/ld.so.conf + sudo ldconfig - name: Install Mozilla static library run: | ShellScripts/Linux/install_mozilla_js.sh system @@ -83,6 +83,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 + sudo ldconfig - name: Build and test Oolite if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name run: | @@ -125,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 + sudo 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/Makefile b/Makefile index f0388e1f5..45b4456a3 100755 --- a/Makefile +++ b/Makefile @@ -40,7 +40,9 @@ endef .PHONY: release release: $(call meson_build,-Ddebug=false -Dstrip_bin=true -Db_lto=true,release) - mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp + mkdir -p build/meson_release/oolite.app/AddOns && \ + rm -rf build/meson_release/oolite.app/AddOns/Basic-debug.oxp && \ + cp -rf DebugOXP/Debug.oxp build/meson_release/oolite.app/AddOns/Basic-debug.oxp .PHONY: release-deployment release-deployment: @@ -49,12 +51,16 @@ release-deployment: .PHONY: release-snapshot release-snapshot: $(call meson_build,-Dsnapshot_build=true -Ddebug=false -Dstrip_bin=false,snapshot) - mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp + mkdir -p build/meson_snapshot/oolite.app/AddOns && \ + rm -rf build/meson_snapshot/oolite.app/AddOns/Basic-debug.oxp && \ + cp -rf DebugOXP/Debug.oxp build/meson_snapshot/oolite.app/AddOns/Basic-debug.oxp .PHONY: debug debug: $(call meson_build,-Ddebug=true -Dstrip_bin=false,debug) - mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp + mkdir -p build/meson_debug/oolite.app/AddOns && \ + rm -rf build/meson_debug/oolite.app/AddOns/Basic-debug.oxp && \ + cp -rf DebugOXP/Debug.oxp build/meson_debug/oolite.app/AddOns/Basic-debug.oxp .PHONY: test test: release-snapshot 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" From 53a3bbbfea9250956538218efb63c8abd216d131 Mon Sep 17 00:00:00 2001 From: mcarans Date: Thu, 4 Jun 2026 17:26:37 +1200 Subject: [PATCH 09/22] Fix Linux tests --- .github/workflows/build-all.yaml | 2 +- .github/workflows/test_builds.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 4234f1b8c..04bf2f95f 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -100,7 +100,7 @@ jobs: run: | oolite/ShellScripts/Linux/install_mozilla_js.sh system echo "/usr/local/lib" | tee -a /etc/ld.so.conf - sudo ldconfig + 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 45f7660af..77d093a22 100644 --- a/.github/workflows/test_builds.yaml +++ b/.github/workflows/test_builds.yaml @@ -37,7 +37,7 @@ jobs: run: | ShellScripts/Linux/build_gnustep.sh system echo "/usr/local/lib" | tee -a /etc/ld.so.conf - sudo ldconfig + ldconfig - name: Install Mozilla static library run: | ShellScripts/Linux/install_mozilla_js.sh system @@ -84,7 +84,7 @@ jobs: run: | ShellScripts/Linux/install_mozilla_js.sh system echo "/usr/local/lib" | tee -a /etc/ld.so.conf - sudo ldconfig + ldconfig - name: Build and test Oolite if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name run: | @@ -128,7 +128,7 @@ jobs: run: | ShellScripts/Linux/install_mozilla_js.sh system echo "/usr/local/lib" | tee -a /etc/ld.so.conf - sudo ldconfig + ldconfig - name: Build and test Oolite if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name run: | From 43486a601677e4b17e270fcfafabb9f4e38c00e4 Mon Sep 17 00:00:00 2001 From: mcarans Date: Thu, 4 Jun 2026 18:57:43 +1200 Subject: [PATCH 10/22] Fix Windows finding js hopefully --- src/meson.build | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/meson.build b/src/meson.build index 082e4517b..b7ef1ef96 100644 --- a/src/meson.build +++ b/src/meson.build @@ -35,17 +35,11 @@ if is_windows oolite_deps += [cc.find_library(lib)] endforeach - my_includes += [ - include_directories('deps/Windows-deps/x86_64/JS32ECMAv5/include'), - ] - win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'ECMAv5dbg' : 'ECMAv5' - js_lib_dir = meson.current_source_dir() + '/deps/Windows-deps/x86_64/JS32' + win_js_suffix + '/lib' - if (get_option('optimization') == '0' or get_option('debug')) and ( - cc.get_id() == 'gcc' - ) + win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'dbg' : '' + if (cc.get_id() == 'gcc') add_project_arguments('-DSTATIC_JS_API', language: c_family) endif - oolite_deps += [cc.find_library('js32' + win_js_suffix, dirs: js_lib_dir)] + oolite_deps += [dependency('js' + win_js_suffix)] else add_project_arguments('-ggdb3', '-DLINUX', '-DXP_UNIX', language: c_family) From 77fb56ceb2fe72f0ee0a3dbe5b09941d4b4dab29 Mon Sep 17 00:00:00 2001 From: mcarans Date: Thu, 4 Jun 2026 19:36:43 +1200 Subject: [PATCH 11/22] Try find_library for js Windows --- src/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meson.build b/src/meson.build index b7ef1ef96..d17c56377 100644 --- a/src/meson.build +++ b/src/meson.build @@ -39,7 +39,7 @@ if is_windows if (cc.get_id() == 'gcc') add_project_arguments('-DSTATIC_JS_API', language: c_family) endif - oolite_deps += [dependency('js' + win_js_suffix)] + oolite_deps += [cc.find_library('js' + win_js_suffix)] else add_project_arguments('-ggdb3', '-DLINUX', '-DXP_UNIX', language: c_family) From 52a94ffc6475132d4e350ac09ce26d81ef1461f9 Mon Sep 17 00:00:00 2001 From: mcarans Date: Thu, 4 Jun 2026 19:39:33 +1200 Subject: [PATCH 12/22] Fix Fedora --- .github/workflows/test_builds.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_builds.yaml b/.github/workflows/test_builds.yaml index 77d093a22..ebf28ae4c 100644 --- a/.github/workflows/test_builds.yaml +++ b/.github/workflows/test_builds.yaml @@ -83,7 +83,7 @@ jobs: - name: Install Mozilla static library run: | ShellScripts/Linux/install_mozilla_js.sh system - echo "/usr/local/lib" | tee -a /etc/ld.so.conf + 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 From cd35efd2e54137e58952ff9d028901d378613a86 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 5 Jun 2026 10:26:48 +1200 Subject: [PATCH 13/22] Use GNUSTEP_BASE_LIBRARY as its consistent between gcc and clang Fix builds hopefully Remove outdated docs --- .gitignore | 5 - Doc/ExternalLibrariesSourceCodeChanges.txt | 129 ---------------- Doc/FAQ.TXT | 149 ------------------- Doc/PORTING.TXT | 104 ------------- Doc/README_LINUX.TXT | 109 -------------- Doc/SpidermonkeyChanges.txt | 9 ++ Makefile | 114 +++++++------- ShellScripts/Linux/install_freedesktop_fn.sh | 34 ++--- installers/appimage/create_appimage.sh | 13 +- installers/flatpak/flatpak_build.sh | 3 +- installers/win32/OOlite.nsi | 2 +- installers/win32/create_nsis.sh | 6 +- meson.build | 28 ++-- src/Core/OOCocoa.h | 2 +- src/Core/OOLogOutputHandler.m | 4 +- src/Core/OOOpenGLOnly.h | 2 +- src/SDL/Comparison.h | 2 +- src/SDL/Comparison.m | 2 +- src/SDL/MyOpenGLView.m | 2 +- src/SDL/main.m | 4 +- src/meson.build | 8 +- tests/launch_snapshot.py | 4 +- 22 files changed, 123 insertions(+), 612 deletions(-) delete mode 100644 Doc/ExternalLibrariesSourceCodeChanges.txt delete mode 100644 Doc/FAQ.TXT delete mode 100644 Doc/PORTING.TXT delete mode 100644 Doc/README_LINUX.TXT create mode 100644 Doc/SpidermonkeyChanges.txt 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/Makefile b/Makefile index 45b4456a3..f4a740664 100755 --- a/Makefile +++ b/Makefile @@ -1,105 +1,93 @@ -.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" - +# 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 -# Arguments: 1 = extra meson setup options, 2 = build directory suffix +# Modern, self-documenting help target. +# It parses the '##' comments next to targets automatically. +.PHONY: help +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) + 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 -# Here are our default targets -# +# 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: +release: ## Build a test release executable $(call meson_build,-Ddebug=false -Dstrip_bin=true -Db_lto=true,release) - mkdir -p build/meson_release/oolite.app/AddOns && \ - rm -rf build/meson_release/oolite.app/AddOns/Basic-debug.oxp && \ - cp -rf DebugOXP/Debug.oxp build/meson_release/oolite.app/AddOns/Basic-debug.oxp + $(call sync_debug_oxp,release) .PHONY: release-deployment -release-deployment: +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: +release-snapshot: ## Build a snapshot release executable $(call meson_build,-Dsnapshot_build=true -Ddebug=false -Dstrip_bin=false,snapshot) - mkdir -p build/meson_snapshot/oolite.app/AddOns && \ - rm -rf build/meson_snapshot/oolite.app/AddOns/Basic-debug.oxp && \ - cp -rf DebugOXP/Debug.oxp build/meson_snapshot/oolite.app/AddOns/Basic-debug.oxp + $(call sync_debug_oxp,snapshot) .PHONY: debug -debug: +debug: ## Build a debug executable $(call meson_build,-Ddebug=true -Dstrip_bin=false,debug) - mkdir -p build/meson_debug/oolite.app/AddOns && \ - rm -rf build/meson_debug/oolite.app/AddOns/Basic-debug.oxp && \ - cp -rf DebugOXP/Debug.oxp build/meson_debug/oolite.app/AddOns/Basic-debug.oxp + $(call sync_debug_oxp,debug) .PHONY: test -test: release-snapshot +test: release-snapshot ## Run test suite tests/run_test.sh .PHONY: clean -clean: +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-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/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/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..30341cd2c 100755 --- a/installers/flatpak/flatpak_build.sh +++ b/installers/flatpak/flatpak_build.sh @@ -14,7 +14,8 @@ export ADDITIONAL_CFLAGS="-DBUILD_DATE='\"$CPP_DATE\"'" export ADDITIONAL_OBJCFLAGS="-DBUILD_DATE='\"$CPP_DATE\"'" make -f Makefile release-deployment -j$FLATPAK_BUILDER_N_JOBS -install_freedesktop /app lib/debug/bin metainfo +local 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..88d80e734 100644 --- a/installers/win32/create_nsis.sh +++ b/installers/win32/create_nsis.sh @@ -47,10 +47,12 @@ run_script() { export VER_NSIS=$VER_FULL; fi + local OOLITE_DIR="../$1" # 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 +63,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/meson.build b/meson.build index 25514286b..faef4e1ab 100644 --- a/meson.build +++ b/meson.build @@ -24,27 +24,35 @@ is_windows = (host_os == 'windows' or host_os == 'cygwin') c_family = ['c', 'cpp', 'objc'] -if cc.get_id() == 'clang' - add_project_arguments('-std=gnu99', language: ['c', 'objc']) -endif - version_string = meson.project_version() add_project_arguments( '-DOO_VERSION_FULL="@0@"'.format(version_string), - '-DGNUSTEP_RUNTIME=1', + '-DGNUSTEP_BASE_LIBRARY=1', language: c_family, ) - add_project_arguments( - '-D_NONFRAGILE_ABI=1', - '-DGNUSTEP_BASE_LIBRARY=1', - '-fobjc-runtime=gnustep-2.2', - '-fblocks', '-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 + if get_option('optimization') == '0' or get_option('debug') add_project_arguments( '-O0', diff --git a/src/Core/OOCocoa.h b/src/Core/OOCocoa.h index b73909d82..e114648e2 100644 --- a/src/Core/OOCocoa.h +++ b/src/Core/OOCocoa.h @@ -45,7 +45,7 @@ MA 02110-1301, USA. #include #import -#ifdef GNUSTEP_RUNTIME +#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 80dc32cb7..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_RUNTIME +#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_RUNTIME +#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 cb57c86b9..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_RUNTIME) +#if (!OOLITE_MAC_OS_X && GNUSTEP_BASE_LIBRARY) #define OOLITE_SDL 1 #endif #endif diff --git a/src/SDL/Comparison.h b/src/SDL/Comparison.h index 29ced062b..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_RUNTIME) +#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 8af794b4d..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_RUNTIME) +#if defined(GNUSTEP_BASE_LIBRARY) #include "Comparison.h" #include diff --git a/src/SDL/MyOpenGLView.m b/src/SDL/MyOpenGLView.m index f9e601957..c6cb2de0b 100644 --- a/src/SDL/MyOpenGLView.m +++ b/src/SDL/MyOpenGLView.m @@ -692,7 +692,7 @@ - (BOOL) inFullScreenMode return fullScreen; } -#ifdef GNUSTEP_RUNTIME +#ifdef GNUSTEP_BASE_LIBRARY - (void) setFullScreenMode:(BOOL)fsm { fullScreen = fsm; diff --git a/src/SDL/main.m b/src/SDL/main.m index 1d081152d..9a40c232a 100644 --- a/src/SDL/main.m +++ b/src/SDL/main.m @@ -23,7 +23,7 @@ */ -#ifdef GNUSTEP_RUNTIME +#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_RUNTIME +#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/meson.build b/src/meson.build index d17c56377..060c8a0dc 100644 --- a/src/meson.build +++ b/src/meson.build @@ -13,6 +13,7 @@ if get_option('espeak') add_project_arguments('-DHAVE_LIBESPEAK=1', language: c_family) endif +gnustep_folder = '' # Not needed for Windows my_sources = [] my_includes = [] @@ -30,16 +31,14 @@ if is_windows extra_link_args += ['-Wl,-pdb='] endif - dep_libs = ['gnustep-base', 'glu32', 'opengl32', 'dwmapi', 'winmm'] + win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'dbg' : '' + dep_libs = ['glu32', 'opengl32', 'dwmapi', 'winmm', 'gnustep-base', 'js' + win_js_suffix] foreach lib : dep_libs oolite_deps += [cc.find_library(lib)] endforeach - - win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'dbg' : '' if (cc.get_id() == 'gcc') add_project_arguments('-DSTATIC_JS_API', language: c_family) endif - oolite_deps += [cc.find_library('js' + win_js_suffix)] else add_project_arguments('-ggdb3', '-DLINUX', '-DXP_UNIX', language: c_family) @@ -51,7 +50,6 @@ else dependency('x11'), ] - gnustep_folder = '' fs = import('fs') home_local = join_paths(fs.expanduser('~'), '.local') libraries_to_find = [ 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() From a6610f0e9cdf84b33515f51b81b81924cdf0e0d2 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 5 Jun 2026 11:13:30 +1200 Subject: [PATCH 14/22] Fix flatpak and maybe Windows --- installers/flatpak/flatpak_build.sh | 2 +- src/meson.build | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/installers/flatpak/flatpak_build.sh b/installers/flatpak/flatpak_build.sh index 30341cd2c..a999a8249 100755 --- a/installers/flatpak/flatpak_build.sh +++ b/installers/flatpak/flatpak_build.sh @@ -14,7 +14,7 @@ export ADDITIONAL_CFLAGS="-DBUILD_DATE='\"$CPP_DATE\"'" export ADDITIONAL_OBJCFLAGS="-DBUILD_DATE='\"$CPP_DATE\"'" make -f Makefile release-deployment -j$FLATPAK_BUILDER_N_JOBS -local ABS_OOLITEDIR=$(realpath -m "build/meson_deployment/oolite.app") +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 diff --git a/src/meson.build b/src/meson.build index 060c8a0dc..f71e65d71 100644 --- a/src/meson.build +++ b/src/meson.build @@ -32,7 +32,7 @@ if is_windows endif win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'dbg' : '' - dep_libs = ['glu32', 'opengl32', 'dwmapi', 'winmm', 'gnustep-base', 'js' + win_js_suffix] + dep_libs = ['glu32', 'opengl32', 'dwmapi', 'winmm', 'objc', 'gnustep-base', 'js' + win_js_suffix] foreach lib : dep_libs oolite_deps += [cc.find_library(lib)] endforeach @@ -63,6 +63,7 @@ else }, ] foreach item : libraries_to_find + dep_name = item['name'] found_dep = false foreach root : [ 'build/' + item['build_subfolder'], @@ -78,7 +79,7 @@ else foreach libdir : search_subdirs test_path = join_paths(actual_root, libdir) lib_check = cc.find_library( - item['name'], + dep_name, dirs: test_path, required: false, ) @@ -109,6 +110,9 @@ else endif endforeach endforeach + if not found_dep + error('Required dependency "@0@" was not found in any of the searched paths.'.format(dep_name)) + endif endforeach endif From a9c9f6fbeb8c5eb6dae82545a67319ba6c37d040 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 5 Jun 2026 13:55:06 +1200 Subject: [PATCH 15/22] Fix Windows --- meson.build | 3 +- src/meson.build | 110 ++++++++++++++++++++++-------------------------- 2 files changed, 53 insertions(+), 60 deletions(-) diff --git a/meson.build b/meson.build index faef4e1ab..62534cd4e 100644 --- a/meson.build +++ b/meson.build @@ -53,7 +53,8 @@ else ) endif -if get_option('optimization') == '0' or get_option('debug') +is_debug = (get_option('optimization') == '0' or get_option('debug')) +if is_debug add_project_arguments( '-O0', '-DDEBUG', diff --git a/src/meson.build b/src/meson.build index f71e65d71..95f4afa67 100644 --- a/src/meson.build +++ b/src/meson.build @@ -32,9 +32,9 @@ if is_windows endif win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'dbg' : '' - dep_libs = ['glu32', 'opengl32', 'dwmapi', 'winmm', 'objc', 'gnustep-base', 'js' + win_js_suffix] + 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)] + oolite_deps += [cc.find_library(lib, required: true)] endforeach if (cc.get_id() == 'gcc') add_project_arguments('-DSTATIC_JS_API', language: c_family) @@ -51,69 +51,61 @@ else ] fs = import('fs') + project_root = meson.project_source_root() home_local = join_paths(fs.expanduser('~'), '.local') - libraries_to_find = [ - { - 'name': (get_option('optimization') == '0' or get_option('debug')) ? 'jsdbg_static' : 'js_static', - 'build_subfolder': 'mozilla_js', - }, - { - 'name': 'gnustep-base', - 'build_subfolder': 'gnustep', - }, + + candidate_roots = [ + {'abs': project_root, 'rel': '..'}, + {'abs': home_local, 'rel': home_local}, + {'abs': '/usr/local', 'rel': '/usr/local'}, + {'abs': '/app', 'rel': '/app'} ] - foreach item : libraries_to_find - dep_name = item['name'] - found_dep = false - foreach root : [ - 'build/' + item['build_subfolder'], - home_local, - '/usr/local', - '/app', - ] - actual_root = root.substring(0, 1) == '/' ? root : join_paths( - meson.current_source_dir(), - root, - ) - search_subdirs = ['lib', 'lib64'] - foreach libdir : search_subdirs - test_path = join_paths(actual_root, libdir) - lib_check = cc.find_library( - dep_name, - dirs: test_path, - required: false, - ) + 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 lib_check.found() and not found_dep - include_target = join_paths(actual_root, 'include') - linked_objects = [lib_check] - if item['build_subfolder'] == 'gnustep' - gnustep_folder = actual_root - linked_objects += [ - cc.find_library( - 'objc', - dirs: test_path, - required: true, - ), - ] - 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 - oolite_deps += [ - declare_dependency( - dependencies: linked_objects, - include_directories: include_directories( - include_target, - ), - ), - ] - found_dep = true - endif - endforeach - endforeach - if not found_dep - error('Required dependency "@0@" was not found in any of the searched paths.'.format(dep_name)) + 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 From 0e6d74f1e5e58a749cdf0279f423539b9927f767 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 5 Jun 2026 14:33:48 +1200 Subject: [PATCH 16/22] Try to fix slashes for Windows NSIS --- installers/win32/create_nsis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installers/win32/create_nsis.sh b/installers/win32/create_nsis.sh index 88d80e734..01b700879 100644 --- a/installers/win32/create_nsis.sh +++ b/installers/win32/create_nsis.sh @@ -48,6 +48,7 @@ run_script() { 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 From f8a91ae0323c7215f64cd1f997e646b09aa2ecf8 Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 5 Jun 2026 15:53:45 +1200 Subject: [PATCH 17/22] Update README Remove old make files --- GNUmakefile | 143 -------------- GNUmakefile.postamble | 23 --- Makefile | 4 + README.md | 31 ++- ShellScripts/common/build_oolite.sh | 4 +- config.make | 23 --- files.make | 292 ---------------------------- flags.make | 72 ------- gcc.ini | 7 + installers/flatpak/flatpak_build.sh | 2 +- libjs.make | 65 ------- src/meson.build | 45 +++-- 12 files changed, 62 insertions(+), 649 deletions(-) delete mode 100755 GNUmakefile delete mode 100644 GNUmakefile.postamble delete mode 100644 config.make delete mode 100644 files.make delete mode 100644 flags.make create mode 100644 gcc.ini delete mode 100644 libjs.make diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100755 index c35c5d62b..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/BSDCompat: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 f4a740664..54c74d32b 100755 --- a/Makefile +++ b/Makefile @@ -68,6 +68,10 @@ remake: clean all ## Packaging Targets ## +.PHONY: pkg-flatpak +pkg-flatpak: ## Package a Flatpak application + ./installers/flatpak/create_flatpak.sh + .PHONY: pkg-appimage pkg-appimage: release ## Package a test release AppImage installers/appimage/create_appimage.sh meson_release/oolite.app "test" diff --git a/README.md b/README.md index 7b98760f9..ae1229538 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 diff --git a/ShellScripts/common/build_oolite.sh b/ShellScripts/common/build_oolite.sh index 054db518c..eedece906 100755 --- a/ShellScripts/common/build_oolite.sh +++ b/ShellScripts/common/build_oolite.sh @@ -15,8 +15,8 @@ run_script() { TARGET=$1 fi - make -f Makefile clean - if ! make -f Makefile $TARGET; then + make clean + if ! make $TARGET; then echo "❌ Oolite build failed!" >&2 return 1 fi 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/flatpak/flatpak_build.sh b/installers/flatpak/flatpak_build.sh index a999a8249..701be2252 100755 --- a/installers/flatpak/flatpak_build.sh +++ b/installers/flatpak/flatpak_build.sh @@ -12,7 +12,7 @@ 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 ABS_OOLITEDIR=$(realpath -m "build/meson_deployment/oolite.app") install_freedesktop $ABS_OOLITEDIR /app lib/debug/bin metainfo 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/src/meson.build b/src/meson.build index 95f4afa67..09078a8cc 100644 --- a/src/meson.build +++ b/src/meson.build @@ -32,7 +32,16 @@ if is_windows 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] + 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 @@ -56,21 +65,25 @@ else candidate_roots = [ {'abs': project_root, 'rel': '..'}, - {'abs': home_local, 'rel': home_local}, + {'abs': home_local, 'rel': home_local}, {'abs': '/usr/local', 'rel': '/usr/local'}, - {'abs': '/app', 'rel': '/app'} + {'abs': '/app', 'rel': '/app'}, ] - js_name = is_debug ? 'jsdbg_static' : 'js_static' - js_lib = disabler() - gs_lib = disabler() + js_name = is_debug ? 'jsdbg_static' : 'js_static' + js_lib = disabler() + gs_lib = disabler() objc_lib = disabler() - js_inc = '' - gs_inc = '' + 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) + 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' @@ -81,10 +94,18 @@ else 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) + 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) + objc_lib = cc.find_library( + 'objc', + dirs: test_dirs, + required: true, + ) gs_inc = root['rel'] / gs_sub / 'include' endif endif @@ -104,7 +125,7 @@ else 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 + include_directories: inc_dir, ) endif From c8df7b89f8ab93973100b0f424e44d184c1eeb2a Mon Sep 17 00:00:00 2001 From: mcarans Date: Fri, 5 Jun 2026 16:32:30 +1200 Subject: [PATCH 18/22] Update README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ae1229538..44a3ba468 100644 --- a/README.md +++ b/README.md @@ -198,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 From f39b7f2277974144d8013cdd3f25e0c43f45b43e Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 6 Jun 2026 18:02:34 +1200 Subject: [PATCH 19/22] Fix for Windows paths when running through meson --- ShellScripts/common/post_build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShellScripts/common/post_build.sh b/ShellScripts/common/post_build.sh index 3cab8d772..3c9643318 100755 --- a/ShellScripts/common/post_build.sh +++ b/ShellScripts/common/post_build.sh @@ -76,7 +76,8 @@ run_script() { if [[ "$HOST_OS" == "windows" ]]; then # Determine and copy DLL dependencies - ldd "$PROGPATH" | 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" From 2a8aba66b2654cceba9bf0faeee27c89af46ff5b Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 8 Jun 2026 08:00:40 +1200 Subject: [PATCH 20/22] Add win_subsystem --- src/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/src/meson.build b/src/meson.build index 09078a8cc..73fa157ac 100644 --- a/src/meson.build +++ b/src/meson.build @@ -138,6 +138,7 @@ oolite_bin = executable( my_sources, include_directories: my_includes, dependencies: oolite_deps, + win_subsystem: 'windows', link_args: extra_link_args, build_rpath: '$ORIGIN', install_rpath: '$ORIGIN', From 982702bc6b65428ea65d970080e25cc081553256 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 8 Jun 2026 11:58:36 +1200 Subject: [PATCH 21/22] Add missing .rc file --- src/SDL/OOResourcesWin/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SDL/OOResourcesWin/meson.build b/src/SDL/OOResourcesWin/meson.build index 1f2ad9ff6..e01c87867 100644 --- a/src/SDL/OOResourcesWin/meson.build +++ b/src/SDL/OOResourcesWin/meson.build @@ -1,4 +1,7 @@ -# Generated Meson configuration for sub-module: OOResourcesWin +if host_machine.system() == 'windows' + windows = import('windows') + my_sources += windows.compile_resources('OOResourcesWin.rc') +endif my_includes += include_directories('.') From 77b5f0d59bc8df6e4b70062c14fc9b5e05e661e8 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 8 Jun 2026 12:11:21 +1200 Subject: [PATCH 22/22] Adjust icon path --- src/SDL/OOResourcesWin/OOResourcesWin.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"