2019-01-03 08:33:30 -06:00
|
|
|
@ECHO off
|
|
|
|
SETLOCAL
|
|
|
|
|
|
|
|
SET WD=%CD%
|
2020-06-01 03:52:24 -05:00
|
|
|
SET "BUILDROOT=%WD%\win-build"
|
|
|
|
SET "DISTROOT=%WD%\dist"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
SET CMDOPTIONS=""
|
|
|
|
IF "%1" == "clean" SET CMDOPTIONS="VALID"
|
|
|
|
IF "%1" == "" SET CMDOPTIONS="VALID"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT %CMDOPTIONS%=="VALID" (
|
2019-01-03 08:33:30 -06:00
|
|
|
GOTO USAGE
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
IF "%1" == "clean" (
|
2019-01-03 08:33:30 -06:00
|
|
|
CALL :CLEAN
|
|
|
|
EXIT /B %ERRORLEVEL%
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
set "ARCHITECTURE=x64"
|
|
|
|
if "%Platform%" == "X86" (
|
|
|
|
set "ARCHITECTURE=x86"
|
|
|
|
)
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
REM Main build sequence
|
|
|
|
CALL :SET_ENVIRONMENT
|
|
|
|
CALL :VALIDATE_ENVIRONMENT || EXIT /B 1
|
|
|
|
CALL :CLEAN || EXIT /B 1
|
|
|
|
CALL :CREATE_VIRTUAL_ENV || EXIT /B 1
|
|
|
|
CALL :CREATE_RUNTIME_ENV || EXIT /B 1
|
|
|
|
CALL :CREATE_PYTHON_ENV || EXIT /B 1
|
|
|
|
CALL :CLEANUP_ENV || EXIT /B 1
|
|
|
|
CALL :CREATE_INSTALLER || EXIT /B 1
|
|
|
|
CALL :SIGN_INSTALLER || EXIT /B 1
|
|
|
|
|
|
|
|
EXIT /B %ERRORLEVEL%
|
|
|
|
REM Main build sequence Ends
|
|
|
|
|
|
|
|
|
|
|
|
:CLEAN
|
|
|
|
ECHO Removing build directory...
|
2020-06-01 03:52:24 -05:00
|
|
|
IF EXIST "%BUILDROOT%" RD "%BUILDROOT%" /S /Q > nul || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Removing temp build directory...
|
|
|
|
IF EXIST "%WD%\pkg\win32\Output" rd "%WD%\pkg\win32\Output" /S /Q > nul || EXIT /B 1
|
|
|
|
|
|
|
|
ECHO Removing installer configuration script...
|
|
|
|
IF EXIST DEL /q "%WD%\pkg\win32\installer.iss" > nul || EXIT /B 1
|
|
|
|
|
|
|
|
EXIT /B 0
|
|
|
|
|
|
|
|
|
|
|
|
:SET_ENVIRONMENT
|
|
|
|
ECHO Configuring the environment...
|
2020-06-01 03:52:24 -05:00
|
|
|
IF "%PGADMIN_PYTHON_DIR%" == "" SET "PGADMIN_PYTHON_DIR=C:\Python38"
|
|
|
|
IF "%PGADMIN_QT_DIR%" == "" SET "PGADMIN_QT_DIR=C:\Qt\5.14.2\msvc2017_64"
|
|
|
|
IF "%PGADMIN_POSTGRES_DIR%" == "" SET "PGADMIN_POSTGRES_DIR=C:\Program Files (x86)\PostgreSQL\12"
|
|
|
|
IF "%PGADMIN_INNOTOOL_DIR%" == "" SET "PGADMIN_INNOTOOL_DIR=C:\Program Files (x86)\Inno Setup 6"
|
|
|
|
IF "%PGADMIN_VCREDIST_DIR%" == "" SET "PGADMIN_VCREDIST_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Redist\MSVC\14.16.27012"
|
|
|
|
IF "%PGADMIN_SIGNTOOL_DIR%" == "" SET "PGADMIN_SIGNTOOL_DIR=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
REM Set REDIST_NAME (the filename)
|
|
|
|
set "VCREDIST_FILE=vcredist_%ARCHITECTURE%.exe"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
REM Set additional variables we need
|
|
|
|
FOR /F "tokens=3" %%a IN ('findstr /C:"APP_RELEASE =" %WD%\web\config.py') DO SET APP_MAJOR=%%a
|
|
|
|
FOR /F "tokens=3" %%a IN ('findstr /C:"APP_REVISION =" %WD%\web\config.py') DO SET APP_MINOR=%%a
|
|
|
|
FOR /F "tokens=3" %%a IN ('findstr /C:"APP_SUFFIX =" %WD%\web\config.py') DO SET APP_VERSION_SUFFIX=%%a
|
2019-01-03 08:33:30 -06:00
|
|
|
REM remove single quote from the string
|
|
|
|
SET APP_VERSION_SUFFIX=%APP_VERSION_SUFFIX:'=%
|
|
|
|
SET APP_NAME=""
|
2020-06-01 03:52:24 -05:00
|
|
|
FOR /F "tokens=2* DELims='" %%a IN ('findstr /C:"APP_NAME =" web\config.py') DO SET APP_NAME=%%a
|
|
|
|
FOR /f "tokens=1 DELims=." %%G IN ('%PGADMIN_PYTHON_DIR%/python.exe -c "print('%APP_NAME%'.lower().replace(' ', ''))"') DO SET APP_SHORTNAME=%%G
|
2019-01-03 08:33:30 -06:00
|
|
|
SET APP_VERSION=%APP_MAJOR%.%APP_MINOR%
|
|
|
|
SET INSTALLERNAME=%APP_SHORTNAME%-%APP_MAJOR%.%APP_MINOR%-%APP_VERSION_SUFFIX%-%ARCHITECTURE%.exe
|
|
|
|
IF "%APP_VERSION_SUFFIX%" == "" SET INSTALLERNAME=%APP_SHORTNAME%-%APP_MAJOR%.%APP_MINOR%-%ARCHITECTURE%.exe
|
|
|
|
|
|
|
|
REM get Python version for the runtime build ex. 2.7.1 will be 27
|
2020-06-01 03:52:24 -05:00
|
|
|
FOR /f "tokens=1 DELims=." %%G IN ('%PGADMIN_PYTHON_DIR%/python.exe -c "import sys; print(sys.version.split(' ')[0])"') DO SET PYTHON_MAJOR=%%G
|
|
|
|
FOR /f "tokens=2 DELims=." %%G IN ('%PGADMIN_PYTHON_DIR%/python.exe -c "import sys; print(sys.version.split(' ')[0])"') DO SET PYTHON_MINOR=%%G
|
2019-01-03 08:33:30 -06:00
|
|
|
SET "PYTHON_VERSION=%PYTHON_MAJOR%%PYTHON_MINOR%"
|
|
|
|
|
|
|
|
EXIT /B 0
|
|
|
|
|
|
|
|
|
|
|
|
:VALIDATE_ENVIRONMENT
|
|
|
|
ECHO ****************************************************************
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO * Build summary
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO ****************************************************************
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO Build path: %BUILDROOT%
|
|
|
|
ECHO Output directory: %DISTROOT%
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Installer name: %INSTALLERNAME%
|
|
|
|
ECHO.
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO Python directory: %PGADMIN_PYTHON_DIR%
|
|
|
|
ECHO Python DLL: %PGADMIN_PYTHON_DIR%\Python%PYTHON_VERSION%.dll
|
|
|
|
ECHO Python version: %PYTHON_MAJOR%.%PYTHON_MINOR%
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO.
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO Qt directory: %PGADMIN_QT_DIR%
|
|
|
|
ECHO PostgreSQL directory: %PGADMIN_POSTGRES_DIR%
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO.
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO VC++ redist directory: %PGADMIN_VCREDIST_DIR%
|
|
|
|
ECHO VC++ redist file: %VCREDIST_FILE%
|
|
|
|
ECHO InnoTool directory: %PGADMIN_INNOTOOL_DIR%
|
|
|
|
ECHO signtool directory: %PGADMIN_SIGNTOOL_DIR%
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO.
|
|
|
|
ECHO App version: %APP_VERSION%
|
|
|
|
ECHO App version suffix: %APP_VERSION_SUFFIX%
|
|
|
|
ECHO App short name: %APP_SHORTNAME%
|
|
|
|
ECHO App name: %APP_NAME%
|
|
|
|
ECHO ****************************************************************
|
|
|
|
|
|
|
|
ECHO Checking the environment...
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%PGADMIN_INNOTOOL_DIR%" (
|
|
|
|
ECHO !PGADMIN_INNOTOOL_DIR! does not exist
|
|
|
|
ECHO Please install InnoTool and set the PGADMIN_INNOTOOL_DIR environment variable.
|
2019-01-03 08:33:30 -06:00
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%PGADMIN_VCREDIST_DIR%" (
|
|
|
|
ECHO !PGADMIN_VCREDIST_DIR! does not exist
|
|
|
|
ECHO Please install Microsoft Visual studio and set the PGADMIN_VCREDIST_DIR environment variable.
|
2019-01-03 08:33:30 -06:00
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%PGADMIN_QT_DIR%" (
|
|
|
|
ECHO !PGADMIN_QT_DIR! does not exist.
|
|
|
|
ECHO Please install Qt and set the PGADMIN_QT_DIR environment variable.
|
2019-01-03 08:33:30 -06:00
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%PGADMIN_QT_DIR%\bin\qmake.exe" (
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO !QMAKE! does not exist.
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO Please install Qt and set the PGADMIN_QT_DIR environment variable.
|
2019-01-03 08:33:30 -06:00
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%PGADMIN_PYTHON_DIR%" (
|
|
|
|
ECHO !PGADMIN_PYTHON_DIR! does not exist.
|
|
|
|
ECHO Please install Python and set the PGADMIN_PYTHON_DIR environment variable.
|
2019-01-03 08:33:30 -06:00
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%PGADMIN_PYTHON_DIR%\Python%PYTHON_VERSION%.dll" (
|
|
|
|
ECHO !PGADMIN_PYTHON_DIR!\Python!PYTHON_VERSION!.dll does not exist.
|
|
|
|
ECHO Please check your Python installation is complete.
|
2019-01-03 08:33:30 -06:00
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%PGADMIN_POSTGRES_DIR%" (
|
|
|
|
ECHO !PGADMIN_POSTGRES_DIR! does not exist.
|
|
|
|
ECHO Please install PostgreSQL and set the PGADMIN_POSTGRES_DIR environment variable.
|
2019-01-03 08:33:30 -06:00
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%PGADMIN_PYTHON_DIR%\Scripts\virtualenv.exe" (
|
|
|
|
ECHO !PGADMIN_PYTHON_DIR!\Scripts\virtualenv.exe does not exist.
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Please install the virtualenv package in Python.
|
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
SET "PATH=%PGADMIN_POSTGRES_DIR%\bin;%PATH%"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
EXIT /B 0
|
|
|
|
|
|
|
|
|
|
|
|
:CREATE_VIRTUAL_ENV
|
|
|
|
ECHO Creating virtual environment...
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%BUILDROOT%" MKDIR "%BUILDROOT%"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
CD "%BUILDROOT%"
|
2020-06-09 10:28:25 -05:00
|
|
|
|
|
|
|
REM Note that we must use virtualenv.exe here, as the venv module doesn't allow python.exe to relocate.
|
|
|
|
"%PGADMIN_PYTHON_DIR%\Scripts\virtualenv.exe" venv
|
2019-01-03 08:33:30 -06:00
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
XCOPY /S /I /E /H /Y "%PGADMIN_PYTHON_DIR%\DLLs" "%BUILDROOT%\venv\DLLs" > nul || EXIT /B 1
|
|
|
|
XCOPY /S /I /E /H /Y "%PGADMIN_PYTHON_DIR%\Lib" "%BUILDROOT%\venv\Lib" > nul || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO Activating virtual environment - %BUILDROOT%\venv...
|
|
|
|
CALL "%BUILDROOT%\venv\Scripts\activate" || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Installing dependencies...
|
|
|
|
CALL pip install -r "%WD%\requirements.txt" || EXIT /B 1
|
|
|
|
CALL pip install sphinx || EXIT /B 1
|
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
REM If this is Python 3.6+, we need to remove the hack above or it will break qmake. Sigh.
|
|
|
|
IF %PYTHON_VERSION% GEQ 36 SET CL=
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
CD %WD%
|
|
|
|
EXIT /B 0
|
|
|
|
|
|
|
|
|
|
|
|
:CREATE_RUNTIME_ENV
|
2020-06-01 03:52:24 -05:00
|
|
|
MKDIR "%BUILDROOT%\runtime"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
CD "%WD%\web"
|
|
|
|
|
|
|
|
ECHO Installing javascript dependencies...
|
|
|
|
CALL yarn install || EXIT /B 1
|
|
|
|
|
|
|
|
ECHO Bundling javascript...
|
|
|
|
CALL yarn run bundle || EXIT /B 1
|
|
|
|
|
|
|
|
ECHO Removing webpack caches...
|
|
|
|
RD /Q /S "%WD%\web\pgadmin\static\js\generated\.cache" 1> nul 2>&1
|
|
|
|
|
|
|
|
ECHO Copying web directory...
|
2020-06-01 03:52:24 -05:00
|
|
|
XCOPY /S /I /E /H /Y "%WD%\web" "%BUILDROOT%\web" > nul || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Cleaning up unnecessary .pyc and .pyo files...
|
2020-06-01 03:52:24 -05:00
|
|
|
FOR /R "%BUILDROOT%\web" %%f in (*.pyc *.pyo) do DEL /q "%%f" 1> nul 2>&1
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Removing tests, Python caches and node modules...
|
2020-06-01 03:52:24 -05:00
|
|
|
FOR /R "%BUILDROOT%\web" %%f in (tests feature_tests __pycache__ node_modules) do RD /Q /S "%%f" 1> nul 2>&1
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Removing the test framework...
|
2020-06-01 03:52:24 -05:00
|
|
|
RD /Q /S "%BUILDROOT%\web\regression" 1> nul 2>&1
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Removing tools...
|
2020-06-01 03:52:24 -05:00
|
|
|
RD /Q /S "%BUILDROOT%\web\tools" 1> nul 2>&1
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Removing any existing configurations...
|
2020-06-01 03:52:24 -05:00
|
|
|
DEL /q "%BUILDROOT%\web\pgadmin4.db" 1> nul 2>&1
|
|
|
|
DEL /q "%BUILDROOT%\web\config_local.py" 1> nul 2>&1
|
2020-07-17 11:06:16 -05:00
|
|
|
|
|
|
|
ECHO Staging license files...
|
|
|
|
COPY "%WD%\LICENSE" "%BUILDROOT%\" > nul || EXIT /B 1
|
|
|
|
COPY "%WD%\DEPENDENCIES" "%BUILDROOT%\" > nul || EXIT /B 1
|
|
|
|
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Creating config_distro.py
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO SERVER_MODE = False > "%BUILDROOT%\web\config_distro.py"
|
|
|
|
ECHO HELP_PATH = '../../../docs/en_US/html/' >> "%BUILDROOT%\web\config_distro.py"
|
|
|
|
ECHO DEFAULT_BINARY_PATHS = { >> "%BUILDROOT%\web\config_distro.py"
|
|
|
|
ECHO 'pg': '$DIR/../runtime', >> "%BUILDROOT%\web\config_distro.py"
|
|
|
|
ECHO 'ppas': '' >> "%BUILDROOT%\web\config_distro.py"
|
|
|
|
ECHO } >> "%BUILDROOT%\web\config_distro.py"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Building docs...
|
2020-06-01 03:52:24 -05:00
|
|
|
MKDIR "%BUILDROOT%\docs\en_US\html"
|
2019-01-03 08:33:30 -06:00
|
|
|
CD "%WD%\docs\en_US"
|
2020-06-01 03:52:24 -05:00
|
|
|
CALL "%BUILDROOT%\venv\Scripts\python.exe" build_code_snippet.py || EXIT /B 1
|
|
|
|
CALL "%BUILDROOT%\venv\Scripts\sphinx-build.exe" "%WD%\docs\en_US" "%BUILDROOT%\docs\en_US\html" || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Removing Sphinx
|
|
|
|
CALL pip uninstall -y sphinx Pygments alabaster colorama docutils imagesize requests snowballstemmer
|
|
|
|
|
|
|
|
ECHO Assembling runtime environment...
|
|
|
|
CD "%WD%\runtime"
|
|
|
|
|
|
|
|
ECHO Running qmake...
|
2020-06-01 03:52:24 -05:00
|
|
|
CALL set "PGADMIN_PYTHON_DIR=%PGADMIN_PYTHON_DIR%" && "%PGADMIN_QT_DIR%\bin\qmake.exe" || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Cleaning the build directory...
|
2020-06-01 03:52:24 -05:00
|
|
|
CALL nmake clean || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Running make...
|
2020-06-01 03:52:24 -05:00
|
|
|
CALL nmake || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Staging pgAdmin4.exe...
|
2020-06-01 03:52:24 -05:00
|
|
|
COPY "%WD%\runtime\release\pgAdmin4.exe" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Staging Qt components...
|
2020-06-01 03:52:24 -05:00
|
|
|
COPY "%PGADMIN_QT_DIR%\bin\Qt5Core.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_QT_DIR%\bin\Qt5Gui.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_QT_DIR%\bin\Qt5Widgets.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_QT_DIR%\bin\Qt5Network.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_QT_DIR%\bin\Qt5Svg.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
MKDIR "%BUILDROOT%\runtime\platforms" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_QT_DIR%\plugins\platforms\qwindows.dll" "%BUILDROOT%\runtime\platforms" > nul || EXIT /B 1
|
|
|
|
MKDIR "%BUILDROOT%\runtime\imageformats" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_QT_DIR%\plugins\imageformats\qsvg.dll" "%BUILDROOT%\runtime\imageformats" > nul || EXIT /B 1
|
|
|
|
ECHO [Paths] > "%BUILDROOT%\runtime\qt.conf"
|
|
|
|
ECHO Plugins=plugins >> "%BUILDROOT%\runtime\qt.conf"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Staging PostgreSQL components...
|
2020-06-01 03:52:24 -05:00
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\libpq.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
IF "%ARCHITECTURE%" == "x64" (
|
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\libcrypto-1_1-x64.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\libssl-1_1-x64.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
2019-08-08 09:07:01 -05:00
|
|
|
) ELSE (
|
2020-06-01 03:52:24 -05:00
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\libcrypto-1_1.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\libssl-1_1.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
2019-08-08 09:07:01 -05:00
|
|
|
)
|
2020-06-01 03:52:24 -05:00
|
|
|
IF EXIST "%PGADMIN_POSTGRES_DIR%\bin\libintl-*.dll" COPY "%PGADMIN_POSTGRES_DIR%\bin\libintl-*.dll" "%BUILDROOT%\runtime" > nul
|
|
|
|
IF EXIST "%PGADMIN_POSTGRES_DIR%\bin\libiconv-*.dll" COPY "%PGADMIN_POSTGRES_DIR%\bin\libiconv-*.dll" "%BUILDROOT%\runtime" > nul
|
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\zlib.dll" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\pg_dump.exe" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\pg_dumpall.exe" "%BUILDROOT%\runtime" > nul || EXIT /B 1L%
|
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\pg_restore.exe" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_POSTGRES_DIR%\bin\psql.exe" "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Staging VC++ runtime...
|
2020-06-01 03:52:24 -05:00
|
|
|
MKDIR "%BUILDROOT%\installer" || EXIT /B 1
|
|
|
|
COPY "%PGADMIN_VCREDIST_DIR%\%VCREDIST_FILE%" "%BUILDROOT%\installer" > nul || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
CD %WD%
|
|
|
|
EXIT /B 0
|
|
|
|
|
|
|
|
|
|
|
|
:CREATE_PYTHON_ENV
|
|
|
|
ECHO Staging Python...
|
2020-06-01 03:52:24 -05:00
|
|
|
COPY %PGADMIN_PYTHON_DIR%\python%PYTHON_VERSION%.dll "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY %PGADMIN_PYTHON_DIR%\python.exe "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY %PGADMIN_PYTHON_DIR%\pythonw.exe "%BUILDROOT%\runtime" > nul || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Cleaning up unnecessary .pyc and .pyo files...
|
2020-06-01 03:52:24 -05:00
|
|
|
FOR /R "%BUILDROOT%\venv" %%f in (*.pyc *.pyo) do DEL /q "%%f" 1> nul 2>&1
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Removing tests...
|
2020-06-01 03:52:24 -05:00
|
|
|
FOR /R "%BUILDROOT%\venv\Lib" %%f in (test tests) do RD /Q /S "%%f" 1> nul 2>&1
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Removing TCL...
|
2020-06-01 03:52:24 -05:00
|
|
|
RD /Q /S "%BUILDROOT%\venv\tcl" 1> nul 2>&1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
EXIT /B 0
|
|
|
|
|
|
|
|
|
|
|
|
:CREATE_INSTALLER
|
|
|
|
ECHO Preparing for creation of windows installer...
|
2020-06-01 03:52:24 -05:00
|
|
|
IF NOT EXIST "%DISTROOT%" MKDIR "%DISTROOT%"
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Copying icon file...
|
2020-06-01 03:52:24 -05:00
|
|
|
COPY "%WD%\pkg\win32\Resources\pgAdmin4.ico" "%BUILDROOT%" > nul || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
CD "%WD%\pkg\win32"
|
|
|
|
|
|
|
|
ECHO Processing installer configuration script...
|
2020-06-01 03:52:24 -05:00
|
|
|
CALL "%PGADMIN_PYTHON_DIR%\python" "%WD%\pkg\win32\replace.py" "-i" "%WD%\pkg\win32\installer.iss.in" "-o" "%WD%\pkg\win32\installer.iss.in_stage1" "-s" MYAPP_NAME -r """%APP_NAME%"""
|
|
|
|
CALL "%PGADMIN_PYTHON_DIR%\python" "%WD%\pkg\win32\replace.py" "-i" "%WD%\pkg\win32\installer.iss.in_stage1" "-o" "%WD%\pkg\win32\installer.iss.in_stage2" "-s" MYAPP_FULLVERSION -r """%APP_VERSION%"""
|
|
|
|
CALL "%PGADMIN_PYTHON_DIR%\python" "%WD%\pkg\win32\replace.py" "-i" "%WD%\pkg\win32\installer.iss.in_stage2" "-o" "%WD%\pkg\win32\installer.iss.in_stage3" "-s" MYAPP_VERSION -r """v%APP_MAJOR%"""
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
SET ARCMODE=
|
2020-06-01 03:52:24 -05:00
|
|
|
IF "%ARCHITECTURE%" == "x64" (
|
2019-01-03 08:33:30 -06:00
|
|
|
set ARCMODE="x64"
|
|
|
|
)
|
2020-06-01 03:52:24 -05:00
|
|
|
CALL "%PGADMIN_PYTHON_DIR%\python" "%WD%\pkg\win32\replace.py" "-i" "%WD%\pkg\win32\installer.iss.in_stage3" "-o" "%WD%\pkg\win32\installer.iss.in_stage4" "-s" MYAPP_ARCHITECTURESMODE -r """%ARCMODE%"""
|
|
|
|
CALL "%PGADMIN_PYTHON_DIR%\python" "%WD%\pkg\win32\replace.py" "-i" "%WD%\pkg\win32\installer.iss.in_stage4" "-o" "%WD%\pkg\win32\installer.iss" "-s" MYAPP_VCDIST -r """%PGADMIN_VCREDIST_DIRNAME%\%VCREDIST_FILE%"""
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Cleaning up...
|
|
|
|
DEL /s "%WD%\pkg\win32\installer.iss.in_stage*" > nul
|
|
|
|
|
|
|
|
ECHO Creating windows installer using INNO tool...
|
2020-06-01 03:52:24 -05:00
|
|
|
CALL "%PGADMIN_INNOTOOL_DIR%\ISCC.exe" /q "%WD%\pkg\win32\installer.iss" || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
ECHO Renaming installer...
|
2020-06-01 03:52:24 -05:00
|
|
|
MOVE "%WD%\pkg\win32\Output\Setup.exe" "%DISTROOT%\%INSTALLERNAME%" > nul || EXIT /B 1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO Location - %DISTROOT%\%INSTALLERNAME%
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO Installer generated successfully.
|
|
|
|
|
|
|
|
CD %WD%
|
|
|
|
EXIT /B 0
|
|
|
|
|
|
|
|
|
|
|
|
:SIGN_INSTALLER
|
|
|
|
ECHO Attempting to sign the installer...
|
2020-06-01 03:52:24 -05:00
|
|
|
CALL "%PGADMIN_SIGNTOOL_DIR%\signtool.exe" sign /t http://timestamp.verisign.com/scripts/timstamp.dll "%DISTROOT%\%INSTALLERNAME%"
|
2019-01-03 08:33:30 -06:00
|
|
|
IF %ERRORLEVEL% NEQ 0 (
|
|
|
|
ECHO.
|
|
|
|
ECHO ************************************************************
|
|
|
|
ECHO * Failed to sign the installer
|
|
|
|
ECHO ************************************************************
|
|
|
|
PAUSE
|
|
|
|
)
|
|
|
|
|
|
|
|
EXIT /B 0
|
|
|
|
|
|
|
|
|
|
|
|
:CLEANUP_ENV
|
|
|
|
ECHO Cleaning the build environment...
|
2020-06-01 03:52:24 -05:00
|
|
|
RD "%BUILDROOT%\venv\Include" /S /Q 1> nul 2>&1
|
|
|
|
DEL /s "%BUILDROOT%\venv\pip-selfcheck.json" 1> nul 2>&1
|
2019-01-03 08:33:30 -06:00
|
|
|
|
|
|
|
EXIT /B 0
|
|
|
|
|
|
|
|
|
|
|
|
:USAGE
|
|
|
|
ECHO Invalid command line options.
|
2020-06-01 03:52:24 -05:00
|
|
|
ECHO Usage: "Make.bat [clean]"
|
2019-01-03 08:33:30 -06:00
|
|
|
ECHO.
|
|
|
|
|
|
|
|
EXIT /B 1
|
|
|
|
|