diff --git a/URL.txt b/URL.txt index 3093359..af430a2 100644 --- a/URL.txt +++ b/URL.txt @@ -5,5 +5,5 @@ https://code.videolan.org/rist/librist.git # If a temporary alternate URL is needed, for instance waiting for a # merge request to be merged, other URL's can be added below. Only -# last (uncommented) URL is used. -# https://code.videolan.org/lelegard/librist.git +# the last (uncommented) URL is used. +https://code.videolan.org/lelegard/librist.git diff --git a/deb/librist-dev.control b/deb/librist-dev.control index c92c747..0953737 100644 --- a/deb/librist-dev.control +++ b/deb/librist-dev.control @@ -1,7 +1,7 @@ Package: librist-dev Source: rist Version: {{VERSION}} -Maintainer: Thierry Lelegard +Maintainer: Unspecified Architecture: {{ARCH}} Section: free/video Priority: optional diff --git a/deb/librist.control b/deb/librist.control index 82e9809..90fe27a 100644 --- a/deb/librist.control +++ b/deb/librist.control @@ -1,7 +1,7 @@ Package: librist Source: rist Version: {{VERSION}} -Maintainer: Thierry Lelegard +Maintainer: Unspecified Architecture: {{ARCH}} Section: free/video Priority: optional diff --git a/deb/rist.control b/deb/rist.control index 56923b7..bfb5809 100644 --- a/deb/rist.control +++ b/deb/rist.control @@ -1,7 +1,7 @@ Package: rist Source: rist Version: {{VERSION}} -Maintainer: Thierry Lelegard +Maintainer: Unspecified Architecture: {{ARCH}} Section: free/video Priority: optional diff --git a/win/build.ps1 b/win/build.ps1 index 035f630..fd61619 100644 --- a/win/build.ps1 +++ b/win/build.ps1 @@ -95,7 +95,6 @@ $RootDir = (Split-Path -Parent $PSScriptRoot) $InstallerDir = "$RootDir\installers" $BuildDir = "$RootDir\build" $RepoDir = "$BuildDir\librist" -$PreInstallDir = "$BuildDir\install" # Cleanup when required. if ($Clean) { @@ -106,7 +105,6 @@ if ($Clean) { # Create local build directories. [void] (New-Item -Path $BuildDir -ItemType Directory -Force) -[void] (New-Item -Path $PreInstallDir -ItemType Directory -Force) [void] (New-Item -Path $InstallerDir -ItemType Directory -Force) # Locate NSIS, the Nullsoft Scriptable Installation System. @@ -180,58 +178,69 @@ Write-Output "RIST version is $Version, Windows version info is $VersionInfo" # Build only if necessary. if (-not $NoBuild) { + Cleanup-Build + # Get local architecture. if ([System.IntPtr]::Size -eq 4) { $LocalArch = "Win32" $OtherArch = "x64" + $CrossScript = "vcvarsx86_amd64.bat" } else { $LocalArch = "x64" $OtherArch = "Win32" + $CrossScript = "vcvarsamd64_x86.bat" } - # Build all build scripts using meson for local architecture. - Cleanup-Build + # Build using meson for local architecture. meson setup --backend vs2019 --buildtype release --default-library both $BuildDir\Release-${LocalArch} $RepoDir meson setup --backend vs2019 --buildtype debug --default-library both $BuildDir\Debug-${LocalArch} $RepoDir + meson compile -C $BuildDir\Release-${LocalArch} + meson compile -C $BuildDir\Debug-${LocalArch} + # Currently, there is no way to build for the "other" architecture with meson. - # See: https://code.videolan.org/rist/librist/-/issues/123 - - # Manually craft the build environment for the "other" architecture. - #@@@ foreach ($Conf in @("Release", "Debug")) { - #@@@ $local = "$BuildDir\${Conf}-${LocalArch}" - #@@@ $other = "$BuildDir\${Conf}-${OtherArch}" - #@@@ # Copy-Item -Force -Recurse $BuildDir\${Conf}-${LocalArch} $BuildDir\${Conf}-${OtherArch} - #@@@ # Get-ChildItem -Recurse -Name $BuildDir\${Conf}-${OtherArch} | ForEach-Object { - #@@@ Get-ChildItem -Recurse -Name $local | ForEach-Object { - #@@@ $name = $_ - #@@@ if (Test-Path "$local\$name" -PathType Container) { - #@@@ Write-Output "===> creating $other\$name" - #@@@ [void] (New-Item -Path "$other\$name" -ItemType Directory -Force) - #@@@ } - #@@@ else { - #@@@ (Get-Content -Raw "$local\$name") -replace "$LocalArch","$OtherArch" | Set-Content -Force "$other\$name" - #@@@ # $file = "$BuildDir\${Conf}-${OtherArch}\$_" - #@@@ # (Get-Content -Raw ${file}) -replace "$LocalArch","$OtherArch" | Set-Content -Force "${file}.new" - #@@@ # Move-Item -Force "${file}.new" ${file} - #@@@ } - #@@@ } - #@@@ } - - # Build librist in all configurations. - foreach ($Conf in @("Release", "Debug")) { - meson compile -C $BuildDir\${Conf}-${LocalArch} + # So, we are going the hacky way. Just pretend we are cross-compiling for + # the other architecture using the CMD script from VisualStudio, get the + # environment variables from the CMD command, temporarily set them for meson. + # It seems to work by magic... + + # Search the CMD script from VisualStudio. + $Script = (Get-ChildItem -Recurse -Path "C:\Program Files*\Microsoft Visual Studio" -Include $CrossScript | Select-Object -First 1).FullName + if (-not $Script) { + Exit-Script "$CrossScript not found in Visual Studio" } -} -# Only when using single architecture. -$ArchName = "-" + ($LocalArch -replace "x64","Win64") + # Run the CMD script, get all environment variable, set modified ones. + $PreviousEnv = @{} + cmd /Q /a /d /c "`"$Script`" & set" | Select-string "^[a-zA-Z0-9_]*=" | ForEach-Object { + $s = $_ -split "=",2 + $name = $s[0] + $value = $s[1] + $previous = (Get-Item env:$name -ErrorAction SilentlyContinue).Value + if ($value -ne $previous) { + $PreviousEnv[$name] = $previous + Set-Item env:$name $value + } + } + + # Build using the other architecture. + meson setup --backend vs2019 --buildtype release --default-library both $BuildDir\Release-${OtherArch} $RepoDir + meson setup --backend vs2019 --buildtype debug --default-library both $BuildDir\Debug-${OtherArch} $RepoDir + + meson compile -C $BuildDir\Release-${OtherArch} + meson compile -C $BuildDir\Debug-${OtherArch} + + # Restore previous environment variables. + $PreviousEnv.GetEnumerator() | ForEach-Object { + $name = $_.Name + Set-Item env:$name $_.Value + } +} # Build the binary installer. -# Remove /DArch when we can build 32 and 64-bit versions at the same time. Write-Output "Building installer ..." & $NSIS /V2 ` - /DProductName=librist ` /DVersion=$Version ` /DVersionInfo=$VersionInfo ` /DOutputName=librist${ArchName}-${Version} ` /DArch=$LocalArch ` /DScriptDir=$ScriptDir ` /DRepoDir=$RepoDir ` /DBuildDir=$BuildDir ` /DInstallerDir=$InstallerDir ` "$ScriptDir\librist.nsi" + /DProductName=librist ` /DVersion=$Version ` /DVersionInfo=$VersionInfo ` /DScriptDir=$ScriptDir ` /DRepoDir=$RepoDir ` /DBuildDir=$BuildDir ` /DInstallerDir=$InstallerDir ` "$ScriptDir\librist.nsi" Exit-Script -NoPause:$NoPause diff --git a/win/cross-win32.txt b/win/cross-win32.txt deleted file mode 100644 index b51fb4f..0000000 --- a/win/cross-win32.txt +++ /dev/null @@ -1,5 +0,0 @@ -[host_machine] -system = 'windows' -cpu_family = 'x86' -cpu = 'i686' -endian = 'little' diff --git a/win/cross-win64.txt b/win/cross-win64.txt deleted file mode 100644 index 9dc365b..0000000 --- a/win/cross-win64.txt +++ /dev/null @@ -1,5 +0,0 @@ -[host_machine] -system = 'windows' -cpu_family = 'x86_64' -cpu = 'x86_64' -endian = 'little' diff --git a/win/librist.props b/win/librist-common.props similarity index 96% rename from win/librist.props rename to win/librist-common.props index 23d03c4..535506c 100644 --- a/win/librist.props +++ b/win/librist-common.props @@ -1,6 +1,6 @@ - + diff --git a/win/librist-dll.props b/win/librist-dll.props index bd7e787..299d545 100644 --- a/win/librist-dll.props +++ b/win/librist-dll.props @@ -6,7 +6,7 @@ librist.lib - + diff --git a/win/librist-static.props b/win/librist-static.props index 99e67c6..4b43aad 100644 --- a/win/librist-static.props +++ b/win/librist-static.props @@ -6,5 +6,5 @@ librist.a - + diff --git a/win/librist.nsi b/win/librist.nsi index b79a5ed..df4806e 100644 --- a/win/librist.nsi +++ b/win/librist.nsi @@ -57,7 +57,7 @@ VIAddVersionKey FileVersion "${VersionInfo}" VIAddVersionKey FileDescription "RIST Installer" ; Name of binary installer file. -OutFile "${InstallerDir}\${OutputName}.exe" +OutFile "${InstallerDir}\${ProductName}-${Version}.exe" ; Generate a Unicode installer (default is ANSI). Unicode true @@ -120,26 +120,21 @@ Section "Install" ; Visual Studio property files. SetOutPath "$INSTDIR" File /oname=COPYING.txt "${RepoDir}\COPYING" - File "${ScriptDir}\librist.props" + File "${ScriptDir}\librist-common.props" File "${ScriptDir}\librist-dll.props" File "${ScriptDir}\librist-static.props" + Delete "${ScriptDir}\librist.props" ; Header files. CreateDirectory "$INSTDIR\include" CreateDirectory "$INSTDIR\include\librist" SetOutPath "$INSTDIR\include\librist" File "${RepoDir}\include\librist\*.h" - - ; Libraries and tools. - CreateDirectory "$INSTDIR\lib" - CreateDirectory "$INSTDIR\bin" - -!ifndef Arch - ; Multiple architectures. - SetOutPath "$INSTDIR\include\librist" File "${BuildDir}\Release-x64\include\librist\*.h" File "${BuildDir}\Release-x64\include\vcs_version.h" + ; Libraries. + CreateDirectory "$INSTDIR\lib" CreateDirectory "$INSTDIR\lib\Release-x64" SetOutPath "$INSTDIR\lib\Release-x64" File "${BuildDir}\Release-x64\librist.dll" @@ -164,37 +159,14 @@ Section "Install" File "${BuildDir}\Debug-Win32\librist.lib" File "${BuildDir}\Debug-Win32\librist.a" + ; Tools. + CreateDirectory "$INSTDIR\bin" SetOutPath "$INSTDIR\bin" - File "${BuildDir}\Release-x64\librist.dll" - File "${BuildDir}\Release-x64\tools\rist2rist.exe" - File "${BuildDir}\Release-x64\tools\ristreceiver.exe" - File "${BuildDir}\Release-x64\tools\ristsender.exe" - File "${BuildDir}\Release-x64\tools\ristsrppasswd.exe" -!else - ; Single architecture. - SetOutPath "$INSTDIR\include\librist" - File "${BuildDir}\Release-${Arch}\include\librist\*.h" - File "${BuildDir}\Release-${Arch}\include\vcs_version.h" - - CreateDirectory "$INSTDIR\lib\Release-${Arch}" - SetOutPath "$INSTDIR\lib\Release-${Arch}" - File "${BuildDir}\Release-${Arch}\librist.dll" - File "${BuildDir}\Release-${Arch}\librist.lib" - File "${BuildDir}\Release-${Arch}\librist.a" - - CreateDirectory "$INSTDIR\lib\Debug-${Arch}" - SetOutPath "$INSTDIR\lib\Debug-${Arch}" - File "${BuildDir}\Debug-${Arch}\librist.dll" - File "${BuildDir}\Debug-${Arch}\librist.lib" - File "${BuildDir}\Debug-${Arch}\librist.a" - - SetOutPath "$INSTDIR\bin" - File "${BuildDir}\Release-${Arch}\librist.dll" - File "${BuildDir}\Release-${Arch}\tools\rist2rist.exe" - File "${BuildDir}\Release-${Arch}\tools\ristreceiver.exe" - File "${BuildDir}\Release-${Arch}\tools\ristsender.exe" - File "${BuildDir}\Release-${Arch}\tools\ristsrppasswd.exe" -!endif + File "${BuildDir}\Release-Win32\librist.dll" + File "${BuildDir}\Release-Win32\tools\rist2rist.exe" + File "${BuildDir}\Release-Win32\tools\ristreceiver.exe" + File "${BuildDir}\Release-Win32\tools\ristsender.exe" + File "${BuildDir}\Release-Win32\tools\ristsrppasswd.exe" ; Add an environment variable to installation root. WriteRegStr HKLM ${EnvironmentKey} "LIBRIST" "$INSTDIR" @@ -207,6 +179,8 @@ Section "Install" ; Declare uninstaller in "Add/Remove Software" control panel WriteRegStr HKLM "${UninstallKey}" "DisplayName" "${ProductName}" + WriteRegStr HKLM "${UninstallKey}" "Publisher" "VideoLAN and librist" + WriteRegStr HKLM "${UninstallKey}" "URLInfoAbout" "https://code.videolan.org/rist/librist" WriteRegStr HKLM "${UninstallKey}" "DisplayVersion" "${Version}" WriteRegStr HKLM "${UninstallKey}" "DisplayIcon" "$INSTDIR\Uninstall.exe" WriteRegStr HKLM "${UninstallKey}" "UninstallString" "$INSTDIR\Uninstall.exe" @@ -240,7 +214,7 @@ Section "Uninstall" RMDir /r "$0\include" RMDir /r "$0\bin" RMDir /r "$0\lib" - Delete "$0\librist.props" + Delete "$0\librist-common.props" Delete "$0\librist-dll.props" Delete "$0\librist-static.props" Delete "$0\COPYING.txt"