Skip to content

Commit bcb3bc1

Browse files
committed
added updated chafa as a submodule
1 parent 5f0d3e9 commit bcb3bc1

File tree

8 files changed

+66
-10
lines changed

8 files changed

+66
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dist
1919
resources/npm_licenses.txt
2020
.podman
2121
.podman-run
22+
third_party/chafa_source/build
2223

2324
resources/out/bunterm
2425

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "third_party/chafa_source"]
2+
path = third_party/chafa_source
3+
url = https://github.com/hpjansson/chafa.git

Contributing.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ the dependencies
2727
- [Taskfile https://taskfile.dev/installation/](https://taskfile.dev/installation/) Installed by npm, or install globally for building and running the project, If you want to install globally and used uv in the last step, you can install it with ` uv tool install go-task-bin`
2828
- [ninja https://github.com/ninja-build/ninja/releases] (https://github.com/ninja-build/ninja/releases) as a build system used by meson
2929
- Pkg-config, gcc, and cmake with `sudo apt install pkg-config build-essential cmake` on ubuntu
30-
- [chafa](https://github.com/hpjansson/chafa) for terminal graphics, on ubuntu: `sudo apt install glib-2.0 chafa libchafa-dev`
3130
- Optional: [vscode](https://code.visualstudio.com/) with these recommended extensions:
3231
- "mesonbuild.mesonbuild",
3332
- "ms-vscode.cpptools-extension-pack",
@@ -37,6 +36,10 @@ the dependencies
3736
- "task.vscode-task",
3837
- "redhat.vscode-yaml"
3938

39+
```sh
40+
git submodule update --init --recursive
41+
``
42+
4043
### Version map
4144
These are the versions of the tools used to build and run the project:
4245
- Bun 1.2.21
@@ -45,10 +48,11 @@ These are the versions of the tools used to build and run the project:
4548
- pkg-cofig 1.8.1
4649
- gcc 13.3.0
4750
- cmake 3.28.3
48-
- chafa 1.14.0
4951
- see third_party/Readme.md for the versions of the bundled dependencies
5052

5153

54+
55+
5256
# Running and building
5357

5458
This project uses [task](https://taskfile.dev/) to manage tasks,

Taskfile.dist.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ tasks:
6060
desc: Build everything need to run term.everything!mmulet.com
6161

6262

63+
6364
# Shared publish flow (handles both local and podman)
6465
publish:_common:
6566
internal: true
@@ -205,7 +206,7 @@ tasks:
205206
includes:
206207
c-interop:
207208
taskfile: ./c_interop
208-
internal: true
209+
internal: false
209210
third-party:
210211
taskfile: ./third_party
211212
internal: true

c_interop/Taskfile.dist.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,59 @@ tasks:
1616
meson install -C build --no-rebuild
1717
silent: true
1818
env:
19-
PKG_CONFIG_PATH:: '{{.chafa_PKG_CONFIG_PATH}}'
19+
PKG_CONFIG_PATH: '{{.ROOT_DIR}}/{{.chafa_PKG_CONFIG_PATH}}'
2020
clean:
2121
dir: ..
2222
deps:
2323
- clean-setup
24+
- clean-chafa
2425
cmds:
2526
- rm -rf {{.ROOT_DIR}}/{{.libinterop_OUT_DIR}}
2627

2728

28-
build-setup:
29+
build-chafa:
30+
internal: true
31+
silent: true
32+
cmds:
33+
- |
34+
cd {{.ROOT_DIR}}/third_party/chafa_source
35+
mkdir -p build
36+
cd build
37+
../autogen.sh --prefix={{.ROOT_DIR}}/{{.chafa_OUT_DIR}}
38+
make -j$(nproc)
39+
make install
40+
status:
41+
- test -d {{.ROOT_DIR}}/{{.chafa_LIB_DIR}}
42+
43+
clean-chafa:
44+
cmds:
45+
- |
46+
cd {{.ROOT_DIR}}/third_party/chafa_source
47+
make distclean || true
48+
- rm -rf {{.ROOT_DIR}}/{{.chafa_OUT_DIR}}
49+
- rm -rf {{.ROOT_DIR}}/third_party/chafa_source/build
50+
51+
2952

53+
54+
build-setup:
55+
deps:
56+
- build-chafa
3057
internal: true
3158
silent: true
3259
cmds:
3360
- |
3461
cd {{.TASKFILE_DIR}}
62+
echo "Package config path is {{.PKG_CONFIG_PATH}} {{.chafa_PKG_CONFIG_PATH}}"
3563
meson setup build --prefix={{.ROOT_DIR}}/{{.libinterop_OUT_DIR}}
3664
env:
37-
PKG_CONFIG_PATH: '{{.chafa_PKG_CONFIG_PATH}}'
65+
PKG_CONFIG_PATH: '{{.ROOT_DIR}}/{{.chafa_PKG_CONFIG_PATH}}'
3866
status:
3967
- test -d {{.TASKFILE_DIR}}/build
4068

4169
clean-setup:
42-
70+
deps:
71+
- clean-chafa
4372
cmds:
4473
- rm -rf {{.TASKFILE_DIR}}/build
4574

c_interop/meson.build

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ project('libinterop', 'cpp', version: '1.2', default_options: [
77

88
include = include_directories('include')
99

10-
chafa = dependency('chafa', version: '>=01.8.0')
10+
chafa = dependency('chafa', version: '>=1.8.0')
11+
# chafa_libdir = chafa.get_pkgconfig_variable('libdir')
12+
chafa_libdir = chafa.get_variable(pkgconfig: 'libdir')
1113

1214
libinterop = shared_library('interop',
1315
'src/listen_to_wayland.cpp',
@@ -45,7 +47,21 @@ libinterop = shared_library('interop',
4547
override_options: 'b_lundef=false',
4648
dependencies: [
4749
chafa
48-
])
50+
],
51+
# Ensure the loader can find libchafa at runtime
52+
# - Use the system libdir reported by pkg-config
53+
# - Also allow looking relative to the .node location via $ORIGIN
54+
install_rpath: chafa_libdir + ':$ORIGIN',
55+
build_rpath: chafa_libdir + ':$ORIGIN',
56+
# install_rpath: [ chafa_libdir, '$ORIGIN' ],
57+
# Make it runnable from the build dir too
58+
# link_args: [
59+
# '-Wl,-rpath,' + chafa_libdir,
60+
# '-Wl,-rpath,$ORIGIN'
61+
# ]
62+
63+
64+
)
4965

5066

5167

resources/ContainerFile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ RUN apt-get update && \
1212
pkg-config build-essential cmake ninja-build \
1313
libglib2.0-dev chafa libchafa-dev \
1414
software-properties-common \
15-
file unzip
15+
file unzip autoconf automake libtool \
16+
libfreetype-dev
1617

1718

1819
# Ensure Bun's global bin is on PATH

third_party/chafa_source

Submodule chafa_source added at 60c6eaf

0 commit comments

Comments
 (0)