James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame] | 1 | :: |
| 2 | :: Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | :: you may not use this file except in compliance with the License. |
| 4 | :: You may obtain a copy of the License at |
| 5 | :: |
| 6 | :: http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | :: |
| 8 | :: Unless required by applicable law or agreed to in writing, software |
| 9 | :: distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | :: See the License for the specific language governing permissions and |
| 12 | :: limitations under the License. |
| 13 | :: |
| 14 | |
| 15 | SETLOCAL EnableDelayedExpansion |
| 16 | |
| 17 | SET PACKAGE=zlib-%ZLIB_VERSION% |
| 18 | SET BUILDDIR=%WIN3P%\zlib-build |
| 19 | SET INSTDIR=%WIN3P%\zlib-inst |
| 20 | SET SRCDIR=%WIN3P%\%PACKAGE% |
| 21 | SET URLFILE=%PACKAGE%.tar.gz |
| 22 | |
| 23 | :: This allows us to tolerate when the current version is archived |
| 24 | SET URL=http://zlib.net/%URLFILE% |
| 25 | SET FURL=http://zlib.net/fossils/%URLFILE% |
| 26 | |
James E. King III | 860a5f1 | 2018-03-06 14:23:23 -0500 | [diff] [blame] | 27 | :: Download - support running a local build or a build in appveyor |
James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame] | 28 | CD "%WIN3P%" || EXIT /B |
James E. King III | 860a5f1 | 2018-03-06 14:23:23 -0500 | [diff] [blame] | 29 | IF "%APPVEYOR_BUILD_ID%" == "" ( |
| 30 | curl -L -f -o "%URLFILE%" "%URL%" |
| 31 | IF ERRORLEVEL 1 ( |
| 32 | curl -L -f -o "%URLFILE%" "%FURL%" |
| 33 | ) |
| 34 | ) ELSE ( |
| 35 | appveyor DownloadFile "%URL%" |
| 36 | IF ERRORLEVEL 1 ( |
| 37 | appveyor DownloadFile "%FURL%" || EXIT /B |
| 38 | ) |
James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame] | 39 | ) |
| 40 | 7z x "%URLFILE%" -so | 7z x -si -ttar > nul || EXIT /B |
| 41 | |
| 42 | :: Generate |
| 43 | MKDIR "%BUILDDIR%" || EXIT /B |
| 44 | CD "%BUILDDIR%" || EXIT /B |
| 45 | cmake "%SRCDIR%" ^ |
| 46 | -G"NMake Makefiles" ^ |
| 47 | -DCMAKE_INSTALL_PREFIX="%INSTDIR%" ^ |
| 48 | -DCMAKE_BUILD_TYPE="%CONFIGURATION%" || EXIT /B |
| 49 | |
| 50 | :: Build |
| 51 | nmake /fMakefile install || EXIT /B |
| 52 | IF "%CONFIGURATION%" == "Debug" ( |
| 53 | COPY "%BUILDDIR%\zlibd.pdb" "%INSTDIR%\bin\" || EXIT /B |
| 54 | ) |
| 55 | |
| 56 | ENDLOCAL |