Skip to content

Commit

Permalink
Merge branch release/v8.3.0 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
papacarlo committed Feb 5, 2025
2 parents cbabfe6 + 099f8b8 commit bade3b8
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 32 deletions.
33 changes: 27 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,22 @@ ifneq ($(filter %86,$(UNAME_M)),)
TAR_ARCH := i386
ARCHITECTURE := 32
endif
ifneq ($(filter aarch%,$(UNAME_M)),)
ifneq ($(filter $(UNAME_M),aarch64 arm64),)
RPM_ARCH := aarch64
DEB_ARCH := arm64
TAR_ARCH := aarch64
TAR_ARCH := $(UNAME_M)
ARCHITECTURE := arm64
endif

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
PLATFORM := linux
SRC ?= ../build_tools/out/linux_$(ARCHITECTURE)/$(COMPANY_NAME_LOW)/$(PRODUCT_NAME_LOW)/*
DB_PREFIX := $(COMPANY_NAME_LOW)/$(PRODUCT_NAME_LOW)
PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER)
else ifeq ($(UNAME_S),Darwin)
PLATFORM := mac
endif
SRC ?= ../build_tools/out/$(PLATFORM)_$(ARCHITECTURE)/$(COMPANY_NAME_LOW)/$(PRODUCT_NAME_LOW)/*
DB_PREFIX := $(COMPANY_NAME_LOW)/$(PRODUCT_NAME_LOW)
PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER)

BUILD_DIR = build

Expand Down Expand Up @@ -120,9 +122,21 @@ clean :
rpm*/$(PACKAGE_NAME).spec \
tar

ifeq ($(UNAME_S),Linux)
$(BUILD_DIR) : $(LINUX_DEPS)
$(MKDIR) $@/opt/$(DB_PREFIX)
$(CP) $@/opt/$(DB_PREFIX) $(SRC)
else ifeq ($(UNAME_S),Darwin)
$(BUILD_DIR) :
mkdir -p $@
cp -rf $(SRC) $@
ifeq ($(ENABLE_SIGNING),1)
codesign --force --verbose --verify --options=runtime \
--sign "$(CODESIGNING_IDENTITY)" $@/docbuilder $@/x2t
codesign --force --verbose --verify \
--sign "$(CODESIGNING_IDENTITY)" $@/*.dylib
endif
endif

$(BUILD_DIR)/usr/bin/$(PACKAGE_NAME) : common/documentbuilder.sh.m4
mkdir -p $(@D)
Expand Down Expand Up @@ -157,8 +171,13 @@ $(DEB): $(BUILD_DIR) $(DEB_DEPS)

$(TAR): $(BUILD_DIR)
mkdir -p $(@D)
ifeq ($(UNAME_S),Linux)
tar --owner=0 --group=0 -C $(BUILD_DIR) -cJf $@ \
$(patsubst $(BUILD_DIR)/%,%,$(wildcard $(BUILD_DIR)/*))
else ifeq ($(UNAME_S),Darwin)
tar --uid=0 --gid=0 -C $(BUILD_DIR) -cJf $@ \
$(patsubst $(BUILD_DIR)/%,%,$(wildcard $(BUILD_DIR)/*))
endif

% : %.m4
m4 $(M4_PARAMS) $< > $@
Expand All @@ -167,9 +186,11 @@ rpm/$(PACKAGE_NAME).spec : rpm/package.spec
cp -f $< $@

ifeq ($(PLATFORM),linux)
PACKAGES += tar
PACKAGES += deb
PACKAGES += rpm
# PACKAGES += tar
else ifeq ($(PLATFORM),mac)
PACKAGES += tar
endif

packages: $(PACKAGES)
2 changes: 1 addition & 1 deletion exe/builder.iss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#endif
#define NAME_EXE_OUT 'docbuilder.exe'
#ifndef APP_DIR
#define APP_DIR '..\build\app'
#define APP_DIR '..\build'
#endif
#ifndef OUTPUT_DIR
#define OUTPUT_DIR '.'
Expand Down
75 changes: 75 additions & 0 deletions make.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
param (
[System.Version]$Version = "0.0.0.0",
[string]$Arch = "x64",
[string]$CompanyName = "ONLYOFFICE",
[string]$ProductName = "DocumentBuilder",
[string]$SourceDir,
[string]$BuildDir = "build",
[switch]$Sign
)
$ErrorActionPreference = "Stop"

Set-Location $PSScriptRoot

if (-not $SourceDir) {
$BuildPrefix = switch ($Arch) {
"x64" { "win_64" }
"x86" { "win_32" }
}
$SourceDir = "$PSScriptRoot\..\build_tools\out\" `
+ "$BuildPrefix\$CompanyName\$ProductName" | Resolve-Path
}
if (-not (Test-Path "$SourceDir")) {
Write-Error "Path `"$SourceDir`" does not exist"
}

Write-Host @"
Version $Version
Arch $Arch
CompanyName $CompanyName
ProductName $ProductName
SourceDir $SourceDir
BuildDir $BuildDir
Sign $Sign
"@

####

Write-Host "`n[ Prepare build directory ]"

if (Test-Path "$BuildDir") {
Write-Host "REMOVE DIR: $BuildDir"
Remove-Item -Force -Recurse -LiteralPath "$BuildDir"
}

Write-Host "CREATE DIR: $BuildDir"
New-Item -ItemType Directory -Force -Path "$BuildDir" | Out-Null

Write-Host "COPY: $SourceDir\* > $BuildDir\"
Copy-Item -Force -Recurse `
-Path "$SourceDir\*" `
-Destination "$BuildDir\"

####

Write-Host "`n[ Sign files ]"

if ($Sign) {
Set-Location "$BuildDir"

$CertName = $(if ($env:WINDOWS_CERTIFICATE_NAME) { `
$env:WINDOWS_CERTIFICATE_NAME } else { "Ascensio System SIA" })
$TimestampServer = "http://timestamp.digicert.com"
$SignFiles = Get-ChildItem *.exe, *.dll | Resolve-Path -Relative
$SignFiles

Write-Host "signtool sign /a /n $CertName /t $TimestampServer /v ..."
& signtool sign /a /n $CertName /t $TimestampServer /v $SignFiles
if (-not $?) { throw "Exited with code $LastExitCode" }

Write-Host "signtool verify /q /pa /all ..."
& signtool verify /q /pa /all $SignFiles | Out-Null
if (-not $?) { throw "Exited with code $LastExitCode" }

Set-Location $PSScriptRoot
}
66 changes: 41 additions & 25 deletions make_inno.ps1
Original file line number Diff line number Diff line change
@@ -1,46 +1,62 @@
param (
param (
[System.Version]$Version = "0.0.0.0",
[string]$Arch = "x64",
[string]$Version = "1.0.0",
[string]$Build = "1",
[string]$CompanyName = "ONLYOFFICE",
[string]$ProductName = "DocumentBuilder",
[string]$BuildDir = "build",
[string]$Branding,
[switch]$Sign = $false,
[string]$CertName = "Ascensio System SIA",
[string]$TimestampServer = "http://timestamp.digicert.com"
[switch]$Sign
)

$ErrorActionPreference = "Stop"

Set-Location $PSScriptRoot

# Check app directory
if ( -Not (Test-Path -Path "build\app") ) {
Write-Error "Path build\app does not exist"
if ( -Not (Test-Path -Path "$BuildDir") ) {
Write-Error "Path `"$BuildDir`" does not exist"
}

# ISCC path
if ( $env:INNOPATH ) {
Write-Host @"
Version $Version
Arch $Arch
CompanyName $CompanyName
ProductName $ProductName
BuildDir $BuildDir
Branding $Branding
Sign $Sign
"@

####

Write-Host "`n[ Get Inno Setup path ]"

if ($env:INNOPATH) {
$InnoPath = $env:INNOPATH
}
else
{
$InnoPath = (Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1")."Inno Setup: App Path"
else {
$RegPath = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1"
$InnoPath = (Get-ItemProperty $RegPath)."Inno Setup: App Path"
}
$InnoPath
$env:Path = "$InnoPath;$env:Path"

# ISCC args
$InnoArgs = "/DAPP_DIR=..\build\app",
"/DOUTPUT_DIR=..\build",
"/DARCH=$Arch",
"/DVERSION=$Version.$Build"
if ( $Branding ) {
####

Write-Host "`n[ Build Inno Setup project ]"

$InnoArgs = "/DARCH=$Arch",
"/DVERSION=$Version"
if ($Branding) {
$InnoArgs += "/DBRANDING_DIR=$Branding"
}
if ( $Sign ) {
if ($Sign) {
$CertName = $(if ($env:WINDOWS_CERTIFICATE_NAME) { `
$env:WINDOWS_CERTIFICATE_NAME } else { "Ascensio System SIA" })
$TimestampServer = "http://timestamp.digicert.com"
$InnoArgs += "/DSIGN"
$InnoArgs += "/Sbyparam=signtool.exe sign /a /v /n `$q$CertName`$q /t $TimestampServer `$f"
$InnoArgs += "/Sbyparam=signtool sign /a /v /n `$q$CertName`$q /t $TimestampServer `$f"
}

# Build
Write-Host "ISCC $InnoArgs exe\builder.iss" -ForegroundColor Yellow
Write-Host "ISCC $InnoArgs exe\builder.iss"
& ISCC $InnoArgs exe\builder.iss
Exit $LastExitCode
if (-not $?) { throw "Exited with code $LastExitCode" }
41 changes: 41 additions & 0 deletions make_zip.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
param (
[System.Version]$Version = "0.0.0.0",
[string]$Arch = "x64",
[string]$CompanyName = "ONLYOFFICE",
[string]$ProductName = "DocumentBuilder",
[string]$BuildDir = "build"
)

$ErrorActionPreference = "Stop"

Set-Location $PSScriptRoot

if (-not (Test-Path "$BuildDir")) {
Write-Error "Path `"$BuildDir`" does not exist"
}
$ZipFile = "zip\$CompanyName-$ProductName-$Version-$Arch.zip"

Write-Host @"
Version = $Version
Arch = $Arch
CompanyName = $CompanyName
ProductName = $ProductName
BuildDir = $BuildDir
ZipFile = $ZipFile
"@

####

Write-Host "`n[ Create archive ]"

if (Test-Path "$ZipFile") {
Write-Host "DELETE: $ZipFile"
Remove-Item -Force -LiteralPath "$ZipFile"
}

Write-Host "CREATE DIR: zip"
New-Item -ItemType Directory -Force -Path "zip" | Out-Null

Write-Host "7z a -y $ZipFile .\$BuildDir\*"
& 7z a -y "$ZipFile" ".\$BuildDir\*"
if (-not $?) { throw "Exited with code $LastExitCode" }

0 comments on commit bade3b8

Please sign in to comment.