build/windows: Alternative approach to Inno reading of config*.h

Closes: #14101

Partially reverts: f69dd75a17
This commit is contained in:
Bruno Lopes 2025-05-26 16:30:34 -03:00
parent 868d566c7f
commit c9f77c7228
No known key found for this signature in database
6 changed files with 23 additions and 61 deletions

View file

@ -97,6 +97,13 @@ ForEach ($line in $(Select-String 'define' $CONFIG_PATH -AllMatches))
{ {
Invoke-Expression $($line -replace '^.*#' -replace 'define ','$' -replace ' ','=') Invoke-Expression $($line -replace '^.*#' -replace 'define ','$' -replace ' ','=')
} }
#Meson don't support C++ style comments. See: https://github.com/mesonbuild/meson/issues/14260
$CLEANCONFIG_PATH ="$(Split-Path -Parent $CONFIG_PATH)\config_clean.h"
if (Test-Path $CLEANCONFIG_PATH)
{
Remove-Item $CLEANCONFIG_PATH -Force
}
(Get-Content $CONFIG_PATH -Raw) -replace '/\*[\s\S]*?\*/', '' | Set-Content $CLEANCONFIG_PATH
## Get CUSTOM_GIMP_VERSION (GIMP version as we display for users in installer) ## Get CUSTOM_GIMP_VERSION (GIMP version as we display for users in installer)
$CUSTOM_GIMP_VERSION = $GIMP_VERSION $CUSTOM_GIMP_VERSION = $GIMP_VERSION

View file

@ -82,27 +82,27 @@
;2 GLOBAL VARIABLES SET BY PARAMS ;2 GLOBAL VARIABLES SET BY PARAMS
;Meson don't support C++ style comments. See: https://github.com/mesonbuild/meson/issues/14260 ;Meson don't support C++ style comments. See: https://github.com/mesonbuild/meson/issues/14260
#include BUILD_DIR + "\build\windows\installer\config_clean.h" #include BUILD_DIR + "\config_clean.h"
;Main GIMP versions: ;Main GIMP versions:
;Get GIMP_MUTEX_VERSION (used for internal versioning control) ;Get GIMP_MUTEX_VERSION (used for internal versioning control)
#if Defined(GIMP_UNSTABLE) && GIMP_UNSTABLE != "" #if Defined(GIMP_UNSTABLE)
#define GIMP_MUTEX_VERSION GIMP_APP_VERSION #define GIMP_MUTEX_VERSION GIMP_APP_VERSION
#else #else
#define GIMP_MUTEX_VERSION=Copy(GIMP_APP_VERSION,1,Pos(".",GIMP_APP_VERSION)-1) #define GIMP_MUTEX_VERSION=Copy(GIMP_APP_VERSION,1,Pos(".",GIMP_APP_VERSION)-1)
#endif #endif
;Get FULL_GIMP_VERSION (used by ITs) ;Get FULL_GIMP_VERSION (used by ITs)
#define ORIGINAL_GIMP_VERSION GIMP_VERSION #define ORIGINAL_GIMP_VERSION GIMP_VERSION
#if Defined(GIMP_RC_VERSION) && GIMP_RC_VERSION != "" #if Defined(GIMP_RC_VERSION)
#define GIMP_VERSION=Copy(GIMP_VERSION,1,Pos("-",GIMP_VERSION)-1) #define GIMP_VERSION=Copy(GIMP_VERSION,1,Pos("-",GIMP_VERSION)-1)
#endif #endif
#if !Defined(REVISION) || REVISION=="0" || REVISION=="" #if !Defined(REVISION) || REVISION=="0"
#define FULL_GIMP_VERSION GIMP_VERSION + "." + "0" #define FULL_GIMP_VERSION GIMP_VERSION + "." + "0"
#else #else
#define FULL_GIMP_VERSION GIMP_VERSION + "." + REVISION #define FULL_GIMP_VERSION GIMP_VERSION + "." + REVISION
#endif #endif
;Get CUSTOM_GIMP_VERSION (that the users see) ;Get CUSTOM_GIMP_VERSION (that the users see)
#if !Defined(REVISION) || REVISION=="0" || REVISION=="" #if !Defined(REVISION) || REVISION=="0"
#define CUSTOM_GIMP_VERSION ORIGINAL_GIMP_VERSION #define CUSTOM_GIMP_VERSION ORIGINAL_GIMP_VERSION
#else #else
#define CUSTOM_GIMP_VERSION ORIGINAL_GIMP_VERSION + "-" + REVISION #define CUSTOM_GIMP_VERSION ORIGINAL_GIMP_VERSION + "-" + REVISION
@ -157,7 +157,7 @@ AppPublisher=The GIMP Team
AppPublisherURL=https://www.gimp.org/ AppPublisherURL=https://www.gimp.org/
;ControlPanel 'HelpLink' ;ControlPanel 'HelpLink'
AppSupportURL=https://www.gimp.org/docs/ AppSupportURL=https://www.gimp.org/docs/
#if Defined(GIMP_UNSTABLE) && GIMP_UNSTABLE != "" #if Defined(GIMP_UNSTABLE)
;ControlPanel 'URLUpdateInfo' ;ControlPanel 'URLUpdateInfo'
AppUpdatesURL=https://www.gimp.org/downloads/devel/ AppUpdatesURL=https://www.gimp.org/downloads/devel/
#else #else
@ -417,7 +417,7 @@ Type: files; Name: "{autodesktop}\{reg:HKA\SOFTWARE\Microsoft\Windows\CurrentVer
Type: filesandordirs; Name: "{app}\lib\babl-0.1" Type: filesandordirs; Name: "{app}\lib\babl-0.1"
Type: filesandordirs; Name: "{app}\lib\gegl-0.4" Type: filesandordirs; Name: "{app}\lib\gegl-0.4"
;This was bunbled in 3.0 RC1 but not needed since the "Debug" menu is hidden in stable releases ;This was bunbled in 3.0 RC1 but not needed since the "Debug" menu is hidden in stable releases
#if (!Defined(GIMP_UNSTABLE) || GIMP_UNSTABLE=="") && (Defined(GIMP_RELEASE) && GIMP_RELEASE != "") #if !Defined(GIMP_UNSTABLE) && Defined(GIMP_RELEASE)
Type: files; Name: "{app}\bin\dot.exe" Type: files; Name: "{app}\bin\dot.exe"
#endif #endif
;No need to all these python binaries shipped in 3.0 RC1 ;No need to all these python binaries shipped in 3.0 RC1
@ -678,7 +678,7 @@ begin
end; end;
function InitializeSetup(): Boolean; function InitializeSetup(): Boolean;
#if (Defined(GIMP_UNSTABLE) && GIMP_UNSTABLE != "") || (Defined(GIMP_RC_VERSION) && GIMP_RC_VERSION != "") || (!Defined(GIMP_RELEASE) || GIMP_RELEASE=="") || Defined(DEVEL_WARNING) #if Defined(GIMP_UNSTABLE) || Defined(GIMP_RC_VERSION) || !Defined(GIMP_RELEASE)|| Defined(DEVEL_WARNING)
var Message,Buttons: TArrayOfString; var Message,Buttons: TArrayOfString;
#endif #endif
begin begin
@ -697,7 +697,7 @@ begin
exit; exit;
//Unstable version warning //Unstable version warning
#if (Defined(GIMP_UNSTABLE) && GIMP_UNSTABLE != "") || (Defined(GIMP_RC_VERSION) && GIMP_RC_VERSION != "") || (!Defined(GIMP_RELEASE) || GIMP_RELEASE=="") || Defined(DEVEL_WARNING) #if Defined(GIMP_UNSTABLE) || Defined(GIMP_RC_VERSION) || !Defined(GIMP_RELEASE) || Defined(DEVEL_WARNING)
Explode(Message, CustomMessage('DevelopmentWarning'), #13#10); Explode(Message, CustomMessage('DevelopmentWarning'), #13#10);
SetArrayLength(Buttons,2); SetArrayLength(Buttons,2);
Buttons[0] := CustomMessage('DevelopmentButtonContinue'); Buttons[0] := CustomMessage('DevelopmentButtonContinue');
@ -1541,7 +1541,7 @@ end;
//7.2 INSTALL: show GIMP text (aka billboard) above progress bar //7.2 INSTALL: show GIMP text (aka billboard) above progress bar
#if Defined(GIMP_UNSTABLE) && GIMP_UNSTABLE != "" #if Defined(GIMP_UNSTABLE)
const const
GIMP_URL = 'https://gimp.org/downloads/devel/'; GIMP_URL = 'https://gimp.org/downloads/devel/';
#else #else
@ -1660,7 +1660,7 @@ begin
InterpFile := ExpandConstant('{app}\lib\gimp\{#GIMP_PKGCONFIG_VERSION}\interpreters\pygimp.interp'); InterpFile := ExpandConstant('{app}\lib\gimp\{#GIMP_PKGCONFIG_VERSION}\interpreters\pygimp.interp');
DebugMsg('PrepareInterp','Writing interpreter file for gimp-python: ' + InterpFile); DebugMsg('PrepareInterp','Writing interpreter file for gimp-python: ' + InterpFile);
#if (Defined(GIMP_UNSTABLE) && GIMP_UNSTABLE != "") || (!Defined(GIMP_RELEASE) || GIMP_RELEASE=="") #if Defined(GIMP_UNSTABLE) || !Defined(GIMP_RELEASE)
//python.exe is prefered in unstable versions because of error output //python.exe is prefered in unstable versions because of error output
#define PYTHON="python.exe" #define PYTHON="python.exe"
#else #else

View file

@ -1,15 +0,0 @@
// This file shouldn't even exist, but Meson unfortunately do
// not support C++ style comments. See: https://github.com/mesonbuild/meson/issues/14260
#define GIMP_APP_VERSION "@GIMP_APP_VERSION@"
#define GIMP_VERSION "@GIMP_VERSION@"
#define GIMP_PKGCONFIG_VERSION "@GIMP_PKGCONFIG_VERSION@"
#define GIMP_RELEASE "@GIMP_RELEASE@"
#define GIMP_UNSTABLE "@GIMP_UNSTABLE@"
#define GIMP_RC_VERSION "@GIMP_RC_VERSION@"

View file

@ -1,24 +0,0 @@
## This file shouldn't even exist, but Meson unfortunately do
## not support C++ style comments. See: https://github.com/mesonbuild/meson/issues/14260
installer_conf = configuration_data()
installer_conf.set('GIMP_APP_VERSION', gimp_app_version)
installer_conf.set('GIMP_VERSION', gimp_version)
installer_conf.set('GIMP_PKGCONFIG_VERSION', gimp_api_version)
installer_conf.set('GIMP_RELEASE', release ? 1 : '')
if gimp_unstable != false
installer_conf.set('GIMP_UNSTABLE', gimp_unstable)
endif
if gimp_rc_version != false
installer_conf.set('GIMP_RC_VERSION', gimp_rc_version)
endif
configure_file(
input : 'config_clean.h.in',
output: 'config_clean.h',
configuration: installer_conf
)
subdir('lang')

View file

@ -89,25 +89,19 @@ conf.set_quoted('GIMP_VERSION', gimp_version)
# GIMP_UNSTABLE tells if we are on an unstable or stable development branch. # GIMP_UNSTABLE tells if we are on an unstable or stable development branch.
stable = (gimp_app_version_minor % 2 == 0) stable = (gimp_app_version_minor % 2 == 0)
gimp_unstable = stable ? false : 1 conf.set('GIMP_UNSTABLE', stable ? false : 1)
if gimp_unstable != false
conf.set('GIMP_UNSTABLE', gimp_unstable)
endif
# GIMP_RELEASE tells if this is a release or in-between release (git) code. # GIMP_RELEASE tells if this is a release or in-between release (git) code.
release = (gimp_app_version_micro % 2 == 0) release = (gimp_app_version_micro % 2 == 0)
conf.set('GIMP_RELEASE', release ? 1 : false) conf.set('GIMP_RELEASE', release ? 1 : false)
# GIMP_RC_VERSION can only be set on release candidates. # GIMP_RC_VERSION can only be set on release candidates.
gimp_rc_version = release and gimp_app_version_rc > 0 ? gimp_app_version_rc : false conf.set('GIMP_RC_VERSION', release and gimp_app_version_rc > 0 ? gimp_app_version_rc : false)
if gimp_rc_version != false
conf.set('GIMP_RC_VERSION', gimp_rc_version)
endif
# GIMP_IS_GIT can only be set during development of a RC. # GIMP_IS_GIT can only be set during development of a RC.
conf.set('GIMP_IS_RC_GIT', gimp_rc_git ? 1 : false) conf.set('GIMP_IS_RC_GIT', gimp_rc_git ? 1 : false)
# Mutex version # Mutex version
if gimp_unstable != false if not stable
conf.set_quoted('GIMP_MUTEX_VERSION', gimp_app_version) conf.set_quoted('GIMP_MUTEX_VERSION', gimp_app_version)
else else
conf.set_quoted('GIMP_MUTEX_VERSION', gimp_app_version_major.to_string()) conf.set_quoted('GIMP_MUTEX_VERSION', gimp_app_version_major.to_string())
@ -2075,7 +2069,7 @@ subdir('devel-docs')
# Inno Windows installer # Inno Windows installer
if get_option('windows-installer') if get_option('windows-installer')
subdir('po-windows-installer') subdir('po-windows-installer')
subdir('build/windows/installer') subdir('build/windows/installer/lang')
endif endif
pkgconfig.generate(libgimp, pkgconfig.generate(libgimp,

View file

@ -41,7 +41,7 @@ endforeach
# Fallback fix to the problem of non-configured interpreters (needed by MSIX) # Fallback fix to the problem of non-configured interpreters (needed by MSIX)
if platform_windows and not meson.is_cross_build() and python.found() if platform_windows and not meson.is_cross_build() and python.found()
python_config = configuration_data() python_config = configuration_data()
if gimp_unstable or not release if not stable or not release
#python.exe is prefered in unstable versions because of error output #python.exe is prefered in unstable versions because of error output
python_config.set('PYTHON_EXE', 'python.exe') python_config.set('PYTHON_EXE', 'python.exe')
else else