Skip to content

Commit

Permalink
Fixed installation of translation files
Browse files Browse the repository at this point in the history
  • Loading branch information
lelegard committed Jan 23, 2018
1 parent 8e9cd76 commit 11ff86f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
12 changes: 9 additions & 3 deletions mac/build-mac.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#-----------------------------------------------------------------------------
#
# Copyright (c) 2016, Thierry Lelegard
# Copyright (c) 2016-2018, Thierry Lelegard
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -81,14 +81,20 @@ cp -rp "$LINGDIR" "$VOLAPP"
$QTBINDIR/macdeployqt "$VOLAPP" -verbose=1 -always-overwrite

# Install translations in the bundle.
APPTRANS="$VOLAPP/Contents/MacOS/translations"
APPTRANS="$VOLAPP/Contents/Resources/translations"
mkdir -p "$APPTRANS"
for app in linguist qt qtbase qtconfig; do
for app in linguist qt qtbase qtscript qtquick1 qtmultimedia qtxmlpatterns; do
cp "$QTDIR"/translations/${app}_*.qm "$APPTRANS"
done
chmod 755 "$APPTRANS"
chmod 644 "$APPTRANS"/*

# Declare the translation directory in qt.conf.
# The file qt.conf shall have been created by macdeployqt.
QTCONF="$VOLAPP/Contents/Resources/qt.conf"
[[ -e "$QTCONF" ]] || error "$QTCONF not found"
echo "Translations = Resources/translations" >>"$QTCONF"

# Need to patch "cmd LC_RPATH" in "$VOLAPP/Contents/MacOS/Linguist"
# from @loader_path/../../../../lib
# to @executable_path/../Frameworks
Expand Down
31 changes: 26 additions & 5 deletions windows/build-windows.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#-----------------------------------------------------------------------------
#
# Copyright (c) 2016, Thierry Lelegard
# Copyright (c) 2016-2018, Thierry Lelegard
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -81,7 +81,7 @@ function Search-File ([string]$File, $DirList)
if ($path -eq $null) {
Exit-Script "$File not found in $DirList"
}
return $path
return $path.FullName
}

#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -207,6 +207,7 @@ $NsisScript = (Search-File "qtlinguist.nsi" $PSScriptRoot)

# Locate the latest Qt installation.
# We will locate linguist.exe and gcc.exe under Qt installation tree.
# We do not compile anything but gcc is required by windeployqt.
# We do not simply use a "Get-ChildItem -Recurse". This would be
# simple and neat, but awfully slow since a Qt installation tree
# contains thousands of files. In exploring the Qt installation, we
Expand Down Expand Up @@ -273,6 +274,11 @@ Write-Output "GCC path is $GccExe"
$QtBinDir = (Split-Path -Parent $LinguistExe)
$WinDeployExe = (Search-File "windeployqt.exe" $QtBinDir)

# The Qt translations directory is normally found at the same level as the bin directory.

$TranslationsDir = (Search-File "translations" (Split-Path -Parent $QtBinDir))
Write-Output "Translations path is $TranslationsDir"

# Define a clean and safe path: Qt, GCC and Windows only.

$env:Path = $QtBinDir + ";" + (Split-Path -Parent $GccExe) + ";" + (Join-Path $env:SystemRoot System32) + ";" + $env:SystemRoot
Expand Down Expand Up @@ -342,22 +348,37 @@ try {
[void] (New-Item -ItemType Directory -Force $TempRootDir)
$TempBinDir = (Join-Path $TempRootDir "bin")
[void] (New-Item -ItemType Directory -Force $TempBinDir)
$TempTransDir = (Join-Path $TempBinDir "translations")
[void] (New-Item -ItemType Directory -Force $TempTransDir)

# Copy Linguist in temporary directory and "deploy" dependant modules.
# Copy Linguist in temporary directory.
Copy-Item $LinguistExe $TempBinDir

# "Deploy" dependent modules.
& $WinDeployExe $TempBinDir --release --no-quick-import --no-system-d3d-compiler --no-webkit2 --no-angle --no-opengl-sw

# Copy additional executables.
Copy-Item (Join-Path $QtBinDir lconvert.exe) $TempBinDir
Copy-Item (Join-Path $QtBinDir lrelease.exe) $TempBinDir
Copy-Item (Join-Path $QtBinDir lupdate.exe) $TempBinDir

# Copy translation files.
Copy-Item (Join-Path $TranslationsDir "linguist_*.qm") $TempTransDir
Copy-Item (Join-Path $TranslationsDir "qt_*.qm") $TempTransDir
Copy-Item (Join-Path $TranslationsDir "qtbase_*.qm") $TempTransDir
Copy-Item (Join-Path $TranslationsDir "qtscript_*.qm") $TempTransDir
Copy-Item (Join-Path $TranslationsDir "qtquick1_*.qm") $TempTransDir
Copy-Item (Join-Path $TranslationsDir "qtmultimedia_*.qm") $TempTransDir
Copy-Item (Join-Path $TranslationsDir "qtxmlpatterns_*.qm") $TempTransDir

# Build the installer.
& $NsisExe.FullName `
& $NsisExe `
"/DProductVersion=$Version" `
"/DRootDir=$RootDir" `
"/DBinDir=$TempBinDir" `
"/DVcredistExe=$VcredistExe" `
"/DVcredistName=$VcredistName" `
"$($NsisScript.FullName)"
"$($NsisScript)"

# Copy VC++ redistributable libraries.
$TempRedistDir = (Join-Path $TempRootDir "vcredist")
Expand Down
4 changes: 3 additions & 1 deletion windows/qtlinguist.nsi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;-----------------------------------------------------------------------------
;
; Copyright (c) 2016, Thierry Lelegard
; Copyright (c) 2016-2018, Thierry Lelegard
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -166,6 +166,7 @@ Section "Install"

; Cleanup previous install.
RMDir /r "$INSTDIR\bin"
RMDir /r "$INSTDIR\translations"
RMDir /r "$INSTDIR\vcredist"

; Install product files.
Expand Down Expand Up @@ -207,6 +208,7 @@ Section "Uninstall"

; Delete product files.
RMDir /r "$INSTDIR\bin"
RMDir /r "$INSTDIR\translations"
RMDir /r "$INSTDIR\vcredist"
Delete "$INSTDIR\QtLinguistUninstall.exe"
RMDir "$INSTDIR"
Expand Down

0 comments on commit 11ff86f

Please sign in to comment.