mirror of https://github.com/GNOME/gimp.git
build/windows: Add MS Store dist script
Adds PowerShell script and proper manifest for making .msixupload (only for releases) and/or .msixbundle (always, for testing). As authorized by Jehan, 32-bit willn't be supported. The reasons are: 1. 32-bit is going to die when WIA plug-in is done. This can hurt reviews 2. 32-bit is being restricted in ARM64 version. This causes disparity 3. 32-bit is generating a big footprint. "This is bad for the environment" To be clear: we are discarding most of 32-bit artifact (see point 1) and what could not (TWAIN for x64 only, point 2) almost doubles .msix. There is one small circumstantial reason too: 4. 32-bit wouldn't have .pdb even after GCC 14 because bins have same name as x64, and MS don't allow multiarch debug symbols in the same .appxsym
This commit is contained in:
parent
9d133add5b
commit
184e2704a4
|
@ -0,0 +1,204 @@
|
|||
#!/usr/bin/env pwsh
|
||||
|
||||
# Parameters
|
||||
param ($gimp_version,
|
||||
$gimp_app_version,
|
||||
$arch_a64 = 'gimp-a64',
|
||||
$arch_x64 = 'gimp-x64')
|
||||
|
||||
|
||||
# Needed tools from Windows SDK
|
||||
Set-Alias -Name 'makepri' -Value "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\makepri.exe"
|
||||
Set-Alias -Name 'makeappx' -Value 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit\MakeAppx.exe'
|
||||
Set-Alias -Name 'signtool' -Value 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\signtool.exe'
|
||||
|
||||
|
||||
# Global variables
|
||||
|
||||
## GIMP version (major.minor.micro)
|
||||
if (-Not $gimp_version)
|
||||
{
|
||||
$config_path = Resolve-Path -Path "_build-*\config.h" | Select-Object -ExpandProperty Path
|
||||
$gimp_version = Get-Content -Path "$config_path" | Select-String 'GIMP_VERSION' |
|
||||
Foreach-Object {$_ -replace '#define GIMP_VERSION "',''} | Foreach-Object {$_ -replace '"',''}
|
||||
}
|
||||
|
||||
## GIMP app version (major.minor)
|
||||
if (-Not $gimp_app_version)
|
||||
{
|
||||
$config_path = Resolve-Path -Path "_build-*\config.h" | Select-Object -ExpandProperty Path
|
||||
$gimp_app_version = Get-Content -Path "$config_path" | Select-String 'GIMP_APP_VERSION "' |
|
||||
Foreach-Object {$_ -replace '#define GIMP_APP_VERSION "',''} | Foreach-Object {$_ -replace '"',''}
|
||||
}
|
||||
|
||||
## GIMP arch folders
|
||||
$vfs_a64 = "$arch_a64\VFS\ProgramFilesX64\GIMP ${gimp_app_version}"
|
||||
$vfs_x64 = "$arch_x64\VFS\ProgramFilesX64\GIMP ${gimp_app_version}"
|
||||
$archsArray = "$arch_a64","$arch_x64"
|
||||
$vfsArray = "$vfs_a64","$vfs_x64"
|
||||
|
||||
Set-Location build\windows\store\
|
||||
New-Item -Path "." -Name ".gitignore" -ItemType "File" -Force
|
||||
Set-Content ".gitignore" "$arch_a64`n$arch_x64`n_TempOutput`n_Output"
|
||||
|
||||
|
||||
# 1. CONFIGURE MANIFEST
|
||||
function Configure-Arch ([string]$arch, [string]$arch_msix)
|
||||
{
|
||||
New-Item -ItemType Directory -Path $arch
|
||||
Copy-Item AppxManifest.xml $arch
|
||||
|
||||
## Set GIMP version
|
||||
(Get-Content -Path "$arch\AppxManifest.xml") | Foreach-Object {$_ -replace "@GIMP_VERSION@","$gimp_version"} |
|
||||
Set-Content -Path "$arch\AppxManifest.xml"
|
||||
|
||||
## Set GIMP app version
|
||||
(Get-Content -Path "$arch\AppxManifest.xml") | Foreach-Object {$_ -replace "@GIMP_APP_VERSION@","$gimp_app_version"} |
|
||||
Set-Content -Path "$arch\AppxManifest.xml"
|
||||
|
||||
## Set arch
|
||||
(Get-Content -Path "$arch\AppxManifest.xml") | Foreach-Object {$_ -replace "neutral","$arch_msix"} |
|
||||
Set-Content -Path "$arch\AppxManifest.xml"
|
||||
|
||||
## Match supported filetypes
|
||||
$file_types = Get-Content -Path '..\installer\data_associations.list' | Foreach-Object {" <uap:FileType>." + $_} |
|
||||
Foreach-Object {$_ + "</uap:FileType>"} |
|
||||
Where-Object {$_ -notmatch 'xcf'}
|
||||
(Get-Content -Path "$arch\AppxManifest.xml") | Foreach-Object {$_ -replace "@FILE_TYPES@","$file_types"} |
|
||||
Set-Content -Path "$arch\AppxManifest.xml"
|
||||
}
|
||||
|
||||
Configure-Arch "$arch_a64" 'arm64'
|
||||
Configure-Arch "$arch_x64" 'x64'
|
||||
|
||||
|
||||
# 2. CREATE ASSETS
|
||||
|
||||
## Copy pre-generated icons to each arch
|
||||
$icons_path = Resolve-Path -Path "..\..\..\_build-*\build\windows\store\Assets"
|
||||
if (Test-Path -Path "$icons_path")
|
||||
{
|
||||
foreach ($arch in $archsArray)
|
||||
{
|
||||
New-Item -ItemType Directory -Path "$arch\Assets\"
|
||||
Copy-Item -Path "$icons_path\*.png" -Destination "$arch\Assets\" -Recurse
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
"MS Store icons not found. You can generate them adding '-Dms-store=true' option"
|
||||
"at meson configure time."
|
||||
exit 1
|
||||
}
|
||||
|
||||
## Generate resources.pri
|
||||
foreach ($arch in $archsArray)
|
||||
{
|
||||
Set-Location $arch
|
||||
makepri createconfig /cf priconfig.xml /dq lang-en-US /pv 10.0.0
|
||||
Set-Location ..\
|
||||
makepri new /pr $arch /cf $arch\priconfig.xml /of $arch
|
||||
Remove-Item "$arch\priconfig.xml"
|
||||
}
|
||||
|
||||
|
||||
# 3. COPY GIMP FILES
|
||||
|
||||
## Copy files into VFS folder (to support external 3P plug-ins)
|
||||
Copy-Item -Path "..\..\..\$arch_a64" -Destination "$vfs_a64" -Recurse
|
||||
Copy-Item -Path "..\..\..\$arch_x64" -Destination "$vfs_x64" -Recurse
|
||||
|
||||
## Remove uneeded files (to match the Inno Windows Installer artifact)
|
||||
$omissions = ("include\", "lib\gimp\${gimp_app_version}\plug-ins\test-sphere-v3\", "lib\gimp\${gimp_app_version}\plug-ins\ts-helloworld\", "share\gir-1.0\", "share\man\", "share\vala\", "gimp.cmd", "README.txt")
|
||||
Set-Location $vfs_a64
|
||||
Remove-Item $omissions -Recurse
|
||||
Set-Location ..\..\..\..\$vfs_x64
|
||||
Remove-Item $omissions -Recurse
|
||||
Set-Location ..\..\..\..\
|
||||
|
||||
## Disable Update check (since the package is auto updated)
|
||||
foreach ($vfs in $vfsArray)
|
||||
{
|
||||
Add-Content $vfs\share\gimp\$gimp_app_version\gimp-release "check-update=false"
|
||||
}
|
||||
|
||||
## Remove uncompliant files (to fix 'signtool' issues)
|
||||
$corrections = ("*.debug", "*.tar")
|
||||
foreach ($vfs in $vfsArray)
|
||||
{
|
||||
Get-ChildItem $vfs -Recurse -Include $corrections | Remove-Item -Recurse
|
||||
}
|
||||
|
||||
|
||||
# 4. MAKE .MSIXUPLOAD (ONLY FOR RELEASES)
|
||||
New-Item -ItemType Directory -Path "_TempOutput"
|
||||
New-Item -ItemType Directory -Path "_Output"
|
||||
$archsArray_limited = $archsArray -replace "gimp-", ""
|
||||
|
||||
## Make .appxsym for each arch
|
||||
if ($CI_COMMIT_TAG -or ($GIMP_CI_MS_STORE -eq 'MSIXUPLOAD'))
|
||||
{
|
||||
foreach ($arch in $archsArray_limited)
|
||||
{
|
||||
Get-ChildItem -Path "gimp-$arch" -Filter "*.pdb" -Recurse |
|
||||
Compress-Archive -DestinationPath "_TempOutput\gimp-${gimp_version}_$arch.zip"
|
||||
Get-ChildItem "_TempOutput\*.zip" | Rename-Item -NewName { $_.Name -replace '.zip','.appxsym' }
|
||||
}
|
||||
}
|
||||
|
||||
## Make .msix for each arch (this is needed to make the .msixbundle too)
|
||||
foreach ($arch in $archsArray_limited)
|
||||
{
|
||||
Get-ChildItem "gimp-$arch" -Include "*.pdb" -Recurse -Force | Remove-Item -Recurse -Force
|
||||
makeappx pack /d "gimp-$arch" /p "_TempOutput\gimp-${gimp_version}_$arch.msix"
|
||||
Remove-Item "gimp-$arch" -Recurse
|
||||
}
|
||||
|
||||
## Make .msixupload
|
||||
if ($CI_COMMIT_TAG -or ($GIMP_CI_MS_STORE -eq 'MSIXUPLOAD'))
|
||||
{
|
||||
Compress-Archive -Path "_TempOutput\*" "_Output\gimp-${gimp_version}-store.zip"
|
||||
Get-ChildItem "_Output\*.zip" | Rename-Item -NewName { $_.Name -replace '.zip','.msixupload' }
|
||||
Get-ChildItem "_TempOutput\*.appxsym" | Remove-Item -Recurse -Force
|
||||
}
|
||||
|
||||
|
||||
# 5. MAKE .MSIXBUNDLE
|
||||
|
||||
## Make .msixbundle with all archs
|
||||
makeappx bundle /bv "${gimp_version}.0" /d "_TempOutput\" /p "_Output\gimp-${gimp_version}-local.msixbundle"
|
||||
Remove-Item "_TempOutput\" -Recurse
|
||||
|
||||
## Sign .msixbundle
|
||||
Copy-Item -Path "pseudo-gimp.pfx" -Destination "_Output\" -Recurse
|
||||
SignTool sign /fd sha256 /a /f _Output\pseudo-gimp.pfx /p eek "_Output\gimp-${gimp_version}-local.msixbundle"
|
||||
|
||||
|
||||
# 6. TEST .MSIXUPLOAD OR .MSIXBUNDLE
|
||||
if ($CI_COMMIT_TAG -or ($GIMP_CI_MS_STORE -eq 'MSIXUPLOAD'))
|
||||
{
|
||||
$MSIX_ARTIFACT="gimp-${gimp_version}-store.msixupload"
|
||||
}
|
||||
else
|
||||
{
|
||||
$MSIX_ARTIFACT="gimp-${gimp_version}-local.msixbundle"
|
||||
}
|
||||
|
||||
if (Test-Path -Path "_Output\${MSIX_ARTIFACT}" -PathType Leaf)
|
||||
{
|
||||
Set-Location _Output\
|
||||
Get-FileHash $MSIX_ARTIFACT -Algorithm SHA256 | Out-File -FilePath "${MSIX_ARTIFACT}.SHA256SUMS"
|
||||
Get-FileHash $MSIX_ARTIFACT -Algorithm SHA512 | Out-File -FilePath "${MSIX_ARTIFACT}.SHA512SUMS"
|
||||
|
||||
### Return to git golder
|
||||
Set-Location ..\..\..\..\
|
||||
|
||||
exit 0
|
||||
}
|
||||
else
|
||||
{
|
||||
### Return to git golder
|
||||
Set-Location ..\..\..\
|
||||
|
||||
exit 1
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
|
||||
xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
|
||||
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
|
||||
xmlns:uap6="http://schemas.microsoft.com/appx/manifest/uap/windows10/6"
|
||||
xmlns:uap7="http://schemas.microsoft.com/appx/manifest/uap/windows10/7"
|
||||
xmlns:uap8="http://schemas.microsoft.com/appx/manifest/uap/windows10/8"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10">
|
||||
<Identity Name="GIMP" Publisher="CN=8705A20E-F3A1-463E-86D3-B71D4DE2E37D" Version="@GIMP_VERSION@.0" ProcessorArchitecture="neutral" />
|
||||
<Properties>
|
||||
<DisplayName>GIMP</DisplayName>
|
||||
<PublisherDisplayName>GIMP</PublisherDisplayName>
|
||||
<Description>GNU Image Manipulation Program</Description>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.18362.0" MaxVersionTested="10.0.22621.0" />
|
||||
</Dependencies>
|
||||
<Resources>
|
||||
<Resource Language="en-US" />
|
||||
<Resource uap:Scale="100" />
|
||||
<Resource uap:Scale="125" />
|
||||
<Resource uap:Scale="150" />
|
||||
<Resource uap:Scale="200" />
|
||||
<Resource uap:Scale="400" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="GIMP" Executable="VFS\ProgramFilesX64\GIMP @GIMP_APP_VERSION@\bin\gimp-@GIMP_APP_VERSION@.exe" EntryPoint="Windows.FullTrustApplication">
|
||||
<uap:VisualElements DisplayName="GIMP @GIMP_VERSION@" Description="GNU Image Manipulation Program" BackgroundColor="transparent" Square150x150Logo="Assets\MedTile.png" Square44x44Logo="Assets\AppList.png">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\WideTile.png" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png">
|
||||
<uap:ShowNameOnTiles>
|
||||
<uap:ShowOn Tile="square150x150Logo" />
|
||||
<uap:ShowOn Tile="wide310x150Logo" />
|
||||
<uap:ShowOn Tile="square310x310Logo" />
|
||||
</uap:ShowNameOnTiles>
|
||||
</uap:DefaultTile>
|
||||
</uap:VisualElements>
|
||||
<Extensions>
|
||||
<uap3:Extension Category="windows.fileTypeAssociation">
|
||||
<uap3:FileTypeAssociation Name="xcf">
|
||||
<uap:DisplayName>eXperimental Computing Facility file</uap:DisplayName>
|
||||
<uap:Logo>Assets\fileicon.png</uap:Logo>
|
||||
<uap:SupportedFileTypes>
|
||||
<uap:FileType>.xcf</uap:FileType>
|
||||
</uap:SupportedFileTypes>
|
||||
</uap3:FileTypeAssociation>
|
||||
</uap3:Extension>
|
||||
<uap:Extension Category="windows.fileTypeAssociation">
|
||||
<uap:FileTypeAssociation Name="imagetypes">
|
||||
<uap:Logo>Assets\fileicon.png</uap:Logo>
|
||||
<uap:SupportedFileTypes>
|
||||
@FILE_TYPES@
|
||||
</uap:SupportedFileTypes>
|
||||
</uap:FileTypeAssociation>
|
||||
</uap:Extension>
|
||||
<uap5:Extension Category="windows.appExecutionAlias" EntryPoint="Windows.FullTrustApplication">
|
||||
<uap5:AppExecutionAlias>
|
||||
<uap5:ExecutionAlias Alias="gimp-@GIMP_APP_VERSION@.exe"/>
|
||||
</uap5:AppExecutionAlias>
|
||||
</uap5:Extension>
|
||||
</Extensions>
|
||||
<uap7:Properties>
|
||||
<uap8:ActiveCodePage>UTF-8</uap8:ActiveCodePage>
|
||||
</uap7:Properties>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Extensions>
|
||||
<uap6:Extension Category="windows.loaderSearchPathOverride">
|
||||
<uap6:LoaderSearchPathOverride>
|
||||
<uap6:LoaderSearchPathEntry FolderPath="VFS\ProgramFilesX64\GIMP @GIMP_APP_VERSION@\bin"/>
|
||||
</uap6:LoaderSearchPathOverride>
|
||||
</uap6:Extension>
|
||||
</Extensions>
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
</Capabilities>
|
||||
</Package>
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
if not platform_windows
|
||||
if not platform_windows or host_cpu_family != 'x86'
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue