mirror of https://github.com/grpc/grpc.git
Merge pull request #3571 from jtattermusch/coapp_zlib
Add scripts to build nuget package for zlibpull/3589/head
commit
79e038ad90
8 changed files with 389 additions and 0 deletions
@ -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. |
@ -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 |
||||
|
||||
|
@ -0,0 +1,102 @@ |
||||
@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: { ..\..\..\third_party\zlib\zlib.h, ..\..\..\third_party\zlib\zconf.h }; |
||||
|
||||
docs: { ..\..\..\third_party\zlib\doc\**\* }; |
||||
|
||||
source += { |
||||
"..\..\..\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}] { |
||||
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; |
||||
|
||||
}; |
||||
} |
||||
|
@ -0,0 +1 @@ |
||||
#define { package-version : 1.2.8.9; } |
@ -0,0 +1,147 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="PreBuildCmds;PreBuildTargets;Build;PostBuildCmds;PostBuildTargets" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup Label="CoApp" > |
||||
<CoAppEtcDirectory>$(registry:HKEY_LOCAL_MACHINE\Software\Outercurve\CoApp.Powershell\etc)</CoAppEtcDirectory> |
||||
|
||||
<!-- Set to true to make visual studio use PTK when building.--> |
||||
<UsePTKFromVisualStudio>false</UsePTKFromVisualStudio> |
||||
</PropertyGroup> |
||||
|
||||
<PropertyGroup Label="Configuration" > |
||||
<!-- This lets Visual Studio see this as a VC12 project by default --> |
||||
<PlatformToolset Condition="'$(PlatformToolset)' == ''">v120</PlatformToolset> |
||||
</PropertyGroup> |
||||
|
||||
<Import Condition="Exists('$(CoAppEtcDirectory)\common-variables.vcxproj')" Project="$(CoAppEtcDirectory)\common-variables.vcxproj" /> |
||||
|
||||
<PropertyGroup Label="CustomSettings" /> |
||||
|
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{63BED288-E8C3-4345-B84D-2E64598DCF3A}</ProjectGuid> |
||||
<RootNamespace>$(MSBuildProjectName)</RootNamespace> |
||||
|
||||
<OutNameSuffix Condition="$(IS_CDECL) AND $(IS_DYNAMIC)">1</OutNameSuffix> |
||||
|
||||
<!-- set to Application or DynamicLibrary (DynamicLibrary can get altered to StaticLibrary by PTK --> |
||||
<ConfigurationType>DynamicLibrary</ConfigurationType> |
||||
|
||||
<!-- Common Compiler Defines (semicolon delimited) --> |
||||
<Defines>_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;</Defines> |
||||
<Defines Condition="$(IS_STDCALL)">$(Defines);ZLIB_WINAPI;</Defines> |
||||
<Defines Condition="$(IS_DYNAMIC)">$(Defines);ZLIB_DLL;</Defines> |
||||
<Defines Condition="'$(AppContainer)' == 'App'">$(Defines);IOWIN32_USING_WINRT_API=1;</Defines> |
||||
<Defines Condition="'$(AppContainer)' != 'App'">$(Defines);IOWIN32_USING_WINRT_API=0;</Defines> |
||||
<Defines Condition="'$(UseASM)' == 'ASM'">$(Defines);ASMV;ASMINF;</Defines> |
||||
<Defines Condition="$(IS_X64)">$(Defines);WIN64;</Defines> |
||||
|
||||
<!-- Additional Include folders (semicolon delimited) --> |
||||
<IncludeDirectories>..\..\..\third_party\zlib;</IncludeDirectories> |
||||
|
||||
<!-- Additional Library folders (semicolon delimited) --> |
||||
<LibraryDirectories></LibraryDirectories> |
||||
|
||||
<!-- Libraries to Link with --> |
||||
<Libraries></Libraries> |
||||
|
||||
<!-- Batch script to run before Build--> |
||||
<PreBuild></PreBuild> |
||||
|
||||
<!-- Batch script to run after Build--> |
||||
<PostBuild></PostBuild> |
||||
|
||||
<!-- Batch script to run before Link step--> |
||||
<PreLink></PreLink> |
||||
|
||||
<!-- Batch script to run after Link--> |
||||
<PostLink></PostLink> |
||||
|
||||
<!-- Batch script to run before Lib step--> |
||||
<PreLib></PreLib> |
||||
|
||||
<!-- Batch script to run after Lib--> |
||||
<PostLib></PostLib> |
||||
|
||||
<!-- Targets to run before Build (semcolon delimited)--> |
||||
<PreBuildTargets></PreBuildTargets> |
||||
|
||||
<!-- Targets to run before Build (semcolon delimited)--> |
||||
<PostBuildTargets></PostBuildTargets> |
||||
|
||||
<!-- for Dynamic libs, you can specify the Module .DEF file path --> |
||||
<ModuleDefinitionFile></ModuleDefinitionFile> |
||||
</PropertyGroup> |
||||
|
||||
<Import Condition="Exists('$(CoAppEtcDirectory)\common-header.vcxproj')" Project="$(CoAppEtcDirectory)\common-header.vcxproj" /> |
||||
<Import Condition="'$(UseASM)' == 'ASM'" Project="$(VCTargetsPath)\BuildCustomizations\masm.props" /> |
||||
|
||||
<PropertyGroup> |
||||
<OutDir>$(ProjectRootDir)Output/$(PlatformToolset)/$(Platform)/$(Configuration)/$(UsesConfigurationType)/$(CallingConvention)/$(CharacterSet)/$(AppContainer)/$(UseASM)/</OutDir> |
||||
<IntDir>$(ProjectRootDir)Intermediate/$(TargetName)/$(PlatformToolset)/$(Platform)/$(Configuration)/$(UsesConfigurationType)/$(CallingConvention)/$(CharacterSet)/$(AppContainer)/$(UseASM)/</IntDir> |
||||
</PropertyGroup> |
||||
|
||||
<ItemDefinitionGroup> |
||||
<ClCompile> |
||||
<SDLCheck>true</SDLCheck> |
||||
</ClCompile> |
||||
<Link> |
||||
<BaseAddress>0x5A4C0000</BaseAddress> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemGroup Condition="'$(UseASM)' == 'ASM'"> |
||||
<MASM Include="..\..\..\third_party\zlib\contrib\masmx64\gvmat64.asm" Condition="$(IS_X64)"> |
||||
<AssembledCodeListingFile>$(IntDir)gvmat64.lst</AssembledCodeListingFile> |
||||
<MASMBeforeTargets>Build</MASMBeforeTargets> |
||||
<ObjectFileName>$(IntDir)gvmat64.obj</ObjectFileName> |
||||
</MASM> |
||||
<MASM Include="..\..\..\third_party\zlib\contrib\masmx64\inffasx64.asm" Condition="$(IS_X64)"> |
||||
<AssembledCodeListingFile>$(IntDir)inffasx64.lst</AssembledCodeListingFile> |
||||
<MASMBeforeTargets>Build</MASMBeforeTargets> |
||||
<ObjectFileName>$(IntDir)inffasx64.obj</ObjectFileName> |
||||
</MASM> |
||||
<MASM Include="..\..\..\third_party\zlib\contrib\masmx86\inffas32.asm" Condition="$(IS_X86) AND $(IS_STDCALL)"> |
||||
<AssembledCodeListingFile>$(IntDir)inffas32.lst</AssembledCodeListingFile> |
||||
<MASMBeforeTargets>Build</MASMBeforeTargets> |
||||
<UseSafeExceptionHandlers>true</UseSafeExceptionHandlers> |
||||
<AdditionalOptions>/coff %(AdditionalOptions)</AdditionalOptions> |
||||
<ObjectFileName>$(IntDir)inffas32.obj</ObjectFileName> |
||||
</MASM> |
||||
<MASM Include="..\..\..\third_party\zlib\contrib\masmx86\match686.asm" Condition="$(IS_X86) AND $(IS_STDCALL)"> |
||||
<AssembledCodeListingFile>$(IntDir)match686.lst</AssembledCodeListingFile> |
||||
<MASMBeforeTargets>Build</MASMBeforeTargets> |
||||
<UseSafeExceptionHandlers>true</UseSafeExceptionHandlers> |
||||
<AdditionalOptions>/coff %(AdditionalOptions)</AdditionalOptions> |
||||
<ObjectFileName>$(IntDir)match686.obj</ObjectFileName> |
||||
</MASM> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup Label="C Source Files"> |
||||
<!-- Include the source files to compile here --> |
||||
<!-- <ClCompile Include="..\src\foo.c" /> --> |
||||
<ClCompile Include="..\..\..\third_party\zlib\adler32.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\compress.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\crc32.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\deflate.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\gzclose.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\gzlib.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\gzread.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\gzwrite.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\infback.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\contrib\masmx64\inffas8664.c" Condition="$(IS_X64)" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\inffast.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\inflate.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\inftrees.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\trees.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\uncompr.c" /> |
||||
<ClCompile Include="..\..\..\third_party\zlib\zutil.c" /> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup Label="Resource Files"> |
||||
<!-- Include the source files to compile here --> |
||||
<!-- <ResourceCompile Include="..\src\foo.rc" /> --> |
||||
<ResourceCompile Include="..\..\..\third_party\zlib\win32\zlib1.rc" /> |
||||
</ItemGroup> |
||||
|
||||
<Import Condition="'$(UseASM)' == 'ASM'" Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> |
||||
<Import Condition="Exists('$(CoAppEtcDirectory)\common-footer.vcxproj')" Project="$(CoAppEtcDirectory)\common-footer.vcxproj" /> |
||||
</Project> |
Loading…
Reference in new issue