diff --git a/mac/build-mac.sh b/mac/build-mac.sh index 088dfc0..668372a 100755 --- a/mac/build-mac.sh +++ b/mac/build-mac.sh @@ -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 @@ -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 diff --git a/windows/build-windows.ps1 b/windows/build-windows.ps1 index afd8a35..f3c6d08 100644 --- a/windows/build-windows.ps1 +++ b/windows/build-windows.ps1 @@ -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 @@ -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 } #----------------------------------------------------------------------------- @@ -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 @@ -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 @@ -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") diff --git a/windows/qtlinguist.nsi b/windows/qtlinguist.nsi index ce1d5b6..0ff8f75 100644 --- a/windows/qtlinguist.nsi +++ b/windows/qtlinguist.nsi @@ -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 @@ -166,6 +166,7 @@ Section "Install" ; Cleanup previous install. RMDir /r "$INSTDIR\bin" + RMDir /r "$INSTDIR\translations" RMDir /r "$INSTDIR\vcredist" ; Install product files. @@ -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"