Skip to content

Commit e1a7579

Browse files
authored
Merge pull request #95 from assambar/add-bzip2
feat: Add libs/bzip2 to WLR
2 parents 0a95aed + ffa3f41 commit e1a7579

File tree

11 files changed

+172
-7
lines changed

11 files changed

+172
-7
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build libs-bzip2
2+
on:
3+
push:
4+
# By specifying branches explicitly, we avoid this workflow from
5+
# running on tag push. We have a dedicated workflow to be ran when
6+
# a tag is pushed.
7+
branches:
8+
- main
9+
paths:
10+
- ".github/**"
11+
- "libs/bzip2/**"
12+
- "libs/*"
13+
- "scripts/**"
14+
- "Makefile*"
15+
- "*.sh"
16+
pull_request:
17+
jobs:
18+
build-libs-bzip2:
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- version: 1.0.8
24+
uses: ./.github/workflows/reusable-build-lib.yaml
25+
with:
26+
target: bzip2/v${{ matrix.version }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Note that for this workflow to be triggered, the tag needs to be
2+
# created of the form `libs/bzip2/<version>+<buildinfo>`, where <buildinfo>
3+
# by convention is YYYYMMDD-<short-sha> (short SHA can be calculated
4+
# with `git rev-parse --short HEAD`).
5+
name: Release libs-bzip2
6+
on:
7+
push:
8+
tags:
9+
- libs/bzip2/*
10+
jobs:
11+
release-libs-bzip2:
12+
uses: ./.github/workflows/reusable-release-external-lib.yaml
13+
with:
14+
target-name: "bzip2"
15+
trigger: ${{ github.event.ref }}

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ oci-python-3.11.1-wasmedge: python/wasmedge-v3.11.1
6363
.
6464

6565
LIBS := \
66+
bzip2 \
6667
icu \
6768
libjpeg \
6869
libpng \

libs/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.PHONY: clean
22
clean:
33
make -C bundle_wlr clean
4+
make -C bzip2 clean
45
make -C icu clean
56
make -C libjpeg clean
67
make -C libpng clean

libs/bzip2/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
WASI_SDK_VERSION ?= 19.0
2+
3+
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
4+
REPO_ROOT := $(ROOT_DIR)../..
5+
6+
include $(REPO_ROOT)/Makefile.helpers
7+
8+
$(eval $(call create_default_external_lib_targets,$(REPO_ROOT),bzip2,$(WASI_SDK_VERSION)))

libs/bzip2/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# About
2+
3+
This folder builds assets of the bzip2 project.
4+
5+
The main project page is at [https://www.sourceware.org/bzip2/](https://www.sourceware.org/bzip2/).
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
From e493fcd0205797c266e10b5d50402d49f4bd97fc Mon Sep 17 00:00:00 2001
2+
From: Asen Alexandrov <[email protected]>
3+
Date: Mon, 24 Apr 2023 11:45:59 +0300
4+
Subject: [PATCH] chore: Add libinstall to Makefile
5+
6+
7+
diff --git a/Makefile b/Makefile
8+
index f8a1772..2889612 100644
9+
--- a/Makefile
10+
+++ b/Makefile
11+
@@ -25,6 +25,7 @@ CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
12+
13+
# Where you want it installed when you do 'make install'
14+
PREFIX=/usr/local
15+
+LIBDIR=$(PREFIX)/lib
16+
17+
18+
OBJS= blocksort.o \
19+
@@ -69,12 +70,18 @@ test: bzip2
20+
cmp sample3.tst sample3.ref
21+
@cat words3
22+
23+
-install: bzip2 bzip2recover
24+
+libinstall: libbz2.a
25+
+ if ( test ! -d $(LIBDIR) ) ; then mkdir -p $(LIBDIR) ; fi
26+
+ if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
27+
+ cp -f bzlib.h $(PREFIX)/include
28+
+ chmod a+r $(PREFIX)/include/bzlib.h
29+
+ cp -f libbz2.a $(LIBDIR)
30+
+ chmod a+r $(LIBDIR)/libbz2.a
31+
+
32+
+install: bzip2 bzip2recover libinstall
33+
if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
34+
- if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
35+
if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi
36+
if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi
37+
- if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
38+
cp -f bzip2 $(PREFIX)/bin/bzip2
39+
cp -f bzip2 $(PREFIX)/bin/bunzip2
40+
cp -f bzip2 $(PREFIX)/bin/bzcat
41+
@@ -85,10 +92,6 @@ install: bzip2 bzip2recover
42+
chmod a+x $(PREFIX)/bin/bzip2recover
43+
cp -f bzip2.1 $(PREFIX)/man/man1
44+
chmod a+r $(PREFIX)/man/man1/bzip2.1
45+
- cp -f bzlib.h $(PREFIX)/include
46+
- chmod a+r $(PREFIX)/include/bzlib.h
47+
- cp -f libbz2.a $(PREFIX)/lib
48+
- chmod a+r $(PREFIX)/lib/libbz2.a
49+
cp -f bzgrep $(PREFIX)/bin/bzgrep
50+
ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
51+
ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
52+
--
53+
2.38.1
54+

libs/bzip2/v1.0.8/wlr-build.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ ! -v WLR_ENV ]]
4+
then
5+
echo "WLR build environment is not set"
6+
exit 1
7+
fi
8+
9+
export CFLAGS_CONFIG="-O0"
10+
11+
export CFLAGS_WASI="--sysroot=${WASI_SYSROOT}"
12+
13+
export CFLAGS_BUILD='-Werror -Wno-error=format -Wno-error=deprecated-non-prototype -Wno-error=unknown-warning-option'
14+
15+
export CFLAGS="${CFLAGS_CONFIG} ${CFLAGS_WASI} ${CFLAGS_BUILD}"
16+
17+
cd "${WLR_SOURCE_PATH}"
18+
19+
source ${WLR_REPO_ROOT}/scripts/build-helpers/wlr_pkg_config.sh
20+
21+
BZIP2_MAKE_ARGS="CC=${CC} AR=${AR} RANLIB=${RANLIB} PREFIX=${WLR_OUTPUT} LIBDIR=${WLR_OUTPUT}/lib/wasm32-wasi"
22+
23+
logStatus "Building... "
24+
make ${BZIP2_MAKE_ARGS} -j libbz2.a || exit 1
25+
26+
logStatus "Preparing artifacts... "
27+
make ${BZIP2_MAKE_ARGS} libinstall || exit 1
28+
29+
logStatus "Generating pkg-config file for libbz2.a"
30+
DESCRIPTION="libbzip2 is a library for lossless, block-sorting data compression"
31+
EXTRA_LINK_FLAGS="-lbz2"
32+
33+
wlr_pkg_config_create_pc_file "bzip2" "${WLR_PACKAGE_VERSION}" "${DESCRIPTION}" "${EXTRA_LINK_FLAGS}" || exit 1
34+
35+
wlr_package_lib
36+
37+
logStatus "DONE. Artifacts in ${WLR_OUTPUT}"

libs/bzip2/v1.0.8/wlr-env-repo.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ $1 == "--unset" ]]
4+
then
5+
unset WLR_REPO
6+
unset WLR_REPO_BRANCH
7+
unset WLR_ENV_NAME
8+
unset WLR_PACKAGE_VERSION
9+
unset WLR_PACKAGE_NAME
10+
return
11+
fi
12+
13+
export WLR_REPO=https://gitlab.com/bzip2/bzip2
14+
export WLR_REPO_BRANCH=bzip2-1.0.8
15+
export WLR_ENV_NAME=bzip2/v1.0.8
16+
export WLR_PACKAGE_VERSION=1.0.8
17+
export WLR_PACKAGE_NAME=bzip2

libs/bzip2/v1.0.8/wlr-tag.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export WLR_TAG="libs/bzip2/1.0.8"

0 commit comments

Comments
 (0)