Skip to content

Commit

Permalink
Changes to use bzip2 1.0.8 on windows (#2332)
Browse files Browse the repository at this point in the history
* Changes to use bzip2 1.0.8 on windows

* remove path added unnecessarily

* Change fetch url to github permalink plus ?raw=true, -L added for curl to follow redirects necessary to retrieve desired final object

* Place tiledb provided CMakeLists.txt in cmake/inputs/patches/ep_bzip2 and patch into externals/src/ep_bzip2 from there

* Correct copy source path for CMakeLists.txt

* Use cmake macro to reference cmake command rather than direct name
  • Loading branch information
dhoke4tdb authored and github-actions[bot] committed Jun 9, 2021
1 parent a87da7f commit 12d4592
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmake/Modules/FindBzip2_EP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ if (NOT BZIP2_FOUND)
if (WIN32)
ExternalProject_Add(ep_bzip2
PREFIX "externals"
URL "https://github.com/TileDB-Inc/bzip2-windows/releases/download/v1.0.6/bzip2-1.0.6.zip"
URL_HASH SHA1=d11c3f0be92805a4c35f384845beb99eb6a96f6e
URL "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz"
URL_HASH SHA1=bf7badf7e248e0ecf465d33c2f5aeec774209227
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${TILEDB_EP_INSTALL_PREFIX}
UPDATE_COMMAND ""
PATCH_COMMAND
${CMAKE_COMMAND} -E copy ${TILEDB_CMAKE_INPUTS_DIR}/patches/ep_bzip2/CMakeLists.txt ${CMAKE_CURRENT_BINARY_DIR}/externals/src/ep_bzip2
LOG_DOWNLOAD TRUE
LOG_CONFIGURE TRUE
LOG_BUILD TRUE
Expand Down
55 changes: 55 additions & 0 deletions cmake/inputs/patches/ep_bzip2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# CMakeLists.txt
#
#
# The MIT License
#
# Copyright (c) 2017 TileDB, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

project(bzip2)
cmake_minimum_required(VERSION 2.8)

set(SOURCES "blocksort.c" "huffman.c" "crctable.c" "randtable.c"
"compress.c" "decompress.c" "bzlib.c")
file(GLOB HEADERS "bzlib.h")

# Set build flags
if (WIN32)
set(CMAKE_C_FLAGS "/DWIN32 /D_FILE_OFFSET_BITS=64 /MD /Ox /nologo")
else()
set(CMAKE_C_FLAGS "-D_FILE_OFFSET_BITS=64 -Wall -Winline -O2 -g")
endif()

# Create libraries
add_library(bzip2_static STATIC ${SOURCES})
set_target_properties(bzip2_static PROPERTIES OUTPUT_NAME "libbz2static")
add_library(bzip2_shared SHARED ${SOURCES} libbz2.def)
set_target_properties(bzip2_shared PROPERTIES OUTPUT_NAME "libbz2")

# Install libraries
install(
TARGETS bzip2_static bzip2_shared
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${HEADERS} DESTINATION include)

0 comments on commit 12d4592

Please sign in to comment.