apotocki/bzip2
libbz2, the bzip2 compression library.
- Library
- bzip2
- Newest
- 1.0.8 (r1, android)
- Targets
- android, apple, linux, windows
- License
- bzip2-1.0.6
- Homepage
- https://sourceware.org/bzip2/
- Keywords
- compression, bzip2
Use it
In otok.toml:
[deps.bzip2]
recipe = "apotocki/bzip2"
version = "~> 1.0.8"
Versions
| Version | Target | Channel | Published | Status |
|---|---|---|---|---|
| 1.0.8 (r1, android) | android | stable | 2026-11-07 | |
| 1.0.8 (r1, apple) | apple | stable | 2026-11-07 | |
| 1.0.8 (r1, linux) | linux | stable | 2026-11-07 | |
| 1.0.8 (r1, windows) | windows | stable | 2026-11-07 |
1.0.8 (r1, android)
Platforms
android
Toolchains
cmake { default-recipe = "apotocki/cmake", version = ">= 3.20" }ninja { default-recipe = "apotocki/ninja", version = ">= 1.10" }
Recipe files
CMakeLists.txt
# libbz2 of the otok recipe: the objects of the release's Makefile (OBJS), without the bzip2 and bzip2recover
# programs, static or shared as BUILD_SHARED_LIBS says.
cmake_minimum_required(VERSION 3.20...4.0)
project(bzip2 VERSION 1.0.8 LANGUAGES C)
add_library(bz2 blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c)
# the soname of Makefile-libbz2_so: libbz2.so.1.0
set_target_properties(bz2 PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1.0)
if(WIN32)
# bzlib.h declares the API without dllexport
set_target_properties(bz2 PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
if(MSVC)
target_compile_definitions(bz2 PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
install(TARGETS bz2 RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(FILES bzlib.h DESTINATION include)
build.lua
-- libbz2 through the recipe's CMakeLists.txt: the release has only makefiles (a static library, a Linux
-- shared one, MSVC's makefile.msc), no CMake project. What it installs: libbz2.a, or libbz2.so with its links.
function build(slice, options, deps)
otok.copy(slice.recipe .. "/CMakeLists.txt", slice.source .. "/CMakeLists.txt")
otok.cmake{}
local p = slice.prefix
local lib = otok.glob(slice.linkage == "static" and "lib/libbz2.a" or "lib/libbz2.so", p)[1]
return { libraries = { bz2 = lib }, headers = p .. "/include" }
end
recipe.toml
# The otok recipe of bzip2 (https://github.com/apotocki/otok): libbz2 for Android, from the release archive; static
# or dynamic.
[recipe]
api = 1
library = "bzip2"
name = "bzip2"
version = "1.0.8"
revision = 1
license = "bzip2-1.0.6"
license-files = ["LICENSE"]
homepage = "https://sourceware.org/bzip2/"
description = "libbz2, the bzip2 compression library."
keywords = ["compression", "bzip2"]
linkage = ["static", "dynamic"]
[source]
url = "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz"
sha256 = "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269"
[platforms]
supported = ["android"]
build-on = ["*/ndk"]
[toolchains]
cmake = { version = ">= 3.20", default-recipe = "apotocki/cmake" }
ninja = { version = ">= 1.10", default-recipe = "apotocki/ninja" }
[[product]]
name = "BZip2"
libraries = ["bz2"]