Skip to content

Commit

Permalink
Make changes to windows build environment to support GitHub Actions
Browse files Browse the repository at this point in the history
Historically, the build-windows-x64.sh script was responsible to prepare the
build environment, to compile the source code and to generate the BitRock
based installer. This is now changed to using GitHub Actions based workflow
and the supporting powershell scripts. The workflow resides in a separate
repository whereas the build scripts and installer code resides in this
repository.

Summary of the Changes:
- remove build-windows-x64.sh as it is no more needed, instead add
new scripts compile.ps1, prepare-staging, compile-system-stats
- packages-win64.txt contains 3rd party libs name and versions.
- version.txt contains versions of PG, LP, stackbuilder and pgAdmin4
- update the project files to suite the newer Visual Studio
- additional fixes required in installer XML

DBP-858, Manika Singhal, --Tested by Manika Singhal --Reviewed by Sandeep Thakkar, 
Srinu Perabattula and Kritika Agarwal
  • Loading branch information
Manika-EDB authored Jul 26, 2024
1 parent 93957bf commit 57b0e11
Show file tree
Hide file tree
Showing 23 changed files with 1,239 additions and 2,013 deletions.
784 changes: 0 additions & 784 deletions server/build-windows-x64.sh

This file was deleted.

14 changes: 14 additions & 0 deletions server/generate-sources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /bin/sh

set -xeu

NAME=postgresql

: ${VERSION:?The VERSION environment variable is required}

WORKDIR=$(pwd)/src
cd ${WORKDIR}
TARNAME="${NAME}-${VERSION}.${EXTRA_VERSION:-}"
wget ${URL}
md5sum "${TARNAME}.tar.bz2" > "${TARNAME}.tar.bz2.md5"
mv ${TARNAME}.tar.bz2 ../
32 changes: 30 additions & 2 deletions server/installer.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1266,12 +1266,16 @@ EOF
</ruleList>
</actionGroup>

<!-- WIN: Remove Wxwidgets 3.1.7 files in upgrade -->
<!-- WIN: Remove Wxwidgets files in upgrade -->
<actionGroup>
<actionList>
<logMessage text="${msg(info.wxwidgets.remove)}" />
<deleteFile path="${installdir}${slash}bin${slash}wx*317*.dll" />
<deleteFile path="${installdir}${slash}bin${slash}wx*.dll" />
</actionList>
<actionList>
<logMessage text="${msg(info.wxwidgets.remove)}" />
<deleteFile path="${installdir}${slash}lib${slash}wx*.lib" />
</actionList>
<ruleList>
<compareText text="${platform_name}" logic="contains" value="windows" />
<isTrue value="${IsUpgrade}"/>
Expand Down Expand Up @@ -1822,6 +1826,30 @@ EOF
</preInstallationActionList>

<postInstallationActionList>
<!-- Delete Add/Remove Programs Entry From Old Windows Installation -->
<actionGroup>
<actionList>
<registryDelete>
<key>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${project.fullName} 16.1</key>
<showMessageOnError>0</showMessageOnError>
<abortOnError>0</abortOnError>
</registryDelete>
<registryDelete>
<key>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${project.fullName} 16.2</key>
<showMessageOnError>0</showMessageOnError>
<abortOnError>0</abortOnError>
</registryDelete>
</actionList>
<ruleList>
<compareText>
<logic>equals</logic>
<text>${platform_name}</text>
<value>windows</value>
</compareText>
<isTrue value="${IsUpgrade}"/>
</ruleList>
</actionGroup>

<!-- Remove the pg_log directory in upgrademode -->
<actionGroup>
<actionList>
Expand Down
112 changes: 112 additions & 0 deletions server/license.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
WD="$(dirname "$PWD")"

# $1 - Component Name
generate_3rd_party_license()
{
export ComponentName="$1"
export ListGeneratorScriptFileWin="$WD/list-libs-windows.sh"
export ListGeneratorScriptFileJar="$WD/list-jars.sh"
export ListPipModules="$WD/list_pip_libs.sh"
export ListJSScripts="$WD/list_js_libs.sh"
export ListpgAdminFiles="$WD/list_pgadmin_files.sh"
export blnIsWindows=false
export LibListDir="3rd_party_libraries_list"
export CurrentDir="$PWD"
export ComponentFile="$PWD/${ComponentName}_3rd_party_licenses.txt"
export LicenseTypePath="$WD/resources/3rd_party_license_types"
export LIBPQPattern="libpq"

echo "[$FUNCNAME] Component Name: $ComponentName"
echo "[$FUNCNAME] Library List File: $Lib_List_File"

echo "[$FUNCNAME] Component File: $ComponentFile"


mkdir -p "$WD/output/$LibListDir"

blnIsWindows=true
ListGeneratorScriptFile="$ListGeneratorScriptFileWin"
CurrentPlatform="windows"

export Lib_List_File="$WD/output/$LibListDir/${ComponentName}_${CurrentPlatform}_libs.txt"

if [[ $ComponentName != "server" || $ComponentName != "commandlinetools" ]];
then
LIBPQPattern=xyz${LIBPQPattern}abc
fi

TempFile=$(mktemp)
$ListGeneratorScriptFile >> $TempFile
$ListGeneratorScriptFileJar >> $TempFile
$ListJSScripts >> $TempFile

cat $TempFile | xargs -I{} grep -w {} $WD/resources/files_to_project_map.txt | sort -u | cut -f1 | grep -v $LIBPQPattern | xargs -I{} echo "awk '/\<{}\>/ {print \$1\" {}\"}' $WD/resources/license_to_project_map.txt" | sh | sort -u > $Lib_List_File

awk '\
BEGIN \
{ \
prevLicenseName=""; \
listProject=""; \
system("rm -f "ENVIRON["ComponentFile"]); \
} \
{ \
gsub(/^project_/, "", $2); \
\
if ( $1 == prevLicenseName ) \
{ \
listProject=listProject", "$2; \
} \
else \
{ \
if ( listProject != "" ) \
{ \
system("echo -e \"==================\n"listProject" license\n==================\" >> "ENVIRON["ComponentFile"]); \
system("cat "ENVIRON["LicenseTypePath"]"/"prevLicenseName" >> "ENVIRON["ComponentFile"]); \
system("echo >> "ENVIRON["ComponentFile"]); \
} \
listProject=$2; \
prevLicenseName=$1; \
} \
} \
END \
{ \
if ( listProject != "" ) \
{ \
system("echo -e \"==================\n"listProject" license\n==================\" >> "ENVIRON["ComponentFile"]); \
system("cat "ENVIRON["LicenseTypePath"]"/"prevLicenseName" >> "ENVIRON["ComponentFile"]); \
system("echo >> "ENVIRON["ComponentFile"]); \
} \
}' $Lib_List_File

if [[ ! -s $ComponentFile ]];
then
rm -f $ComponentFile
fi

echo "cat componentfile"
cat $ComponentFile

if [[ -f $ComponentFile ]];
then
if [[ $blnIsWindows == true ]];
then
unix2dos $ComponentFile || _die "Unable to convert 3rd party license file [$ComponentFile] to dos format."
else
dos2unix $ComponentFile || _die "Unable to convert 3rd party license file [$ComponentFile] to unix format."
fi

chmod 444 $ComponentFile
fi
}

pushd ../installer/server/staging/windows-x64/commandlinetools
generate_3rd_party_license "commandlinetools"
popd

pushd ../installer/server/staging/windows-x64/stackbuilder
generate_3rd_party_license "StackBuilder"
popd

pushd ../installer/server/staging/windows-x64/pgadmin4
generate_3rd_party_license "pgAdmin"
popd
13 changes: 13 additions & 0 deletions server/packages-win64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
curl-8.8.0-windows-x64.tar.bz2
zstd-1.5.6-windows-x64.tar.bz2
lz4-1.9.4-windows-x64.tar.bz2
libxml2-2.11.8-windows-x64.tar.bz2
libxslt-1.1.39-windows-x64.tar.bz2
iconv-1.17-windows-x64.tar.bz2
zlib-1.3.1-windows-x64.tar.bz2
icu-67-1-windows-x64.tar.bz2
uuid-1.6.2-windows-x64.tar.bz2
wxwidgets-3.2.4-windows-x64.tar.bz2
gettext-0.19.8-windows-x64.tar.bz2
openssl-3.0.14-windows-x64.tar.bz2
libwinpthread-1.0.0-windows-x64.tar.bz2
176 changes: 0 additions & 176 deletions server/scripts/windows/build-pgadmin.bat.in

This file was deleted.

13 changes: 13 additions & 0 deletions server/scripts/windows/compile-system_stats.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Powershell script to compile system_stats

# Setting variables
$vc_bat_file="$(pwd)\packaging-config\server\scripts\windows\vc-build-x64.bat"
$project_file="$(pwd)\system_stats\system_stats.vcxproj"
$out_dir="$(pwd)\system_stats\x64\Release\"

# Compilation
Invoke-Expression -Command "$vc_bat_file $project_file Release x64 $out_dir v143" || exit 1

# Copy system-stats dlls to correct place
Copy-Item "$(pwd)\system_stats\x64\Release\system_stats.dll" "$(pwd)\binaries-archive\pgsql\lib"
Copy-Item "$(pwd)\system_stats\x64\Release\system_stats.dll" "$(pwd)\packaging-config\server"
Loading

0 comments on commit 57b0e11

Please sign in to comment.