From 556a4badac4e7c4f2a6ddf1dfb86a83c83fc191e Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 28 Sep 2015 17:09:31 -0700 Subject: [PATCH 1/2] initial version of zlib coapp package --- vsprojects/copkg/zlib/README.md | 35 ++++ vsprojects/copkg/zlib/buildall.bat | 51 ++++++ .../copkg/zlib/grpc.dependencies.zlib.autopkg | 106 ++++++++++++ .../grpc.dependencies.zlib.redist.props | 13 ++ .../grpc.dependencies.zlib.redist.targets | 14 ++ vsprojects/copkg/zlib/version.inc | 1 + vsprojects/copkg/zlib/zlib.sln | 26 +++ vsprojects/copkg/zlib/zlib.vcxproj | 155 ++++++++++++++++++ 8 files changed, 401 insertions(+) create mode 100644 vsprojects/copkg/zlib/README.md create mode 100644 vsprojects/copkg/zlib/buildall.bat create mode 100644 vsprojects/copkg/zlib/grpc.dependencies.zlib.autopkg create mode 100644 vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.props create mode 100644 vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.targets create mode 100644 vsprojects/copkg/zlib/version.inc create mode 100644 vsprojects/copkg/zlib/zlib.sln create mode 100644 vsprojects/copkg/zlib/zlib.vcxproj diff --git a/vsprojects/copkg/zlib/README.md b/vsprojects/copkg/zlib/README.md new file mode 100644 index 00000000000..c81a57a48be --- /dev/null +++ b/vsprojects/copkg/zlib/README.md @@ -0,0 +1,35 @@ +Zlib Native Nuget package +------------------------- + +Uses [CoApp](http://coapp.org/) project to build the zlib package. + +Prerequisites +------------- +Multiple versions of VS installed to be able to build all the targets: +* Visual Studio 2013 +* Visual Studio 2010 (you might need SP1 to prevent LNK1123 error) + +CoApp toolkit: http://downloads.coapp.org/files/CoApp.Tools.Powershell.msi + +More details on installation: http://coapp.org/tutorials/installation.html + +Building +-------- + +Build all flavors of zlib library using the provided batch file. +``` +buildall.bat +``` + +Then, create NuGet package using powershell (you'll need the CoApp toolkit installed): +``` +[THIS_DIRECTORY]> Write-NuGetPackage grpc.dependencies.zlib.autopkg +``` + +This will create three NuGet packages: +* the main dev package +* the redistributable package that contains just the binaries and no headers +* the symbols package (debug symbols) + +Later, you can push the package to NuGet.org repo. +Attention: before pusing the resulting nuget package to public nuget repo, you have to be 100% sure it works correctly - there’s no way how to delete or update an already existing package. \ No newline at end of file diff --git a/vsprojects/copkg/zlib/buildall.bat b/vsprojects/copkg/zlib/buildall.bat new file mode 100644 index 00000000000..a71e56f4ae0 --- /dev/null +++ b/vsprojects/copkg/zlib/buildall.bat @@ -0,0 +1,51 @@ +@echo off +setlocal + +setlocal +call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 +call :build x64 Release v120 || goto :eof +call :build x64 Debug v120 || goto :eof +endlocal + +setlocal +call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 +call :build Win32 Release v120 || goto :eof +call :build Win32 Debug v120 || goto :eof +endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v110 || goto :eof +REM call :build x64 Debug v110 || goto :eof +REM endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 +REM call :build Win32 Release v110 || goto :eof +REM call :build Win32 Debug v110 || goto :eof +REM endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v100 || goto :eof +REM call :build x64 Debug v100 || goto :eof +REM endlocal + +setlocal +call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 +call :build Win32 Release v100 || goto :eof +call :build Win32 Debug v100 || goto :eof +endlocal + +goto :eof + +:build +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=Dynamic /P:CallingConvention=cdecl .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=Dynamic /P:CallingConvention=stdcall .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=Static /P:CallingConvention=cdecl .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=Static /P:CallingConvention=stdcall .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=ltcg /P:CallingConvention=cdecl .\zlib.sln || goto :eof +msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:UsesConfigurationType=ltcg /P:CallingConvention=stdcall .\zlib.sln || goto :eof +goto :eof + + diff --git a/vsprojects/copkg/zlib/grpc.dependencies.zlib.autopkg b/vsprojects/copkg/zlib/grpc.dependencies.zlib.autopkg new file mode 100644 index 00000000000..015103ba2f0 --- /dev/null +++ b/vsprojects/copkg/zlib/grpc.dependencies.zlib.autopkg @@ -0,0 +1,106 @@ +@import @"version.inc"; + +configurations { +}; + +#define { + package-id = "grpc.dependencies.zlib"; +} + +nuget { + // the nuspec file metadata. Gets created/updated on build + nuspec { + id = ${package-id}; + version : ${package-version}; + title: gRPC Native Dependency: ZLib compression library; + authors: {Jean-loup Gailly, Mark Adler, Garrett Serack, Tim Rogers}; + owners: {Jan Tattermusch}; + licenseUrl: "http://zlib.net/zlib-license.html"; + projectUrl: "http://github.com/jtattermusch/zlib"; + iconUrl: "http://zlib.net/images/zlib3d-b1.png"; + requireLicenseAcceptance:false; + summary:A zlib library; + description: @"A native zlib library. + zlib homepage: http://zlib.net"; + releaseNotes: "Release of zlib 1.2.8 libraries."; + copyright: Copyright 2013; + tags: { zlib, native, CoApp }; + + }; + + // the files that go into the content folders + // (inserted into the nuspec file) + files { + // .targets file that are applied when redist package is installed from a managed project. + managed_build: { + #output { + package = redist; + }; + #destination = "\build\portable-net45"; + "managed_targets\${package-id}.redist.props"; + "managed_targets\${package-id}.redist.targets"; + }; + + include: { ..\..\zlib.h, ..\..\zconf.h }; + + docs: { ..\..\doc\**\* }; + + source += { + "..\..\adler32.c", + "..\..\compress.c", + "..\..\crc32.c", + "..\..\deflate.c", + "..\..\gzclose.c", + "..\..\gzlib.c", + "..\..\gzread.c", + "..\..\gzwrite.c", + "..\..\infback.c", + "..\..\inffast.c", + "..\..\inflate.c", + "..\..\inftrees.c", + "..\..\trees.c", + "..\..\uncompr.c", + "..\..\zutil.c", + "..\..\crc32.h", + "..\..\deflate.h", + "..\..\gzguts.h", + "..\..\inffast.h", + "..\..\inffixed.h", + "..\..\inflate.h", + "..\..\inftrees.h", + "..\..\trees.h", + "..\..\zconf.h", + "..\..\zlib.h", + "..\..\zutil.h", + "..\masmx64\inffas8664.c", + "..\minizip\ioapi.c", + "..\minizip\iowin32.c", + "..\minizip\unzip.c", + "..\minizip\zip.c", + }; + ("v100,v120", "Win32,x64", "Release,Debug", "Dynamic", "cdecl,stdcall", "MultiByte") => { + [${0},${1},${2},${3},${4}] { + lib: { .\output\${0}\${1}\${2}\${3}\${4}\${5}\*.lib }; + bin: { .\output\${0}\${1}\${2}\${3}\${4}\${5}\*.dll }; + symbols: { .\output\${0}\${1}\${2}\${3}\${4}\${5}\*.pdb }; + }; + }; + ("v100,v120", "Win32,x64", "Release,Debug", "Static,ltcg", "cdecl,stdcall", "MultiByte") => { + [${0},${1},${2},${3},${4}] { + lib: { .\output\${0}\${1}\${2}\${3}\${4}\${5}\*.lib }; + }; + }; + + }; + + // the VC++ .targets file that gets generated and inserted into the ${d_content} folder + targets { + Defines += HAS_ZLIB; + [dynamic] + Defines += ZLIB_DLL; + [stdcall] + Defines += ZLIB_WINAPI; + + }; +} + diff --git a/vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.props b/vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.props new file mode 100644 index 00000000000..bcb37de0f7f --- /dev/null +++ b/vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.props @@ -0,0 +1,13 @@ + + + + + true + + + v120 + Win32 + Debug + cdecl + + \ No newline at end of file diff --git a/vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.targets b/vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.targets new file mode 100644 index 00000000000..f00d97dc361 --- /dev/null +++ b/vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.targets @@ -0,0 +1,14 @@ + + + + + + + + PreserveNewest + + + + + + \ No newline at end of file diff --git a/vsprojects/copkg/zlib/version.inc b/vsprojects/copkg/zlib/version.inc new file mode 100644 index 00000000000..1f893a49514 --- /dev/null +++ b/vsprojects/copkg/zlib/version.inc @@ -0,0 +1 @@ +#define { package-version : 1.2.8.9; } diff --git a/vsprojects/copkg/zlib/zlib.sln b/vsprojects/copkg/zlib/zlib.sln new file mode 100644 index 00000000000..7c38e6e1215 --- /dev/null +++ b/vsprojects/copkg/zlib/zlib.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcxproj", "{63BED288-E8C3-4345-B84D-2E64598DCF3A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Debug|Win32.ActiveCfg = Debug|Win32 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Debug|Win32.Build.0 = Debug|Win32 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Release|Win32.ActiveCfg = Release|Win32 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Release|Win32.Build.0 = Release|Win32 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Debug|x64.ActiveCfg = Debug|x64 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Debug|x64.Build.0 = Debug|x64 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Release|x64.ActiveCfg = Release|x64 + {63BED288-E8C3-4345-B84D-2E64598DCF3A}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vsprojects/copkg/zlib/zlib.vcxproj b/vsprojects/copkg/zlib/zlib.vcxproj new file mode 100644 index 00000000000..0a60fe53937 --- /dev/null +++ b/vsprojects/copkg/zlib/zlib.vcxproj @@ -0,0 +1,155 @@ + + + + $(registry:HKEY_LOCAL_MACHINE\Software\Outercurve\CoApp.Powershell\etc) + + + false + + + + + v110 + + + + + + + + {63BED288-E8C3-4345-B84D-2E64598DCF3A} + $(MSBuildProjectName) + + 1 + + + DynamicLibrary + + + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS; + $(Defines);ZLIB_WINAPI; + $(Defines);ZLIB_DLL; + $(Defines);IOWIN32_USING_WINRT_API=1; + $(Defines);IOWIN32_USING_WINRT_API=0; + $(Defines);ASMV;ASMINF; + $(Defines);WIN64; + + + ..\..; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(ProjectRootDir)Output/$(PlatformToolset)/$(Platform)/$(Configuration)/$(UsesConfigurationType)/$(CallingConvention)/$(CharacterSet)/$(AppContainer)/$(UseASM)/ + $(ProjectRootDir)Intermediate/$(TargetName)/$(PlatformToolset)/$(Platform)/$(Configuration)/$(UsesConfigurationType)/$(CallingConvention)/$(CharacterSet)/$(AppContainer)/$(UseASM)/ + + + + + true + + + 0x5A4C0000 + + + + + + $(IntDir)gvmat64.lst + Build + $(IntDir)gvmat64.obj + + + $(IntDir)inffasx64.lst + Build + $(IntDir)inffasx64.obj + + + $(IntDir)inffas32.lst + Build + true + /coff %(AdditionalOptions) + $(IntDir)inffas32.obj + + + $(IntDir)match686.lst + Build + true + /coff %(AdditionalOptions) + $(IntDir)match686.obj + + + + + + + + + + + + + + + + + + + + + + + + + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + + + + + + + + + + + From 18e2202fb568d8488e1e63eb6f9bd22baca012b3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 28 Sep 2015 17:20:03 -0700 Subject: [PATCH 2/2] customize the coapp scripts for zlib --- vsprojects/{copkg => coapp}/zlib/README.md | 0 vsprojects/{copkg => coapp}/zlib/buildall.bat | 0 .../zlib/grpc.dependencies.zlib.autopkg | 62 +++++++++---------- .../grpc.dependencies.zlib.redist.props | 0 .../grpc.dependencies.zlib.redist.targets | 0 vsprojects/{copkg => coapp}/zlib/version.inc | 0 vsprojects/{copkg => coapp}/zlib/zlib.sln | 0 vsprojects/{copkg => coapp}/zlib/zlib.vcxproj | 56 +++++++---------- 8 files changed, 53 insertions(+), 65 deletions(-) rename vsprojects/{copkg => coapp}/zlib/README.md (100%) rename vsprojects/{copkg => coapp}/zlib/buildall.bat (100%) rename vsprojects/{copkg => coapp}/zlib/grpc.dependencies.zlib.autopkg (57%) rename vsprojects/{copkg => coapp}/zlib/managed_targets/grpc.dependencies.zlib.redist.props (100%) rename vsprojects/{copkg => coapp}/zlib/managed_targets/grpc.dependencies.zlib.redist.targets (100%) rename vsprojects/{copkg => coapp}/zlib/version.inc (100%) rename vsprojects/{copkg => coapp}/zlib/zlib.sln (100%) rename vsprojects/{copkg => coapp}/zlib/zlib.vcxproj (75%) diff --git a/vsprojects/copkg/zlib/README.md b/vsprojects/coapp/zlib/README.md similarity index 100% rename from vsprojects/copkg/zlib/README.md rename to vsprojects/coapp/zlib/README.md diff --git a/vsprojects/copkg/zlib/buildall.bat b/vsprojects/coapp/zlib/buildall.bat similarity index 100% rename from vsprojects/copkg/zlib/buildall.bat rename to vsprojects/coapp/zlib/buildall.bat diff --git a/vsprojects/copkg/zlib/grpc.dependencies.zlib.autopkg b/vsprojects/coapp/zlib/grpc.dependencies.zlib.autopkg similarity index 57% rename from vsprojects/copkg/zlib/grpc.dependencies.zlib.autopkg rename to vsprojects/coapp/zlib/grpc.dependencies.zlib.autopkg index 015103ba2f0..01390b94346 100644 --- a/vsprojects/copkg/zlib/grpc.dependencies.zlib.autopkg +++ b/vsprojects/coapp/zlib/grpc.dependencies.zlib.autopkg @@ -41,42 +41,38 @@ nuget { "managed_targets\${package-id}.redist.targets"; }; - include: { ..\..\zlib.h, ..\..\zconf.h }; + include: { ..\..\..\third_party\zlib\zlib.h, ..\..\..\third_party\zlib\zconf.h }; - docs: { ..\..\doc\**\* }; + docs: { ..\..\..\third_party\zlib\doc\**\* }; source += { - "..\..\adler32.c", - "..\..\compress.c", - "..\..\crc32.c", - "..\..\deflate.c", - "..\..\gzclose.c", - "..\..\gzlib.c", - "..\..\gzread.c", - "..\..\gzwrite.c", - "..\..\infback.c", - "..\..\inffast.c", - "..\..\inflate.c", - "..\..\inftrees.c", - "..\..\trees.c", - "..\..\uncompr.c", - "..\..\zutil.c", - "..\..\crc32.h", - "..\..\deflate.h", - "..\..\gzguts.h", - "..\..\inffast.h", - "..\..\inffixed.h", - "..\..\inflate.h", - "..\..\inftrees.h", - "..\..\trees.h", - "..\..\zconf.h", - "..\..\zlib.h", - "..\..\zutil.h", - "..\masmx64\inffas8664.c", - "..\minizip\ioapi.c", - "..\minizip\iowin32.c", - "..\minizip\unzip.c", - "..\minizip\zip.c", + "..\..\..\third_party\zlib\adler32.c", + "..\..\..\third_party\zlib\compress.c", + "..\..\..\third_party\zlib\crc32.c", + "..\..\..\third_party\zlib\deflate.c", + "..\..\..\third_party\zlib\gzclose.c", + "..\..\..\third_party\zlib\gzlib.c", + "..\..\..\third_party\zlib\gzread.c", + "..\..\..\third_party\zlib\gzwrite.c", + "..\..\..\third_party\zlib\infback.c", + "..\..\..\third_party\zlib\inffast.c", + "..\..\..\third_party\zlib\inflate.c", + "..\..\..\third_party\zlib\inftrees.c", + "..\..\..\third_party\zlib\trees.c", + "..\..\..\third_party\zlib\uncompr.c", + "..\..\..\third_party\zlib\zutil.c", + "..\..\..\third_party\zlib\crc32.h", + "..\..\..\third_party\zlib\deflate.h", + "..\..\..\third_party\zlib\gzguts.h", + "..\..\..\third_party\zlib\inffast.h", + "..\..\..\third_party\zlib\inffixed.h", + "..\..\..\third_party\zlib\inflate.h", + "..\..\..\third_party\zlib\inftrees.h", + "..\..\..\third_party\zlib\trees.h", + "..\..\..\third_party\zlib\zconf.h", + "..\..\..\third_party\zlib\zlib.h", + "..\..\..\third_party\zlib\zutil.h", + "..\..\..\third_party\zlib\contrib\masmx64\inffas8664.c", }; ("v100,v120", "Win32,x64", "Release,Debug", "Dynamic", "cdecl,stdcall", "MultiByte") => { [${0},${1},${2},${3},${4}] { diff --git a/vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.props b/vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.props similarity index 100% rename from vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.props rename to vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.props diff --git a/vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.targets b/vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.targets similarity index 100% rename from vsprojects/copkg/zlib/managed_targets/grpc.dependencies.zlib.redist.targets rename to vsprojects/coapp/zlib/managed_targets/grpc.dependencies.zlib.redist.targets diff --git a/vsprojects/copkg/zlib/version.inc b/vsprojects/coapp/zlib/version.inc similarity index 100% rename from vsprojects/copkg/zlib/version.inc rename to vsprojects/coapp/zlib/version.inc diff --git a/vsprojects/copkg/zlib/zlib.sln b/vsprojects/coapp/zlib/zlib.sln similarity index 100% rename from vsprojects/copkg/zlib/zlib.sln rename to vsprojects/coapp/zlib/zlib.sln diff --git a/vsprojects/copkg/zlib/zlib.vcxproj b/vsprojects/coapp/zlib/zlib.vcxproj similarity index 75% rename from vsprojects/copkg/zlib/zlib.vcxproj rename to vsprojects/coapp/zlib/zlib.vcxproj index 0a60fe53937..56df39a2483 100644 --- a/vsprojects/copkg/zlib/zlib.vcxproj +++ b/vsprojects/coapp/zlib/zlib.vcxproj @@ -8,8 +8,8 @@ - - v110 + + v120 @@ -35,7 +35,7 @@ $(Defines);WIN64; - ..\..; + ..\..\..\third_party\zlib; @@ -89,24 +89,24 @@ - + $(IntDir)gvmat64.lst Build $(IntDir)gvmat64.obj - + $(IntDir)inffasx64.lst Build $(IntDir)inffasx64.obj - + $(IntDir)inffas32.lst Build true /coff %(AdditionalOptions) $(IntDir)inffas32.obj - + $(IntDir)match686.lst Build true @@ -118,36 +118,28 @@ - - - - - - - - - - - - - - - - - - - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - + + + + + + + + + + + + + + + + - +