2016-06-08 06:29:21 -05:00
|
|
|
@ECHO off
|
|
|
|
SETLOCAL
|
2018-05-18 07:27:33 -05:00
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
SET WD=%CD%
|
|
|
|
SET "PGBUILDPATH=%WD%\win-build"
|
2018-05-18 07:27:33 -05:00
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
SET CMDOPTION=""
|
|
|
|
IF "%1" == "clean" SET CMDOPTION="VALID"
|
|
|
|
IF "%1" == "x86" SET CMDOPTION="VALID"
|
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
IF NOT %CMDOPTION%=="VALID" (
|
|
|
|
GOTO USAGE
|
|
|
|
)
|
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
SET ARCHITECTURE=%1
|
|
|
|
|
|
|
|
IF "%ARCHITECTURE%"=="clean" (
|
2018-05-18 07:27:33 -05:00
|
|
|
CALL :CLEAN
|
|
|
|
EXIT /B %ERRORLEVEL%
|
2016-06-08 06:29:21 -05:00
|
|
|
)
|
|
|
|
|
2017-02-28 11:02:01 -06:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
REM Main build sequence
|
|
|
|
CALL :SET_ENVIRONMENT
|
2018-05-22 07:39:03 -05:00
|
|
|
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
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
EXIT /B %ERRORLEVEL%
|
|
|
|
REM Main build sequence Ends
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
:CLEAN
|
|
|
|
ECHO Removing build directory...
|
2018-05-22 07:39:03 -05:00
|
|
|
IF EXIST "%PGBUILDPATH%" RD "%PGBUILDPATH%" /S /Q > nul || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Removing temp build directory...
|
2018-05-22 07:39:03 -05:00
|
|
|
IF EXIST "%WD%\pkg\win32\Output" rd "%WD%\pkg\win32\Output" /S /Q > nul || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Removing installer configuration script...
|
2018-05-22 07:39:03 -05:00
|
|
|
IF EXIST DEL /q "%WD%\pkg\win32\installer.iss" > nul || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
EXIT /B 0
|
2016-10-04 08:33:52 -05:00
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
:SET_ENVIRONMENT
|
|
|
|
ECHO Configuring the environment...
|
2018-02-05 09:32:14 -06:00
|
|
|
IF "%PYTHON_HOME%" == "" SET "PYTHON_HOME=C:\Python27"
|
|
|
|
IF "%PYTHON_DLL%" == "" SET "PYTHON_DLL=C:\Windows\SysWOW64\python27.dll"
|
|
|
|
IF "%QTDIR%" == "" SET "QTDIR=C:\Qt\5.9.1\mingw53_32"
|
2018-05-14 11:08:40 -05:00
|
|
|
IF "%MAKE%" == "" SET "MAKE=mingw32-make.exe"
|
2018-02-05 09:32:14 -06:00
|
|
|
IF "%PGDIR%" == "" SET "PGDIR=C:\Program Files (x86)\PostgreSQL\10"
|
|
|
|
IF "%INNOTOOL%" == "" SET "INNOTOOL=C:\Program Files (x86)\Inno Setup 5"
|
|
|
|
IF "%VCREDIST%" == "" SET "VCREDIST=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\1033\vcredist_x86.exe"
|
|
|
|
IF "%SIGNTOOL%" == "" SET "SIGNTOOL=C:\Program Files\Microsoft SDKs\Windows\v7.1A\Bin\signtool.exe"
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-16 10:15:44 -05:00
|
|
|
REM Set VCREDISTNAME (the filename)
|
|
|
|
for /f "delims=" %%i in ("%VCREDIST%") do set "VCREDISTNAME=%%~nxi"
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-16 10:15:44 -05:00
|
|
|
REM Set additional variables we need
|
2016-06-08 06:29:21 -05:00
|
|
|
SET "QMAKE=%QTDIR%\bin\qmake.exe"
|
2018-05-16 10:35:23 -05:00
|
|
|
FOR /F "tokens=4,5 delims=. " %%a IN ('%QMAKE% -v ^| findstr /B /C:"Using Qt version "') DO SET QT_VERSION=%%a.%%b
|
2018-05-18 07:27:33 -05:00
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
SET "VIRTUALENV=venv"
|
2018-05-16 10:35:23 -05:00
|
|
|
SET "TARGET_DIR=%WD%\dist"
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-16 10:31:41 -05:00
|
|
|
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
|
2016-06-08 06:29:21 -05:00
|
|
|
REM remove single quote from the string
|
2018-05-16 10:35:23 -05:00
|
|
|
SET APP_VERSION_SUFFIX=%APP_VERSION_SUFFIX:'=%
|
2016-06-08 06:29:21 -05:00
|
|
|
SET APP_NAME=""
|
|
|
|
FOR /F "tokens=2* DELims='" %%a IN ('findstr /C:"APP_NAME =" web\config.py') DO SET APP_NAME=%%a
|
2017-02-28 11:02:01 -06:00
|
|
|
FOR /f "tokens=1 DELims=." %%G IN ('%PYTHON_HOME%/python.exe -c "print('%APP_NAME%'.lower().replace(' ', ''))"') DO SET APP_SHORTNAME=%%G
|
2018-05-16 10:35:23 -05:00
|
|
|
SET APP_VERSION=%APP_MAJOR%.%APP_MINOR%
|
2018-05-16 10:26:00 -05:00
|
|
|
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
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
REM get Python version for the runtime build ex. 2.7.1 will be 27
|
2018-05-16 10:15:44 -05:00
|
|
|
FOR /f "tokens=1 DELims=." %%G IN ('%PYTHON_HOME%/python.exe -c "import sys; print(sys.version.split(' ')[0])"') DO SET PYTHON_MAJOR=%%G
|
|
|
|
FOR /f "tokens=2 DELims=." %%G IN ('%PYTHON_HOME%/python.exe -c "import sys; print(sys.version.split(' ')[0])"') DO SET PYTHON_MINOR=%%G
|
|
|
|
SET "PYTHON_VERSION=%PYTHON_MAJOR%%PYTHON_MINOR%"
|
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
EXIT /B 0
|
|
|
|
|
2018-05-16 10:15:44 -05:00
|
|
|
|
|
|
|
:VALIDATE_ENVIRONMENT
|
2016-06-08 06:29:21 -05:00
|
|
|
ECHO ****************************************************************
|
|
|
|
ECHO S U M M A R Y
|
|
|
|
ECHO ****************************************************************
|
2018-05-16 10:31:41 -05:00
|
|
|
ECHO Build path: %PGBUILDPATH%
|
2018-05-16 10:35:23 -05:00
|
|
|
ECHO Output directory: %TARGET_DIR%
|
2018-05-16 10:31:41 -05:00
|
|
|
ECHO Installer name: %INSTALLERNAME%
|
2018-05-16 10:15:44 -05:00
|
|
|
ECHO.
|
2018-05-16 10:31:41 -05:00
|
|
|
ECHO Python home: %PYTHON_HOME%
|
|
|
|
ECHO Python DLL: %PYTHON_DLL%
|
|
|
|
ECHO Python version: %PYTHON_VERSION%
|
|
|
|
ECHO Python major version: %PYTHON_MAJOR%
|
|
|
|
ECHO Python minor version: %PYTHON_MINOR%
|
2018-05-16 10:15:44 -05:00
|
|
|
ECHO.
|
2018-05-16 10:31:41 -05:00
|
|
|
ECHO Qt home: %QTDIR%
|
|
|
|
ECHO qmake executable: %QMAKE%
|
|
|
|
ECHO Qt version: %QT_VERSION%
|
2018-05-16 10:15:44 -05:00
|
|
|
ECHO.
|
2018-05-16 10:31:41 -05:00
|
|
|
ECHO PostgreSQL home: %PGDIR%
|
2018-05-16 10:15:44 -05:00
|
|
|
ECHO.
|
2018-05-16 10:31:41 -05:00
|
|
|
ECHO VC++ redistributable: %VCREDIST%
|
|
|
|
ECHO VC++ redistributable file: %VCREDISTNAME%
|
2018-05-16 10:15:44 -05:00
|
|
|
ECHO.
|
2018-05-16 10:31:41 -05:00
|
|
|
ECHO innotool executable: %INNOTOOL%
|
|
|
|
ECHO signtool executable: %SIGNTOOL%
|
2018-05-16 10:15:44 -05:00
|
|
|
ECHO.
|
2018-05-16 10:31:41 -05:00
|
|
|
ECHO App major version: %APP_MAJOR%
|
|
|
|
ECHO App minor version: %APP_MINOR%
|
|
|
|
ECHO App version: %APP_VERSION%
|
|
|
|
ECHO App version suffix: %APP_VERSION_SUFFIX%
|
|
|
|
ECHO App short name: %APP_SHORTNAME%
|
|
|
|
ECHO App name: %APP_NAME%
|
2016-06-08 06:29:21 -05:00
|
|
|
ECHO ****************************************************************
|
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Checking the environment...
|
|
|
|
IF NOT EXIST "%INNOTOOL%" (
|
2018-05-21 06:54:19 -05:00
|
|
|
ECHO !INNOTOOL! does not exist
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Please install Innotool and set the INNOTOOL environment variable.
|
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
IF NOT EXIST "%VCREDIST%" (
|
2018-05-21 06:54:19 -05:00
|
|
|
ECHO !VCREDIST! does not exist
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Please install Microsoft Visual studio and set the VCREDIST environment variable.
|
|
|
|
EXIT /B 1
|
|
|
|
)
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
IF NOT EXIST "%QTDIR%" (
|
2018-05-21 06:54:19 -05:00
|
|
|
ECHO !QTDIR! does not exist.
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Please install Qt and set the QTDIR environment variable.
|
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
IF NOT EXIST "%QMAKE%" (
|
2018-05-21 06:54:19 -05:00
|
|
|
ECHO !QMAKE! does not exist.
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Please install Qt and set the QTDIR environment variable.
|
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
IF NOT EXIST "%PYTHON_HOME%" (
|
2018-05-21 06:54:19 -05:00
|
|
|
ECHO !PYTHON_HOME! does not exist.
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Please install Python and set the PYTHON_HOME environment variable.
|
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
IF NOT EXIST "%PYTHON_DLL%" (
|
2018-05-21 06:54:19 -05:00
|
|
|
ECHO !PYTHON_DLL! does not exist.
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Please install Python and set the PYTHON_DLL environment variable.
|
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
IF NOT EXIST "%PGDIR%" (
|
2018-05-21 06:54:19 -05:00
|
|
|
ECHO !PGDIR! does not exist.
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Please install PostgreSQL and set the PGDIR environment variable.
|
|
|
|
EXIT /B 1
|
|
|
|
)
|
|
|
|
|
|
|
|
IF NOT EXIST "%PYTHON_HOME%\Scripts\virtualenv.exe" (
|
2018-05-21 06:54:19 -05:00
|
|
|
ECHO !PYTHON_HOME!\Scripts\virtualenv.exe does not exist.
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Please install the virtualenv package in Python.
|
|
|
|
EXIT /B 1
|
|
|
|
)
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-22 08:01:13 -05:00
|
|
|
SET "PATH=%PGDIR%\bin;%PATH%"
|
2018-05-18 07:27:33 -05:00
|
|
|
|
|
|
|
EXIT /B 0
|
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
:CREATE_VIRTUAL_ENV
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Creating virtual environment...
|
2016-06-08 06:29:21 -05:00
|
|
|
IF NOT EXIST "%PGBUILDPATH%" MKDIR "%PGBUILDPATH%"
|
2018-05-23 07:04:58 -05:00
|
|
|
|
|
|
|
REM If we're using VC++, and this is Python 3.6+, we need a hack for PyCrypto
|
|
|
|
IF "%MAKE%" == "nmake" (
|
2018-05-23 07:09:40 -05:00
|
|
|
IF %PYTHON_VERSION% GEQ 36 SET CL=-FI"%VCINSTALLDIR%\INCLUDE\stdint.h"
|
2018-05-23 07:04:58 -05:00
|
|
|
)
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
CD "%PGBUILDPATH%"
|
|
|
|
"%PYTHON_HOME%\Scripts\virtualenv.exe" "%VIRTUALENV%"
|
|
|
|
|
2018-08-29 05:33:25 -05:00
|
|
|
XCOPY /S /I /E /H /Y "%PYTHON_HOME%\DLLs" "%PGBUILDPATH%\%VIRTUALENV%\DLLs" > nul || EXIT /B 1
|
|
|
|
XCOPY /S /I /E /H /Y "%PYTHON_HOME%\Lib" "%PGBUILDPATH%\%VIRTUALENV%\Lib" > nul || EXIT /B 1
|
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Activating virtual environment - %PGBUILDPATH%\%VIRTUALENV%...
|
2018-05-22 07:39:03 -05:00
|
|
|
CALL "%PGBUILDPATH%\%VIRTUALENV%\Scripts\activate" || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
ECHO Installing dependencies...
|
2018-05-22 10:16:30 -05:00
|
|
|
CALL pip install -r "%WD%\requirements.txt" || EXIT /B 1
|
|
|
|
CALL pip install sphinx || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-23 07:04:58 -05:00
|
|
|
REM If we're using VC++, and this is Python 3.6+, we need to remove the hack
|
|
|
|
REM above or it will break qmake. Sigh.
|
|
|
|
IF "%MAKE%" == "nmake" (
|
2018-05-23 07:09:40 -05:00
|
|
|
IF %PYTHON_VERSION% GEQ 36 SET CL=
|
2018-05-23 07:04:58 -05:00
|
|
|
)
|
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
CD %WD%
|
2018-05-18 07:27:33 -05:00
|
|
|
EXIT /B 0
|
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
:CREATE_RUNTIME_ENV
|
2018-05-18 07:27:33 -05:00
|
|
|
MKDIR "%PGBUILDPATH%\runtime"
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2017-02-28 07:02:49 -06:00
|
|
|
CD "%WD%\web"
|
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Installing javascript dependencies...
|
2018-05-22 07:39:03 -05:00
|
|
|
CALL yarn install || EXIT /B 1
|
2018-05-18 07:27:33 -05:00
|
|
|
|
|
|
|
ECHO Bundling javascript...
|
2018-05-22 07:39:03 -05:00
|
|
|
CALL yarn run bundle || EXIT /B 1
|
2018-05-18 07:27:33 -05:00
|
|
|
|
|
|
|
ECHO Removing webpack caches...
|
|
|
|
RD /Q /S "%WD%\web\pgadmin\static\js\generated\.cache" 1> nul 2>&1
|
|
|
|
|
|
|
|
ECHO Copying web directory...
|
2018-05-22 07:39:03 -05:00
|
|
|
XCOPY /S /I /E /H /Y "%WD%\web" "%PGBUILDPATH%\web" > nul || EXIT /B 1
|
2018-05-18 07:27:33 -05:00
|
|
|
|
|
|
|
ECHO Cleaning up unnecessary .pyc and .pyo files...
|
|
|
|
FOR /R "%PGBUILDPATH%\web" %%f in (*.pyc *.pyo) do DEL /q "%%f" 1> nul 2>&1
|
|
|
|
ECHO Removing tests, Python caches and node modules...
|
|
|
|
FOR /R "%PGBUILDPATH%\web" %%f in (tests feature_tests __pycache__ node_modules) do RD /Q /S "%%f" 1> nul 2>&1
|
|
|
|
ECHO Removing the test framework...
|
|
|
|
RD /Q /S "%PGBUILDPATH%\web\regression" 1> nul 2>&1
|
|
|
|
ECHO Removing tools...
|
|
|
|
RD /Q /S "%PGBUILDPATH%\web\tools" 1> nul 2>&1
|
|
|
|
ECHO Removing any existing configurations...
|
|
|
|
DEL /q "%PGBUILDPATH%\web\pgadmin4.db" 1> nul 2>&1
|
|
|
|
DEL /q "%PGBUILDPATH%\web\config_local.py" 1> nul 2>&1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2016-06-16 07:07:04 -05:00
|
|
|
ECHO Creating config_distro.py
|
|
|
|
ECHO SERVER_MODE = False > "%PGBUILDPATH%\web\config_distro.py"
|
|
|
|
ECHO HELP_PATH = '../../../docs/en_US/html/' >> "%PGBUILDPATH%\web\config_distro.py"
|
2016-11-23 08:37:02 -06:00
|
|
|
ECHO DEFAULT_BINARY_PATHS = { >> "%PGBUILDPATH%\web\config_distro.py"
|
|
|
|
ECHO 'pg': '$DIR/../runtime', >> "%PGBUILDPATH%\web\config_distro.py"
|
|
|
|
ECHO 'ppas': '' >> "%PGBUILDPATH%\web\config_distro.py"
|
|
|
|
ECHO } >> "%PGBUILDPATH%\web\config_distro.py"
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
ECHO Building docs...
|
|
|
|
MKDIR "%PGBUILDPATH%\docs\en_US\html"
|
2017-02-28 07:02:49 -06:00
|
|
|
CD "%WD%\docs\en_US"
|
2018-05-22 10:16:30 -05:00
|
|
|
CALL "%PGBUILDPATH%\%VIRTUALENV%\Scripts\python.exe" build_code_snippet.py || EXIT /B 1
|
|
|
|
CALL "%PGBUILDPATH%\%VIRTUALENV%\Scripts\sphinx-build.exe" "%WD%\docs\en_US" "%PGBUILDPATH%\docs\en_US\html" || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
ECHO Removing Sphinx
|
2018-05-22 10:16:30 -05:00
|
|
|
CALL pip uninstall -y sphinx Pygments alabaster colorama docutils imagesize requests snowballstemmer
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-23 04:00:46 -05:00
|
|
|
IF %PYTHON_MAJOR% == 3 (
|
|
|
|
ECHO Fixing PyCrypto module for Python 3...
|
|
|
|
CALL "%PYTHON_HOME%\python" "%WD%\pkg\win32\replace.py" "-i" "%PGBUILDPATH%\%VIRTUALENV%\Lib\site-packages\Crypto\Random\OSRNG\nt.py" "-o" "%PGBUILDPATH%\%VIRTUALENV%\Lib\site-packages\Crypto\Random\OSRNG\nt.py.new" "-s" "import winrandom" -r "from . import winrandom"
|
|
|
|
MOVE /Y "%PGBUILDPATH%\%VIRTUALENV%\Lib\site-packages\Crypto\Random\OSRNG\nt.py.new" "%PGBUILDPATH%\%VIRTUALENV%\Lib\site-packages\Crypto\Random\OSRNG\nt.py"
|
|
|
|
)
|
2017-11-29 03:58:57 -06:00
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
ECHO Assembling runtime environment...
|
2017-02-28 07:02:49 -06:00
|
|
|
CD "%WD%\runtime"
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Running qmake...
|
2018-05-22 10:16:30 -05:00
|
|
|
CALL "%QMAKE%" || EXIT /B 1
|
2018-02-05 09:32:14 -06:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Cleaning the build directory...
|
2018-05-22 10:16:30 -05:00
|
|
|
CALL %MAKE% clean || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Running make...
|
2018-05-22 10:16:30 -05:00
|
|
|
CALL %MAKE% || EXIT /B 1
|
2018-02-05 09:32:14 -06:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Staging pgAdmin4.exe...
|
2018-05-22 07:39:03 -05:00
|
|
|
COPY "%WD%\runtime\release\pgAdmin4.exe" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
2018-02-05 09:32:14 -06:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Staging Qt components...
|
2018-05-22 07:39:03 -05:00
|
|
|
COPY "%QTDIR%\bin\Qt5Core.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%QTDIR%\bin\Qt5Gui.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%QTDIR%\bin\Qt5Widgets.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%QTDIR%\bin\Qt5Network.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
2018-05-22 08:40:44 -05:00
|
|
|
IF EXIST "%QTDIR%\bin\libgcc_s_dw2-1.dll" COPY "%QTDIR%\bin\libgcc_s_dw2-1.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
IF EXIST "%QTDIR%\bin\libstdc++-6.dll" COPY "%QTDIR%\bin\libstdc++-6.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
IF EXIST "%QTDIR%\bin\libwinpthread-1.dll" COPY "%QTDIR%\bin\libwinpthread-1.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
2018-05-22 07:39:03 -05:00
|
|
|
MKDIR "%PGBUILDPATH%\runtime\platforms" > nul || EXIT /B 1
|
|
|
|
COPY "%QTDIR%\plugins\platforms\qwindows.dll" "%PGBUILDPATH%\runtime\platforms" > nul || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
ECHO [Paths] > "%PGBUILDPATH%\runtime\qt.conf"
|
|
|
|
ECHO Plugins=plugins >> "%PGBUILDPATH%\runtime\qt.conf"
|
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Staging PostgreSQL components...
|
2018-05-22 07:39:03 -05:00
|
|
|
COPY "%PGDIR%\bin\libpq.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGDIR%\bin\ssleay32.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGDIR%\bin\libeay32.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
2018-05-22 08:40:44 -05:00
|
|
|
IF EXIST "%PGDIR%\bin\libintl-*.dll" COPY "%PGDIR%\bin\libintl-*.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
IF EXIST "%PGDIR%\bin\libiconv-*.dll" COPY "%PGDIR%\bin\libiconv-*.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
IF EXIST "%PGDIR%\bin\zlib.dll" COPY "%PGDIR%\bin\zlib.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
IF EXIST "%PGDIR%\bin\zlib1.dll" COPY "%PGDIR%\bin\zlib1.dll" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
2018-05-22 07:39:03 -05:00
|
|
|
COPY "%PGDIR%\bin\pg_dump.exe" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGDIR%\bin\pg_dumpall.exe" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1L%
|
|
|
|
COPY "%PGDIR%\bin\pg_restore.exe" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY "%PGDIR%\bin\psql.exe" "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
2018-05-18 07:27:33 -05:00
|
|
|
|
|
|
|
ECHO Staging VC++ runtime...
|
2018-05-22 07:39:03 -05:00
|
|
|
MKDIR "%PGBUILDPATH%\installer" || EXIT /B 1
|
2018-05-22 09:41:10 -05:00
|
|
|
COPY "%VCREDIST%" "%PGBUILDPATH%\installer" > nul || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
CD %WD%
|
2018-05-18 07:27:33 -05:00
|
|
|
EXIT /B 0
|
2018-05-22 09:41:10 -05:00
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
:CREATE_PYTHON_ENV
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Staging Python...
|
2018-05-22 07:39:03 -05:00
|
|
|
COPY %PYTHON_DLL% "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY %PYTHON_HOME%\python.exe "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
|
|
|
COPY %PYTHON_HOME%\pythonw.exe "%PGBUILDPATH%\runtime" > nul || EXIT /B 1
|
2016-06-21 04:33:23 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Cleaning up unnecessary .pyc and .pyo files...
|
|
|
|
FOR /R "%PGBUILDPATH%\%VIRTUALENV%" %%f in (*.pyc *.pyo) do DEL /q "%%f" 1> nul 2>&1
|
|
|
|
ECHO Removing tests...
|
|
|
|
FOR /R "%PGBUILDPATH%\%VIRTUALENV%\Lib" %%f in (test tests) do RD /Q /S "%%f" 1> nul 2>&1
|
|
|
|
ECHO Removing TCL...
|
|
|
|
RD /Q /S "%PGBUILDPATH%\%VIRTUALENV%\tcl" 1> nul 2>&1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
EXIT /B 0
|
2017-02-28 07:02:49 -06:00
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
:CREATE_INSTALLER
|
|
|
|
ECHO Preparing for creation of windows installer...
|
2018-05-16 10:35:23 -05:00
|
|
|
IF NOT EXIST "%TARGET_DIR%" MKDIR "%TARGET_DIR%"
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Copying icon file...
|
2018-05-22 07:39:03 -05:00
|
|
|
COPY "%WD%\pkg\win32\Resources\pgAdmin4.ico" "%PGBUILDPATH%" > nul || EXIT /B 1
|
2016-06-16 07:07:04 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
CD "%WD%\pkg\win32"
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Processing installer configuration script...
|
2018-05-22 10:35:55 -05:00
|
|
|
CALL "%PYTHON_HOME%\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 "%PYTHON_HOME%\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 "%PYTHON_HOME%\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%"""
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-22 09:41:10 -05:00
|
|
|
SET ARCMODE=
|
2016-06-08 06:29:21 -05:00
|
|
|
IF "%ARCHITECTURE%"=="amd64" (
|
|
|
|
set ARCMODE="x64"
|
|
|
|
)
|
2018-05-22 10:35:55 -05:00
|
|
|
CALL "%PYTHON_HOME%\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 "%PYTHON_HOME%\python" "%WD%\pkg\win32\replace.py" "-i" "%WD%\pkg\win32\installer.iss.in_stage4" "-o" "%WD%\pkg\win32\installer.iss" "-s" MYAPP_VCDIST -r """%VCREDISTNAME%"""
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Cleaning up...
|
2016-06-08 06:29:21 -05:00
|
|
|
DEL /s "%WD%\pkg\win32\installer.iss.in_stage*" > nul
|
2016-06-21 06:43:01 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Creating windows installer using INNO tool...
|
2018-05-22 10:35:55 -05:00
|
|
|
CALL "%INNOTOOL%\ISCC.exe" /q "%WD%\pkg\win32\installer.iss" || EXIT /B 1
|
2016-06-21 06:43:01 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Renaming installer...
|
2018-05-22 07:39:03 -05:00
|
|
|
MOVE "%WD%\pkg\win32\Output\Setup.exe" "%TARGET_DIR%\%INSTALLERNAME%" > nul || EXIT /B 1
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Location - %TARGET_DIR%\%INSTALLERNAME%
|
2016-06-08 06:29:21 -05:00
|
|
|
ECHO Installer generated successfully.
|
2016-06-16 07:07:04 -05:00
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
CD %WD%
|
2018-05-18 07:27:33 -05:00
|
|
|
EXIT /B 0
|
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
|
2016-10-04 08:33:52 -05:00
|
|
|
:SIGN_INSTALLER
|
|
|
|
ECHO Attempting to sign the installer...
|
2018-05-22 10:35:55 -05:00
|
|
|
CALL "%SIGNTOOL%" sign /t http://timestamp.verisign.com/scripts/timstamp.dll "%TARGET_DIR%\%INSTALLERNAME%"
|
2016-10-04 08:33:52 -05:00
|
|
|
IF %ERRORLEVEL% NEQ 0 (
|
2018-05-23 02:48:26 -05:00
|
|
|
ECHO.
|
2016-10-04 08:33:52 -05:00
|
|
|
ECHO ************************************************************
|
|
|
|
ECHO * Failed to sign the installer
|
|
|
|
ECHO ************************************************************
|
2018-02-05 09:32:14 -06:00
|
|
|
PAUSE
|
2016-10-04 08:33:52 -05:00
|
|
|
)
|
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
EXIT /B 0
|
2016-10-04 08:33:52 -05:00
|
|
|
|
2018-05-22 09:41:10 -05:00
|
|
|
|
2016-06-08 06:29:21 -05:00
|
|
|
:CLEANUP_ENV
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Cleaning the build environment...
|
|
|
|
RD "%PGBUILDPATH%\%VIRTUALENV%\Include" /S /Q 1> nul 2>&1
|
|
|
|
DEL /s "%PGBUILDPATH%\%VIRTUALENV%\pip-selfcheck.json" 1> nul 2>&1
|
|
|
|
|
|
|
|
EXIT /B 0
|
2016-06-08 06:29:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
:USAGE
|
2018-05-18 07:27:33 -05:00
|
|
|
ECHO Invalid command line options.
|
2018-02-05 09:32:14 -06:00
|
|
|
ECHO Usage: "Make.bat <x86 | clean>"
|
2016-06-08 06:29:21 -05:00
|
|
|
ECHO.
|
|
|
|
|
2018-05-18 07:27:33 -05:00
|
|
|
EXIT /B 1
|
2017-02-28 11:02:01 -06:00
|
|
|
|