This commit is contained in:
glachancecmaisonneuve 2017-08-13 00:08:47 -04:00 committed by botmtl
parent 011368ef9e
commit ee42c44b39
3 changed files with 265 additions and 0 deletions

3
ports/chmlib/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: chmlib
Version: 0.40
Description: CHMLIB is a library for dealing with Microsoft ITSS/CHM format files. Right now, it is a very simple library, but sufficient for dealing with all of the .chm files I've come across. Due to the fairly well-designed indexing built into this particular file format, even a small library is able to gain reasonably good performance indexing into ITSS archives.

205
ports/chmlib/chm.vcxproj Normal file
View File

@ -0,0 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{3bafee52-fe1a-494e-ab46-89bf77ed63a7}</ProjectGuid>
<RootNamespace>chmLibExe1</RootNamespace>
<ProjectName>chm</ProjectName>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<!--Overriden at build time.-->
<OutDir>..\..\..\x86-windows-static-dbg\</OutDir>
<IntDir>..\..\..\x86-windows-static-dbg\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<!--Overriden at build time.-->
<OutDir>..\..\..\x86-windows-static-rel\</OutDir>
<IntDir>..\..\..\x86-windows-static-rel\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<!--Overriden at build time.-->
<OutDir>..\..\..\x64-windows-static-dbg\</OutDir>
<IntDir>..\..\..\x64-windows-static-dbg\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<!--Overriden at build time.-->
<OutDir>..\..\..\x64-windows-static-rel\</OutDir>
<IntDir>..\..\..\x64-windows-static-rel\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<PreprocessorDefinitions>WIN32;CHM_MT;CHM_DEBUG;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<DisableSpecificWarnings>4018;4057;4127;4189;4244;4267;4295;4324;4458;4477;4701;4706;4800;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<CompileAs>CompileAsC</CompileAs>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<AdditionalDependencies>
</AdditionalDependencies>
<SubSystem>Console</SubSystem>
<ShowProgress>LinkVerbose</ShowProgress>
<IgnoreSpecificDefaultLibraries>libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries>
</Link>
<Lib>
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
<TargetMachine>MachineX86</TargetMachine>
<SubSystem>Windows</SubSystem>
<Verbose>true</Verbose>
<IgnoreSpecificDefaultLibraries>libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<PreprocessorDefinitions>WIN32;CHM_MT;CHM_DEBUG;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<DisableSpecificWarnings>4018;4057;4127;4189;4244;4267;4295;4324;4458;4477;4701;4706;4800;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<CompileAs>CompileAsC</CompileAs>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<AdditionalDependencies>
</AdditionalDependencies>
<SubSystem>Console</SubSystem>
<ShowProgress>LinkVerbose</ShowProgress>
<IgnoreSpecificDefaultLibraries>libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries>
</Link>
<Lib>
<SubSystem>Windows</SubSystem>
<Verbose>true</Verbose>
<IgnoreSpecificDefaultLibraries>libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<PreprocessorDefinitions>CHM_MT;WIN32;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<DisableSpecificWarnings>4018;4057;4127;4189;4244;4267;4295;4324;4458;4477;4701;4706;4800;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>
</AdditionalDependencies>
<SubSystem>Console</SubSystem>
<ShowProgress>LinkVerbose</ShowProgress>
</Link>
<Lib>
<TargetMachine>MachineX86</TargetMachine>
<SubSystem>Windows</SubSystem>
<Verbose>true</Verbose>
<IgnoreSpecificDefaultLibraries>libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<PreprocessorDefinitions>CHM_MT;WIN32;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<DisableSpecificWarnings>4018;4057;4127;4189;4244;4267;4295;4324;4458;4477;4701;4706;4800;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>
</AdditionalDependencies>
<SubSystem>Console</SubSystem>
<ShowProgress>LinkVerbose</ShowProgress>
</Link>
<Lib>
<SubSystem>Windows</SubSystem>
<Verbose>true</Verbose>
<IgnoreSpecificDefaultLibraries>libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="chm_lib.c" />
<ClCompile Include="lzx.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="chm_lib.h" />
<ClInclude Include="lzx.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,57 @@
# Common Ambient Variables:
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
# PORT = current port name (zlib, etc)
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
#
#message("VCPKG_TARGET_ARCHITECTURE" ${VCPKG_TARGET_ARCHITECTURE})
#if(NOT ${VCPKG_TARGET_ARCHITECTURE} STREQUAL "x86")
# message(FATAL_ERROR "chmlib only supports x86")
#endif()
if(${VCPKG_CRT_LINKAGE} STREQUAL "dynamic")
message(FATAL_ERROR "chmlib supports static linking only.")
endif()
if(${VCPKG_LIBRARY_LINKAGE} STREQUAL "dynamic")
message(FATAL_ERROR "chmlib supports static linking only.")
endif()
set(CHMLIB_VERSION chmlib-0.40)
set(CHMLIB_FILENAME ${CHMLIB_VERSION}.zip)
set(CHMLIB_URL http://www.jedrea.com/chmlib/${CHMLIB_FILENAME})
set(CHMLIB_SRC ${CURRENT_BUILDTREES_DIR}/src/${CHMLIB_VERSION}/src)
include(vcpkg_common_functions)
vcpkg_download_distfile(
ARCHIVE
URLS ${CHMLIB_URL}
FILENAME ${CHMLIB_FILENAME}
SHA512 ad3b0d49fcf99e724c0c38b9c842bae9508d0e4ad47122b0f489c113160f5344223d311abb79f25cbb0b662bb00e2925d338d60dd20a0c309bda2822cda4cd24
)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY "${VCPKG_ROOT_DIR}/ports/${PORT}/chm.vcxproj"
DESTINATION ${CHMLIB_SRC})
vcpkg_build_msbuild(
PROJECT_PATH ${CHMLIB_SRC}/chm.vcxproj
RELEASE_CONFIGURATION Release
DEBUG_CONFIGURATION Debug
OPTIONS_DEBUG /p:OutDirPath="${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
OPTIONS_RELEASE /p:OutDirPath="${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
OPTIONS /v:diagnostic /p:SkipInvalidConfigurations=true
)
file(INSTALL ${CHMLIB_SRC}/chm_lib.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/chm.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/chm.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${CURRENT_BUILDTREES_DIR}/src/chmlib-0.40/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/chmlib)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/chmlib/COPYING ${CURRENT_PACKAGES_DIR}/share/chmlib/copyright)