Merge pull request 'type per command, binding generation macros, nix package' (#4) from next into main
Reviewed-on: #4
This commit is contained in:
commit
ff9b0a9dc8
53 changed files with 4170 additions and 2384 deletions
14
.github/workflows/rust.yml
vendored
14
.github/workflows/rust.yml
vendored
|
|
@ -30,15 +30,10 @@ jobs:
|
||||||
- name: build
|
- name: build
|
||||||
run: cargo build
|
run: cargo build
|
||||||
|
|
||||||
- name: generate bindings
|
|
||||||
run: ./generate-binding.sh
|
|
||||||
- name: check that generated files did not change
|
|
||||||
run: output=$(git status --porcelain) && [ -z "$output" ]
|
|
||||||
|
|
||||||
- name: build example -- glibc release
|
- name: build example -- glibc release
|
||||||
run: cd example && make clean && make TARGET=aarch64-unknown-linux-gnu PROFILE=release
|
run: cd example && make -r clean-all && make -r LIBC=gnu LINK=dynamic PROFILE=release
|
||||||
- name: build example -- glibc debug
|
- name: build example -- glibc debug
|
||||||
run: cd example && make clean && make TARGET=aarch64-unknown-linux-gnu PROFILE=debug
|
run: cd example && make -r clean-all && make -r LIBC=gnu LINK=dynamic PROFILE=debug
|
||||||
|
|
||||||
build-size-gnu-unstable:
|
build-size-gnu-unstable:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -52,5 +47,6 @@ jobs:
|
||||||
- name: install rust targets
|
- name: install rust targets
|
||||||
run: rustup toolchain install nightly -t aarch64-unknown-linux-gnu -c rust-src --no-self-update
|
run: rustup toolchain install nightly -t aarch64-unknown-linux-gnu -c rust-src --no-self-update
|
||||||
|
|
||||||
- name: build example -- glibc size-optimized
|
- name: build example -- glibc size_optimized
|
||||||
run: cd example && make clean && make TARGET=aarch64-unknown-linux-gnu PROFILE=size-optimized CARGO="rustup run nightly cargo" LTO=1
|
run: cd example && make clean-all -r
|
||||||
|
&& make -r LIBC=gnu LINK=dynamic PROFILE=size_optimized CARGO="rustup run nightly cargo" LTO=1
|
||||||
|
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -4,4 +4,5 @@ out
|
||||||
.direnv
|
.direnv
|
||||||
.envrc
|
.envrc
|
||||||
result
|
result
|
||||||
mutants.*
|
mutants.*
|
||||||
|
_out_*
|
||||||
382
Cargo.lock
generated
382
Cargo.lock
generated
|
|
@ -4,15 +4,24 @@ version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler2"
|
name = "adler2"
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aho-corasick"
|
||||||
|
version = "1.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "0.6.18"
|
version = "0.6.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"anstyle-parse",
|
"anstyle-parse",
|
||||||
|
|
@ -25,44 +34,44 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle"
|
name = "anstyle"
|
||||||
version = "1.0.10"
|
version = "1.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-parse"
|
name = "anstyle-parse"
|
||||||
version = "0.2.6"
|
version = "0.2.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"utf8parse",
|
"utf8parse",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-query"
|
name = "anstyle-query"
|
||||||
version = "1.1.2"
|
version = "1.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-wincon"
|
name = "anstyle-wincon"
|
||||||
version = "3.0.7"
|
version = "3.0.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
|
checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"once_cell",
|
"once_cell_polyfill",
|
||||||
"windows-sys",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.9.0"
|
version = "2.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
|
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitvec"
|
name = "bitvec"
|
||||||
|
|
@ -95,30 +104,11 @@ dependencies = [
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cbindgen"
|
|
||||||
version = "0.28.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff"
|
|
||||||
dependencies = [
|
|
||||||
"clap",
|
|
||||||
"heck",
|
|
||||||
"indexmap",
|
|
||||||
"log",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"syn",
|
|
||||||
"tempfile",
|
|
||||||
"toml",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.21"
|
version = "1.2.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0"
|
checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
|
|
@ -127,42 +117,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap"
|
|
||||||
version = "4.5.37"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071"
|
|
||||||
dependencies = [
|
|
||||||
"clap_builder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap_builder"
|
|
||||||
version = "4.5.37"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2"
|
|
||||||
dependencies = [
|
|
||||||
"anstream",
|
|
||||||
"anstyle",
|
|
||||||
"clap_lex",
|
|
||||||
"strsim",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap_lex"
|
|
||||||
version = "0.7.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorchoice"
|
name = "colorchoice"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32fast"
|
name = "crc32fast"
|
||||||
|
|
@ -174,32 +137,33 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "equivalent"
|
name = "env_filter"
|
||||||
version = "1.0.2"
|
version = "0.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "errno"
|
|
||||||
version = "0.3.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"log",
|
||||||
"windows-sys",
|
"regex",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "env_logger"
|
||||||
version = "2.3.0"
|
version = "0.11.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
|
"env_filter",
|
||||||
|
"jiff",
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.1.1"
|
version = "1.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece"
|
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
|
|
@ -213,9 +177,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.3.2"
|
version = "0.3.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0"
|
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
|
|
@ -224,25 +188,14 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "inherent"
|
||||||
version = "0.15.3"
|
version = "1.0.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3"
|
checksum = "6c38228f24186d9cc68c729accb4d413be9eaed6ad07ff79e0270d9e56f3de13"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "heck"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "indexmap"
|
|
||||||
version = "2.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"proc-macro2",
|
||||||
"hashbrown",
|
"quote",
|
||||||
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -252,10 +205,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "jiff"
|
||||||
version = "1.0.15"
|
version = "0.2.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49"
|
||||||
|
dependencies = [
|
||||||
|
"jiff-static",
|
||||||
|
"log",
|
||||||
|
"portable-atomic",
|
||||||
|
"portable-atomic-util",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff-static"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jobserver"
|
name = "jobserver"
|
||||||
|
|
@ -269,15 +240,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.172"
|
version = "0.2.174"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
|
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "linux-raw-sys"
|
|
||||||
version = "0.9.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
|
|
@ -287,15 +252,15 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.7.4"
|
version = "2.7.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.8.8"
|
version = "0.8.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
|
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler2",
|
"adler2",
|
||||||
]
|
]
|
||||||
|
|
@ -306,12 +271,39 @@ version = "1.21.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell_polyfill"
|
||||||
|
version = "1.70.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "paste"
|
||||||
|
version = "1.0.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.32"
|
version = "0.3.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "portable-atomic"
|
||||||
|
version = "1.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "portable-atomic-util"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
|
||||||
|
dependencies = [
|
||||||
|
"portable-atomic",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.95"
|
version = "1.0.95"
|
||||||
|
|
@ -332,9 +324,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "r-efi"
|
name = "r-efi"
|
||||||
version = "5.2.0"
|
version = "5.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
|
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "radium"
|
name = "radium"
|
||||||
|
|
@ -342,6 +334,35 @@ version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex"
|
||||||
|
version = "1.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||||
|
dependencies = [
|
||||||
|
"aho-corasick",
|
||||||
|
"memchr",
|
||||||
|
"regex-automata",
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-automata"
|
||||||
|
version = "0.4.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
||||||
|
dependencies = [
|
||||||
|
"aho-corasick",
|
||||||
|
"memchr",
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-syntax"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-lzma"
|
name = "rust-lzma"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
|
|
@ -352,25 +373,6 @@ dependencies = [
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustix"
|
|
||||||
version = "1.0.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"errno",
|
|
||||||
"libc",
|
|
||||||
"linux-raw-sys",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ryu"
|
|
||||||
version = "1.0.20"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.219"
|
version = "1.0.219"
|
||||||
|
|
@ -391,36 +393,16 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_json"
|
|
||||||
version = "1.0.140"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
|
|
||||||
dependencies = [
|
|
||||||
"itoa",
|
|
||||||
"memchr",
|
|
||||||
"ryu",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_spanned"
|
|
||||||
version = "0.6.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servicepoint"
|
name = "servicepoint"
|
||||||
version = "0.14.1"
|
version = "0.15.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f6bd5cfa49c73aeecb344680ffbf697abf73e0563a441b93b9723ae43867500f"
|
checksum = "2800caad491cb44f67e5dd5b8c61ece368eecfe588155d03c7d9864acbad6919"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitvec",
|
"bitvec",
|
||||||
"bzip2",
|
"bzip2",
|
||||||
"flate2",
|
"flate2",
|
||||||
|
"inherent",
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rust-lzma",
|
"rust-lzma",
|
||||||
|
|
@ -430,9 +412,10 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servicepoint_binding_c"
|
name = "servicepoint_binding_c"
|
||||||
version = "0.14.1"
|
version = "0.15.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cbindgen",
|
"env_logger",
|
||||||
|
"paste",
|
||||||
"servicepoint",
|
"servicepoint",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -442,17 +425,11 @@ version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "strsim"
|
|
||||||
version = "0.11.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.101"
|
version = "2.0.104"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
|
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -465,19 +442,6 @@ version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tempfile"
|
|
||||||
version = "3.19.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf"
|
|
||||||
dependencies = [
|
|
||||||
"fastrand",
|
|
||||||
"getrandom",
|
|
||||||
"once_cell",
|
|
||||||
"rustix",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "2.0.12"
|
version = "2.0.12"
|
||||||
|
|
@ -498,47 +462,6 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.8.22"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"serde_spanned",
|
|
||||||
"toml_datetime",
|
|
||||||
"toml_edit",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_datetime"
|
|
||||||
version = "0.6.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_edit"
|
|
||||||
version = "0.22.26"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
|
|
||||||
dependencies = [
|
|
||||||
"indexmap",
|
|
||||||
"serde",
|
|
||||||
"serde_spanned",
|
|
||||||
"toml_datetime",
|
|
||||||
"toml_write",
|
|
||||||
"winnow",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_write"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.18"
|
version = "1.0.18"
|
||||||
|
|
@ -639,15 +562,6 @@ version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winnow"
|
|
||||||
version = "0.7.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d9fb597c990f03753e08d3c29efbfcf2019a003b4bf4ba19225c158e1549f0f3"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wit-bindgen-rt"
|
name = "wit-bindgen-rt"
|
||||||
version = "0.39.0"
|
version = "0.39.0"
|
||||||
|
|
|
||||||
21
Cargo.toml
21
Cargo.toml
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "servicepoint_binding_c"
|
name = "servicepoint_binding_c"
|
||||||
version = "0.14.1"
|
version = "0.15.0"
|
||||||
publish = true
|
publish = true
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
|
@ -8,23 +8,26 @@ description = "C bindings for the servicepoint crate."
|
||||||
homepage = "https://docs.rs/crate/servicepoint_binding_c"
|
homepage = "https://docs.rs/crate/servicepoint_binding_c"
|
||||||
repository = "https://git.berlin.ccc.de/servicepoint/servicepoint"
|
repository = "https://git.berlin.ccc.de/servicepoint/servicepoint"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
links = "servicepoint"
|
|
||||||
keywords = ["cccb", "cccb-servicepoint", "cbindgen"]
|
keywords = ["cccb", "cccb-servicepoint", "cbindgen"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
cbindgen = "0.28.0"
|
|
||||||
|
|
||||||
[dependencies.servicepoint]
|
[dependencies.servicepoint]
|
||||||
package = "servicepoint"
|
version = "0.15.1"
|
||||||
version = "0.14.1"
|
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
|
[dependencies.env_logger]
|
||||||
|
version = "0.11.8"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
paste = "1.0.15"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
all_compressions = ["servicepoint/all_compressions"]
|
all_compressions = ["servicepoint/all_compressions"]
|
||||||
default = ["all_compressions", "servicepoint/default"]
|
default = ["all_compressions", "servicepoint/default", "env_logger"]
|
||||||
|
env_logger = ["dep:env_logger"]
|
||||||
|
|
||||||
[lints.rust]
|
[lints.rust]
|
||||||
missing-docs = "warn"
|
missing-docs = "warn"
|
||||||
|
|
@ -36,7 +39,7 @@ missing_safety_doc = "allow"
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
[profile.size-optimized]
|
[profile.size_optimized]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
opt-level = 'z' # Optimize for size
|
opt-level = 'z' # Optimize for size
|
||||||
lto = true # Enable link-time optimization
|
lto = true # Enable link-time optimization
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
# servicepoint_binding_c
|
# servicepoint_binding_c
|
||||||
|
|
||||||
|
[](https://git.berlin.ccc.de/servicepoint/servicepoint_binding_c/releases)
|
||||||
[](https://crates.io/crates/servicepoint)
|
[](https://crates.io/crates/servicepoint)
|
||||||
[](https://crates.io/crates/servicepoint)
|
[](https://crates.io/crates/servicepoint)
|
||||||
[](https://docs.rs/servicepoint/latest/servicepoint/)
|
[](https://docs.rs/servicepoint/latest/servicepoint/)
|
||||||
[](./LICENSE)
|
[](./LICENSE)
|
||||||
|
[](https://git.berlin.ccc.de/servicepoint/servicepoint_binding_c)
|
||||||
|
|
||||||
In [CCCB](https://berlin.ccc.de/), there is a big pixel matrix hanging on the wall.
|
In [CCCB](https://berlin.ccc.de/), there is a big pixel matrix hanging on the wall.
|
||||||
It is called "Service Point Display" or "Airport Display".
|
It is called "Service Point Display" or "Airport Display".
|
||||||
|
|
@ -12,7 +14,7 @@ This crate contains C bindings for the [servicepoint](https://git.berlin.ccc.de/
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```c++
|
```c
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "servicepoint.h"
|
#include "servicepoint.h"
|
||||||
|
|
||||||
|
|
|
||||||
35
build.rs
35
build.rs
|
|
@ -1,35 +0,0 @@
|
||||||
//! Build script generating the header for the `servicepoint` C library.
|
|
||||||
//!
|
|
||||||
//! When the environment variable `SERVICEPOINT_HEADER_OUT` is set, the header is copied there from
|
|
||||||
//! the out directory. This can be used to use the build script as a command line tool from other
|
|
||||||
//! build tools.
|
|
||||||
|
|
||||||
use std::{env, fs::copy};
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
|
||||||
println!("cargo::rerun-if-changed={crate_dir}");
|
|
||||||
|
|
||||||
let config =
|
|
||||||
cbindgen::Config::from_file(crate_dir.clone() + "/cbindgen.toml")
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let output_dir = env::var("OUT_DIR").unwrap();
|
|
||||||
let header_file = output_dir.clone() + "/servicepoint.h";
|
|
||||||
|
|
||||||
if let Ok(bindings) = cbindgen::generate_with_config(crate_dir, config) {
|
|
||||||
bindings.write_to_file(&header_file);
|
|
||||||
|
|
||||||
println!("cargo:include={output_dir}");
|
|
||||||
|
|
||||||
println!("cargo::rerun-if-env-changed=SERVICEPOINT_HEADER_OUT");
|
|
||||||
if let Ok(header_out) = env::var("SERVICEPOINT_HEADER_OUT") {
|
|
||||||
let header_copy = header_out + "/servicepoint.h";
|
|
||||||
println!("cargo:warning=Copying header to {header_copy}");
|
|
||||||
copy(header_file, &header_copy).unwrap();
|
|
||||||
println!("cargo::rerun-if-changed={header_copy}");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
eprintln!("cargo:warning=Servicepoint header could not be generated");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -16,27 +16,28 @@ line_endings = "LF"
|
||||||
|
|
||||||
############################# Codegen Options ##################################
|
############################# Codegen Options ##################################
|
||||||
|
|
||||||
style = "type"
|
style = "both"
|
||||||
usize_is_size_t = true
|
usize_is_size_t = true
|
||||||
|
|
||||||
# this is needed because otherwise the order in the C bindings is different on different machines
|
# this is needed because otherwise the order in the C bindings is different on different machines
|
||||||
sort_by = "Name"
|
sort_by = "Name"
|
||||||
|
|
||||||
|
include_guard = "SERVICEPOINT_BINDINGS_C"
|
||||||
|
|
||||||
[parse]
|
[parse]
|
||||||
parse_deps = true
|
parse_deps = true
|
||||||
include = ["servicepoint", "std"]
|
include = ["servicepoint", "std"]
|
||||||
extra_bindings = ["servicepoint"]
|
extra_bindings = ["servicepoint", "servicepoint_binding_c"]
|
||||||
|
|
||||||
[parse.expand]
|
[parse.expand]
|
||||||
features = ["full"]
|
crates = ["servicepoint_binding_c", "paste"]
|
||||||
|
features = []
|
||||||
|
|
||||||
[export]
|
[export]
|
||||||
include = []
|
include = []
|
||||||
exclude = []
|
exclude = ["BitVec"]
|
||||||
|
|
||||||
[export.rename]
|
[export.rename]
|
||||||
"SpBitVec" = "BitVec"
|
|
||||||
"SpByteSlice" = "ByteSlice"
|
|
||||||
|
|
||||||
[enum]
|
[enum]
|
||||||
rename_variants = "QualifiedScreamingSnakeCase"
|
rename_variants = "QualifiedScreamingSnakeCase"
|
||||||
|
|
|
||||||
71
devShells.nix
Normal file
71
devShells.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
fenix,
|
||||||
|
selfPkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
common = {
|
||||||
|
RUST_BACKTRACE = 1;
|
||||||
|
RUST_LOG = "all";
|
||||||
|
packages = with pkgs; [
|
||||||
|
gdb
|
||||||
|
nix-output-monitor
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in rec {
|
||||||
|
nightly = pkgs.mkShell ( common // {
|
||||||
|
inputsFrom = [
|
||||||
|
selfPkgs.servicepoint-binding-c-nightly-release
|
||||||
|
];
|
||||||
|
packages = with pkgs; [
|
||||||
|
cargo-expand
|
||||||
|
cargo-tarpaulin
|
||||||
|
nix-output-monitor
|
||||||
|
gcc
|
||||||
|
gnumake
|
||||||
|
rustfmt
|
||||||
|
xe
|
||||||
|
libgcc
|
||||||
|
libunwind
|
||||||
|
pkgsStatic.gcc
|
||||||
|
pkgsStatic.libgcc
|
||||||
|
pkgsStatic.musl
|
||||||
|
rust-cbindgen
|
||||||
|
];
|
||||||
|
});
|
||||||
|
stable = pkgs.mkShell (common // {
|
||||||
|
inputsFrom = [
|
||||||
|
selfPkgs.servicepoint-binding-c
|
||||||
|
selfPkgs.announce
|
||||||
|
];
|
||||||
|
packages = with pkgs; [
|
||||||
|
(pkgs.symlinkJoin {
|
||||||
|
name = "rust-toolchain";
|
||||||
|
paths = with pkgs; [
|
||||||
|
rustc
|
||||||
|
cargo
|
||||||
|
rustPlatform.rustcSrc
|
||||||
|
rustPlatform.rustLibSrc
|
||||||
|
rustfmt
|
||||||
|
clippy
|
||||||
|
cargo-expand
|
||||||
|
cargo-tarpaulin
|
||||||
|
];
|
||||||
|
})
|
||||||
|
cargo-expand
|
||||||
|
cargo-tarpaulin
|
||||||
|
gcc
|
||||||
|
gnumake
|
||||||
|
xe
|
||||||
|
libgcc
|
||||||
|
libunwind
|
||||||
|
pkgsStatic.gcc
|
||||||
|
pkgsStatic.libgcc
|
||||||
|
pkgsStatic.musl
|
||||||
|
];
|
||||||
|
|
||||||
|
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
|
||||||
|
});
|
||||||
|
default = stable;
|
||||||
|
}
|
||||||
194
example/Makefile
194
example/Makefile
|
|
@ -1,129 +1,121 @@
|
||||||
|
# based on https://make.mad-scientist.net/papers/multi-architecture-builds/
|
||||||
|
|
||||||
|
_libc := $(if $(LIBC),$(LIBC),gnu)
|
||||||
|
ifeq (,$(filter gnu musl,$(_libc)))
|
||||||
|
_link_type := $(error "LIBC has to be set to one of: gnu, musl")
|
||||||
|
endif
|
||||||
|
|
||||||
|
_link_type := $(if $(LINK),$(LINK),dynamic)
|
||||||
|
ifeq (,$(filter dynamic static,$(_link_type)))
|
||||||
|
_link_type := $(error "LINK has to be set to one of: dynamic, static")
|
||||||
|
endif
|
||||||
|
|
||||||
|
_profile := $(if $(PROFILE),$(PROFILE),release)
|
||||||
|
ifeq (,$(filter release debug size_optimized,$(_profile)))
|
||||||
|
_profile := $(error "PROFILE has to be set to one of: debug, release, size_optimized")
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCH ?= $(shell uname -m)
|
||||||
|
RUST_TARGET := $(ARCH)-unknown-linux-$(_libc)
|
||||||
|
|
||||||
|
#----- Begin Boilerplate
|
||||||
|
ifeq (,$(filter _out_%,$(notdir $(CURDIR))))
|
||||||
|
include target.mk
|
||||||
|
else
|
||||||
|
#----- End Boilerplate
|
||||||
|
|
||||||
|
VPATH = $(SRCDIR)
|
||||||
|
|
||||||
CARGO ?= cargo
|
CARGO ?= cargo
|
||||||
STRIP ?= strip
|
STRIP ?= strip
|
||||||
|
CC ?= gcc
|
||||||
|
|
||||||
FEATURES := ""
|
FEATURES := ""#"env_logger"
|
||||||
|
|
||||||
THIS_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
THIS_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
REPO_ROOT := $(realpath $(THIS_DIR)/..)
|
REPO_ROOT := $(realpath $(THIS_DIR)/..)
|
||||||
export SERVICEPOINT_HEADER_OUT := $(REPO_ROOT)/include
|
CARGO_OBJDIR := cargo/$(RUST_TARGET)/$(_profile)
|
||||||
|
|
||||||
override CFG_MUSL := $(if $(CFG_MUSL),$(CFG_MUSL),$(if $(MUSL),$(MUSL),0))
|
_rust_cli_profile := $(if $(filter $(_profile),debug),dev,$(_profile))
|
||||||
override CFG_PROFILE := $(if $(CFG_PROFILE),$(CFG_PROFILE),$(if $(PROFILE),$(PROFILE),release))
|
|
||||||
|
|
||||||
CCFLAGS += -Wall -fwhole-program -fPIE -pie
|
STRIPFLAGS += -s --strip-unneeded -R .comment -R .gnu.version -R .note -R .note.gnu.build-id -R .note.ABI-tag
|
||||||
|
|
||||||
STRIPFLAGS := -s --strip-unneeded -R .comment -R .gnu.version -R .note -R .note.gnu.build-id -R .note.ABI-tag
|
|
||||||
|
|
||||||
ifeq ($(CFG_MUSL), 1)
|
|
||||||
TARGET ?= x86_64-unknown-linux-musl
|
|
||||||
CC ?= musl-gcc
|
|
||||||
CCFLAGS += -static -lservicepoint_binding_c
|
|
||||||
RUSTFLAGS += --crate-type=staticlib -Ctarget-feature=-crt-static
|
|
||||||
else
|
|
||||||
TARGET ?= x86_64-unknown-linux-gnu
|
|
||||||
CC ?= gcc
|
|
||||||
#CCFLAGS += -shared
|
|
||||||
CCFLAGS += -Wl,-Bstatic -lservicepoint_binding_c -Wl,-Bdynamic
|
|
||||||
endif
|
|
||||||
|
|
||||||
#ifeq ($(CFG_PROFILE), size-optimized)
|
|
||||||
# CCFLAGS += -nodefaultlibs -lc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RUST_TARGET_DIR := $(REPO_ROOT)/target/$(TARGET)/$(CFG_PROFILE)
|
|
||||||
|
|
||||||
ifeq ($(CFG_PROFILE), size-optimized)
|
|
||||||
CARGO_PROFILE := size-optimized
|
|
||||||
CCFLAGS += -Oz \
|
|
||||||
-fwrapv -fomit-frame-pointer -fno-stack-protector\
|
|
||||||
-fno-unroll-loops \
|
|
||||||
-fno-unwind-tables -fno-asynchronous-unwind-tables \
|
|
||||||
-fmerge-all-constants \
|
|
||||||
-Wl,-z,norelro \
|
|
||||||
-Wl,--hash-style=gnu \
|
|
||||||
-fvisibility=hidden \
|
|
||||||
-Bsymbolic \
|
|
||||||
-Wl,--exclude-libs,ALL \
|
|
||||||
-fno-ident \
|
|
||||||
-fno-exceptions
|
|
||||||
CARGOFLAGS += -Zbuild-std="core,std,alloc,proc_macro,panic_abort" \
|
|
||||||
-Zbuild-std-features="panic_immediate_abort"
|
|
||||||
RUSTFLAGS += -Zlocation-detail=none \
|
|
||||||
-Zfmt-debug=none \
|
|
||||||
-C link-arg=-z,norelro \
|
|
||||||
-C panic=abort
|
|
||||||
#-C link-arg=--hash-style=gnu
|
|
||||||
else ifeq ($(CFG_PROFILE), release)
|
|
||||||
CARGO_PROFILE := release
|
|
||||||
CCFLAGS += -O2
|
|
||||||
else ifeq ($(CFG_PROFILE), debug)
|
|
||||||
CCFLAGS += -Og
|
|
||||||
CARGO_PROFILE := dev
|
|
||||||
else
|
|
||||||
CFG_PROFILE := $(error "PROFILE has to be set to one of: debug, release, size-optimized")
|
|
||||||
endif
|
|
||||||
|
|
||||||
CARGOFLAGS += --manifest-path=$(REPO_ROOT)/Cargo.toml \
|
CARGOFLAGS += --manifest-path=$(REPO_ROOT)/Cargo.toml \
|
||||||
--profile=$(CARGO_PROFILE) \
|
--profile=$(_rust_cli_profile) \
|
||||||
--no-default-features \
|
--no-default-features \
|
||||||
--features=$(FEATURES) \
|
--features=$(FEATURES) \
|
||||||
--target=$(TARGET)
|
--target=$(RUST_TARGET) \
|
||||||
|
--target-dir=cargo
|
||||||
|
|
||||||
ifneq ($(CFG_PROFILE), debug)
|
STATIC_LINK_LIBS += -lservicepoint_binding_c
|
||||||
CCFLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections
|
_servicepoint_cflags := -I $(REPO_ROOT)/include -L $(CARGO_OBJDIR)
|
||||||
|
CFLAGS += -Wall -Wextra -pedantic -fwhole-program -fPIE -pie
|
||||||
|
_no_debug_cflags := -ffunction-sections -fdata-sections -Wl,--gc-sections
|
||||||
|
size_optimized_CFLAGS += -Oz \
|
||||||
|
-fwrapv -fomit-frame-pointer -fno-stack-protector \
|
||||||
|
-fno-unroll-loops \
|
||||||
|
-fno-unwind-tables -fno-asynchronous-unwind-tables \
|
||||||
|
-fmerge-all-constants \
|
||||||
|
-Wl,-z,norelro \
|
||||||
|
-Wl,--hash-style=gnu \
|
||||||
|
-fvisibility=hidden \
|
||||||
|
-Bsymbolic \
|
||||||
|
-Wl,--exclude-libs,ALL \
|
||||||
|
-fno-ident \
|
||||||
|
-fno-exceptions \
|
||||||
|
$(_no_debug_cflags)
|
||||||
|
|
||||||
|
release_CFLAGS += -O2 \
|
||||||
|
$(_no_debug_cflags)
|
||||||
|
debug_CFLAGS += -Og
|
||||||
|
static_CFLAGS += -static $(STATIC_LINK_LIBS)
|
||||||
|
dynamic_CFLAGS += -Wl,-Bstatic $(STATIC_LINK_LIBS) -Wl,-Bdynamic
|
||||||
|
|
||||||
|
_servicepoint_cflags := $(shell pkg-config --libs servicepoint --cflags || echo -I $(REPO_ROOT)/include -L $(CARGO_OBJDIR))
|
||||||
|
CFLAGS += $($(_libc)_CFLAGS) $($(_profile)_CFLAGS) $($(_link_type)_CFLAGS) $(_servicepoint_cflags)
|
||||||
|
ifeq ($(LTO), 1)
|
||||||
|
CFLAGS += -flto
|
||||||
|
endif
|
||||||
|
ifeq ($(_libc),gnu)
|
||||||
|
ifeq ($(_link_type),static)
|
||||||
|
CFLAGS += $(error "statically linking glibc is known to be broken")
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
size_optimized_RUSTFLAGS += -Zlocation-detail=none \
|
||||||
|
-Zfmt-debug=none \
|
||||||
|
-C link-arg=-z,norelro \
|
||||||
|
-C panic=abort \
|
||||||
|
-C link-arg=-Wl,--hash-style=gnu
|
||||||
|
static_RUSTFLAGS += --crate-type=staticlib -Ctarget-feature=+crt-static
|
||||||
|
|
||||||
|
RUSTFLAGS += $($(_libc)_RUSTFLAGS) $($(_profile)_RUSTFLAGS) $($(_link_type)_RUSTFLAGS)
|
||||||
|
ifneq ($(_profile), debug)
|
||||||
RUSTFLAGS += -C link-arg=-s -C link-arg=-Wl,--gc-sections
|
RUSTFLAGS += -C link-arg=-s -C link-arg=-Wl,--gc-sections
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(LTO), 1)
|
# ADD NEW EXAMPLES HERE
|
||||||
CCFLAGS += -flto
|
_c_src := src/announce.c src/brightness_tester.c src/header_logger.c \
|
||||||
endif
|
src/moving_line.c src/random_stuff.c src/wiping_clear.c src/undefined.c
|
||||||
|
|
||||||
_c_src := $(wildcard ./src/*.c)
|
|
||||||
_programs := $(basename $(notdir $(_c_src)))
|
_programs := $(basename $(notdir $(_c_src)))
|
||||||
_bins := $(addprefix out/, $(_programs))
|
_bins := $(_programs)
|
||||||
_unstripped_bins := $(addsuffix _unstripped, $(_bins))
|
_unstripped_bins := $(addsuffix _unstripped, $(_bins))
|
||||||
_run_programs := $(addprefix run_, $(_programs))
|
|
||||||
_rs_src := $(wildcard ../src/**.rs) ../Cargo.lock ../Cargo.toml ../cbindgen.toml
|
|
||||||
_sp_artifacts := $(SERVICEPOINT_HEADER_OUT)/servicepoint.h $(RUST_TARGET_DIR)/libservicepoint_binding_c.a $(RUST_TARGET_DIR)/libservicepoint_binding_c.so
|
|
||||||
|
|
||||||
all: $(_bins)
|
.SUFFIXES:
|
||||||
|
|
||||||
clean: clean-c clean-rust
|
.PHONY: all build-rust
|
||||||
|
|
||||||
clean-c:
|
all: build-rust $(_bins)
|
||||||
rm -r out || true
|
|
||||||
|
|
||||||
clean-rust:
|
$(_unstripped_bins): %_unstripped : src/%.c src/helpers.h build-rust
|
||||||
rm $(SERVICEPOINT_HEADER_OUT)/servicepoint.h || true
|
$(CC) $< $(CFLAGS) -o $@
|
||||||
cargo clean
|
|
||||||
|
|
||||||
.PHONY: all clean sizes $(_run_programs) clean-c clean-rust
|
$(_bins): %: %_unstripped
|
||||||
|
|
||||||
$(_unstripped_bins): out/%_unstripped: src/%.c $(SERVICEPOINT_HEADER_OUT)/servicepoint.h $(_sp_artifacts)
|
|
||||||
mkdir -p out || true
|
|
||||||
$(CC) $< \
|
|
||||||
-I $(SERVICEPOINT_HEADER_OUT) \
|
|
||||||
-L $(RUST_TARGET_DIR) \
|
|
||||||
$(CCFLAGS) \
|
|
||||||
-o $@
|
|
||||||
|
|
||||||
$(_bins): out/%: out/%_unstripped
|
|
||||||
$(STRIP) $(STRIPFLAGS) $^ -o $@
|
$(STRIP) $(STRIPFLAGS) $^ -o $@
|
||||||
|
|
||||||
$(_sp_artifacts): $(_rs_src)
|
build-rust:
|
||||||
mkdir -p $(SERVICEPOINT_HEADER_OUT) || true
|
|
||||||
# generate servicepoint header and library to link against
|
# generate servicepoint header and library to link against
|
||||||
$(CARGO) rustc $(CARGOFLAGS) -- $(RUSTFLAGS)
|
$(CARGO) rustc $(CARGOFLAGS) -- $(RUSTFLAGS)
|
||||||
|
|
||||||
$(_run_programs): run_%: out/% FORCE
|
#----- Begin Boilerplate
|
||||||
./$<
|
endif
|
||||||
|
|
||||||
sizes: $(_bins)
|
|
||||||
ls -lB out
|
|
||||||
|
|
||||||
analyze-size: out/$(BIN)_unstripped
|
|
||||||
nm --print-size --size-sort --reverse-sort --radix=d --demangle out/$(BIN)_unstripped \
|
|
||||||
| awk '{size=$$2+0; print size "\t" $$4}' \
|
|
||||||
| less
|
|
||||||
|
|
||||||
FORCE: ;
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
#include <stdio.h>
|
#include "helpers.h"
|
||||||
#include "servicepoint.h"
|
|
||||||
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
printf("test\n");
|
sock_init();
|
||||||
|
|
||||||
UdpSocket *connection = sp_udp_open_ipv4(172, 23, 42, 29, 2342);
|
sp_udp_socket_send_header(sock, (Header) {.command_code = COMMAND_CODE_CLEAR});
|
||||||
//UdpSocket *connection = sp_udp_open_ipv4(127, 0, 0, 1, 2342);
|
|
||||||
if (connection == NULL)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
sp_udp_send_header(connection, (Header) {.command_code = COMMAND_CODE_CLEAR});
|
|
||||||
|
|
||||||
CharGrid *grid = sp_char_grid_new(5, 2);
|
CharGrid *grid = sp_char_grid_new(5, 2);
|
||||||
if (grid == NULL)
|
if (grid == NULL)
|
||||||
|
|
@ -27,11 +20,10 @@ int main(void) {
|
||||||
sp_char_grid_set(grid, 3, 1, 'l');
|
sp_char_grid_set(grid, 3, 1, 'l');
|
||||||
sp_char_grid_set(grid, 4, 1, 'd');
|
sp_char_grid_set(grid, 4, 1, 'd');
|
||||||
|
|
||||||
Packet *packet = sp_char_grid_into_packet(grid, 0, 0);
|
Packet *packet = sp_char_grid_try_into_packet(grid, 0, 0);
|
||||||
if (packet == NULL)
|
if (packet == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
sp_udp_send_packet(connection, packet);
|
sp_udp_socket_send_packet(sock, packet);
|
||||||
|
|
||||||
sp_udp_free(connection);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,35 @@
|
||||||
#include "servicepoint.h"
|
#include "servicepoint.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
|
||||||
int main(void) {
|
void enable_all_pixels(void) {
|
||||||
UdpSocket *connection = sp_udp_open_ipv4(172, 23, 42, 29, 2342);
|
|
||||||
//UdpSocket *connection = sp_udp_open_ipv4(127, 0, 0, 1, 2342);
|
|
||||||
if (connection == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
Bitmap *all_on = sp_bitmap_new_max_sized();
|
Bitmap *all_on = sp_bitmap_new_max_sized();
|
||||||
sp_bitmap_fill(all_on, true);
|
sp_bitmap_fill(all_on, true);
|
||||||
|
|
||||||
Packet *packet = sp_bitmap_into_packet(all_on, 0, 0, COMPRESSION_CODE_UNCOMPRESSED);
|
BitmapCommand *bitmapCommand = sp_bitmap_command_from_bitmap(all_on);
|
||||||
if (packet == NULL)
|
Packet *packet = sp_bitmap_command_try_into_packet(bitmapCommand);
|
||||||
return -1;
|
if (packet != NULL)
|
||||||
|
sp_udp_socket_send_packet(sock, packet);
|
||||||
|
}
|
||||||
|
|
||||||
sp_udp_send_packet(connection, packet);
|
void make_brightness_pattern(BrightnessGrid *grid) {
|
||||||
|
ByteSlice slice = sp_brightness_grid_data_ref_mut(grid);
|
||||||
|
for (size_t index = 0; index < slice.length; index++) {
|
||||||
|
slice.start[index] = (uint8_t)(index % ((size_t) Brightness_MAX));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
sock_init();
|
||||||
|
|
||||||
|
enable_all_pixels();
|
||||||
|
|
||||||
BrightnessGrid *grid = sp_brightness_grid_new(TILE_WIDTH, TILE_HEIGHT);
|
BrightnessGrid *grid = sp_brightness_grid_new(TILE_WIDTH, TILE_HEIGHT);
|
||||||
|
make_brightness_pattern(grid);
|
||||||
|
|
||||||
ByteSlice slice = sp_brightness_grid_unsafe_data_ref(grid);
|
Packet *packet = sp_brightness_grid_command_try_into_packet(sp_brightness_grid_command_from_grid(grid));
|
||||||
for (size_t index = 0; index < slice.length; index++) {
|
if (packet == NULL)
|
||||||
slice.start[index] = (uint8_t) (index % ((size_t) Brightness_MAX));
|
return -2;
|
||||||
}
|
|
||||||
|
|
||||||
packet = sp_brightness_grid_into_packet(grid, 0, 0);
|
sp_udp_socket_send_packet(sock, packet);
|
||||||
sp_udp_send_packet(connection, packet);
|
|
||||||
|
|
||||||
sp_udp_free(connection);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
209
example/src/header_logger.c
Normal file
209
example/src/header_logger.c
Normal file
|
|
@ -0,0 +1,209 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "servicepoint.h"
|
||||||
|
|
||||||
|
#define DEFAULT_LISTEN_IP "127.0.0.1"
|
||||||
|
|
||||||
|
void handle_error(const char *msg) {
|
||||||
|
perror(msg);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool log_command(struct GenericCommand *command) {
|
||||||
|
switch (command->tag) {
|
||||||
|
case COMMAND_TAG_INVALID: {
|
||||||
|
printf("-> this is an invalid command\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_HARD_RESET: {
|
||||||
|
printf("-> HardReset command - exiting\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_BITMAP: {
|
||||||
|
BitmapCommand *bitmapCommand = command->data.bitmap;
|
||||||
|
|
||||||
|
CompressionCode compression = sp_bitmap_command_get_compression(bitmapCommand);
|
||||||
|
|
||||||
|
size_t x, y;
|
||||||
|
sp_bitmap_command_get_origin(bitmapCommand, &x, &y);
|
||||||
|
|
||||||
|
Bitmap *bitmap = sp_bitmap_command_get_bitmap_mut(bitmapCommand);
|
||||||
|
size_t w = sp_bitmap_width(bitmap);
|
||||||
|
size_t h = sp_bitmap_height(bitmap);
|
||||||
|
|
||||||
|
printf("-> BitmapCommand with params: x=%zu, y=%zu, w=%zu, h=%zu, compression=%hu\n",
|
||||||
|
x, y, w, h, compression);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_BRIGHTNESS_GRID: {
|
||||||
|
BrightnessGridCommand *gridCommand = command->data.brightness_grid;
|
||||||
|
|
||||||
|
size_t x, y;
|
||||||
|
sp_brightness_grid_command_get_origin(gridCommand, &x, &y);
|
||||||
|
|
||||||
|
BrightnessGrid *grid = sp_brightness_grid_command_get_grid_mut(gridCommand);
|
||||||
|
size_t w = sp_brightness_grid_width(grid);
|
||||||
|
size_t h = sp_brightness_grid_height(grid);
|
||||||
|
|
||||||
|
printf("-> BrightnessGridCommand with params: x=%zu, y=%zu, w=%zu, h=%zu\n",
|
||||||
|
x, y, w, h);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_CHAR_GRID: {
|
||||||
|
CharGridCommand *gridCommand = command->data.char_grid;
|
||||||
|
|
||||||
|
size_t x, y;
|
||||||
|
sp_char_grid_command_get_origin(gridCommand, &x, &y);
|
||||||
|
|
||||||
|
CharGrid *grid = sp_char_grid_command_get_grid_mut(gridCommand);
|
||||||
|
size_t w = sp_char_grid_width(grid);
|
||||||
|
size_t h = sp_char_grid_height(grid);
|
||||||
|
|
||||||
|
printf("-> CharGridCommand with params: x=%zu, y=%zu, w=%zu, h=%zu\n",
|
||||||
|
x, y, w, h);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_CP437_GRID: {
|
||||||
|
Cp437GridCommand *gridCommand = command->data.cp437_grid;
|
||||||
|
|
||||||
|
size_t x, y;
|
||||||
|
sp_cp437_grid_command_get_origin(gridCommand, &x, &y);
|
||||||
|
|
||||||
|
Cp437Grid *grid = sp_cp437_grid_command_get_grid_mut(gridCommand);
|
||||||
|
size_t w = sp_cp437_grid_width(grid);
|
||||||
|
size_t h = sp_cp437_grid_height(grid);
|
||||||
|
|
||||||
|
printf("-> Cp437GridCommand with params: x=%zu, y=%zu, w=%zu, h=%zu\n",
|
||||||
|
x, y, w, h);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_BIT_VEC: {
|
||||||
|
BitVecCommand *bitvecCommand = command->data.bit_vec;
|
||||||
|
|
||||||
|
size_t offset = sp_bit_vec_command_get_offset(bitvecCommand);
|
||||||
|
CompressionCode compression = sp_bit_vec_command_get_compression(bitvecCommand);
|
||||||
|
|
||||||
|
BinaryOperation operation = sp_bit_vec_command_get_operation(bitvecCommand);
|
||||||
|
char *operationText;
|
||||||
|
switch (operation) {
|
||||||
|
case BINARY_OPERATION_AND:
|
||||||
|
operationText = "and";
|
||||||
|
break;
|
||||||
|
case BINARY_OPERATION_OR:
|
||||||
|
operationText = "or";
|
||||||
|
break;
|
||||||
|
case BINARY_OPERATION_XOR:
|
||||||
|
operationText = "xor";
|
||||||
|
break;
|
||||||
|
case BINARY_OPERATION_OVERWRITE:
|
||||||
|
operationText ="overwrite";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
operationText ="unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayBitVec *bitvec = sp_bit_vec_command_get_bitvec_mut(bitvecCommand);
|
||||||
|
size_t len = sp_display_bit_vec_len(bitvec);
|
||||||
|
|
||||||
|
printf("-> BitVecCommand with params: offset=%zu, length=%zu, compression=%hu, operation=%s\n",
|
||||||
|
offset, len, compression, operationText);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_CLEAR: {
|
||||||
|
printf("-> ClearCommand\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_BITMAP_LEGACY: {
|
||||||
|
printf("-> BitmapLinearLegacy\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_FADE_OUT:{
|
||||||
|
printf("-> FadeOutCommand\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case COMMAND_TAG_GLOBAL_BRIGHTNESS: {
|
||||||
|
Brightness brightness = sp_global_brightness_command_get_brightness(command->data.global_brightness);
|
||||||
|
printf("-> GlobalBrightnessCommand with params: brightness=%hu\n", brightness);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
printf("-> unknown command tag %d\n", command->tag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
//init_env_logger();
|
||||||
|
|
||||||
|
int udp_socket = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
if (udp_socket == -1)
|
||||||
|
handle_error("socket could not be created\n");
|
||||||
|
|
||||||
|
char *listen_addr_arg;
|
||||||
|
if (argc > 1) {
|
||||||
|
listen_addr_arg = argv[1];
|
||||||
|
} else {
|
||||||
|
listen_addr_arg = DEFAULT_LISTEN_IP;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct in_addr addr;
|
||||||
|
if (inet_aton(listen_addr_arg, &addr) == 0)
|
||||||
|
handle_error("listen ip could not be parsed\n");
|
||||||
|
|
||||||
|
struct sockaddr_in sockaddrIn = {
|
||||||
|
.sin_addr = addr,
|
||||||
|
.sin_family = AF_INET,
|
||||||
|
.sin_port = htons(2342),
|
||||||
|
};
|
||||||
|
memset(sockaddrIn.sin_zero, 0, sizeof(sockaddrIn.sin_zero));
|
||||||
|
|
||||||
|
if (bind(udp_socket, (struct sockaddr *) &sockaddrIn, sizeof(sockaddrIn)) == -1)
|
||||||
|
handle_error("could not bind socket\n");
|
||||||
|
|
||||||
|
printf("socket ready to receive on %s\n", listen_addr_arg);
|
||||||
|
|
||||||
|
uint8_t buffer[10000];
|
||||||
|
bool done = false;
|
||||||
|
while (!done) {
|
||||||
|
memset(buffer, 0, sizeof(buffer));
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
ssize_t num_bytes = recv(udp_socket, (void *) buffer, sizeof(buffer), 0);
|
||||||
|
if (num_bytes == -1)
|
||||||
|
handle_error("could not read from client");
|
||||||
|
|
||||||
|
Packet *packet = sp_packet_try_load((ByteSlice) {
|
||||||
|
.start = buffer,
|
||||||
|
.length = num_bytes,
|
||||||
|
});
|
||||||
|
if (packet == NULL) {
|
||||||
|
printf("received invalid packet\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Header *header = sp_packet_get_header_mut(packet);
|
||||||
|
|
||||||
|
ByteSlice payload = sp_packet_get_payload(packet);
|
||||||
|
printf("Received packet: cc=%d, a=%d, b=%d, c=%d, d=%d, payload=%p (len %zu)\n",
|
||||||
|
header->command_code, header->a, header->b, header->c, header->d,
|
||||||
|
payload.start, payload.length);
|
||||||
|
|
||||||
|
struct GenericCommand *command = sp_generic_command_try_from_packet(packet);
|
||||||
|
done = log_command(command);
|
||||||
|
|
||||||
|
sp_generic_command_free(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(udp_socket);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
44
example/src/helpers.h
Normal file
44
example/src/helpers.h
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
#pragma once
|
||||||
|
#ifndef SERVICEPOINT_BINDING_C_MSLEEP_H
|
||||||
|
#define SERVICEPOINT_BINDING_C_MSLEEP_H
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "servicepoint.h"
|
||||||
|
|
||||||
|
static UdpSocket *sock = NULL;
|
||||||
|
|
||||||
|
void sock_free() {
|
||||||
|
sp_udp_socket_free(sock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sock_init() {
|
||||||
|
sock = sp_udp_socket_open_ipv4(127, 0, 0, 1, 2342);
|
||||||
|
//sock = sp_udp_open_ipv4(172, 23, 42, 29, 2342);
|
||||||
|
if (sock == NULL)
|
||||||
|
exit(-1);
|
||||||
|
atexit(sock_free);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// TODO: all of this for sleeping n ms? There should be a better way!
|
||||||
|
int msleep(long msec) {
|
||||||
|
if (msec < 0) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct timespec ts = {
|
||||||
|
.tv_sec = msec / 1000,
|
||||||
|
.tv_nsec = (msec % 1000) * 1000000,
|
||||||
|
};
|
||||||
|
|
||||||
|
int res;
|
||||||
|
do {
|
||||||
|
res = nanosleep(&ts, &ts);
|
||||||
|
} while (res && errno == EINTR);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //SERVICEPOINT_BINDING_C_MSLEEP_H
|
||||||
34
example/src/moving_line.c
Normal file
34
example/src/moving_line.c
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#include "servicepoint.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
sock_init();
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
Bitmap *bitmap = sp_bitmap_new_max_sized();
|
||||||
|
for (size_t x = 0; x < sp_bitmap_width(bitmap); x++) {
|
||||||
|
sp_bitmap_fill(bitmap, false);
|
||||||
|
|
||||||
|
for (size_t y = 0; y < sp_bitmap_height(bitmap); y++) {
|
||||||
|
sp_bitmap_set(bitmap, (y + x) % PIXEL_WIDTH, y, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
BitmapCommand *command = sp_bitmap_command_from_bitmap(sp_bitmap_clone(bitmap));
|
||||||
|
Packet *packet = sp_bitmap_command_try_into_packet(command);
|
||||||
|
if (packet == NULL) {
|
||||||
|
result = -2;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sp_udp_socket_send_packet(sock, packet)) {
|
||||||
|
result = -3;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
msleep(SP_FRAME_PACING_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
sp_bitmap_free(bitmap);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "servicepoint.h"
|
#include "servicepoint.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
UdpSocket *connection = sp_udp_open_ipv4(127, 0, 0, 1, 2342);
|
sock_init();
|
||||||
if (connection == NULL)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
Bitmap *pixels = sp_bitmap_new(PIXEL_WIDTH, PIXEL_HEIGHT);
|
Bitmap *pixels = sp_bitmap_new(PIXEL_WIDTH, PIXEL_HEIGHT);
|
||||||
if (pixels == NULL)
|
if (pixels == NULL)
|
||||||
|
|
@ -12,15 +11,13 @@ int main(void) {
|
||||||
|
|
||||||
sp_bitmap_fill(pixels, true);
|
sp_bitmap_fill(pixels, true);
|
||||||
|
|
||||||
Packet *packet = sp_bitmap_into_packet(pixels, 0, 0, COMPRESSION_CODE_UNCOMPRESSED);
|
Packet *packet = sp_bitmap_try_into_packet(pixels, 0, 0, COMPRESSION_CODE_UNCOMPRESSED);
|
||||||
if (packet == NULL)
|
if (packet == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
Header *header = sp_packet_get_header(packet);
|
Header *header = sp_packet_get_header_mut(packet);
|
||||||
printf("[%d, %d, %d, %d, %d]\n", header->command_code, header->a, header->b, header->c, header->d);
|
printf("[%d, %d, %d, %d, %d]\n", header->command_code, header->a, header->b, header->c, header->d);
|
||||||
|
|
||||||
sp_udp_send_packet(connection, packet);
|
sp_udp_socket_send_packet(sock, packet);
|
||||||
|
|
||||||
sp_udp_free(connection);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
example/src/undefined.c
Normal file
22
example/src/undefined.c
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "servicepoint.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
|
||||||
|
/// DO NOT DO ANY OF THIS!
|
||||||
|
int main(void) {
|
||||||
|
BitmapCommand *bmcmd = sp_bitmap_command_new(sp_bitmap_new_max_sized(), 0, 0, COMPRESSION_CODE_UNCOMPRESSED);
|
||||||
|
BitVecCommand *bvcmd = (BitVecCommand *) bmcmd;
|
||||||
|
sp_bit_vec_command_free(bvcmd);
|
||||||
|
|
||||||
|
uint8_t *data = calloc(1024, 1);
|
||||||
|
struct GenericCommand generic = {
|
||||||
|
.tag = COMMAND_TAG_BRIGHTNESS_GRID,
|
||||||
|
.data = {.null = data},
|
||||||
|
};
|
||||||
|
|
||||||
|
sock_init();
|
||||||
|
|
||||||
|
sp_udp_socket_send_command(sock, &generic);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
34
example/src/wiping_clear.c
Normal file
34
example/src/wiping_clear.c
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#include "servicepoint.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
sock_init();
|
||||||
|
|
||||||
|
Bitmap *enabled_pixels = sp_bitmap_new_max_sized();
|
||||||
|
sp_bitmap_fill(enabled_pixels, true);
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
for (int x = 0; x < PIXEL_WIDTH; x++) {
|
||||||
|
for (int y = 0; y < PIXEL_HEIGHT; y++) {
|
||||||
|
sp_bitmap_set(enabled_pixels, x, y, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayBitVec *bitvec = sp_bitmap_into_bitvec(sp_bitmap_clone(enabled_pixels));
|
||||||
|
BitVecCommand *command = sp_bit_vec_command_new(bitvec, 0, BINARY_OPERATION_AND, COMPRESSION_CODE_LZMA);
|
||||||
|
Packet *packet = sp_bit_vec_command_try_into_packet(command);
|
||||||
|
if (packet == NULL) {
|
||||||
|
result = -2;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if (!sp_udp_socket_send_packet(sock, packet)) {
|
||||||
|
result = -3;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
msleep(SP_FRAME_PACING_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
sp_bitmap_free(enabled_pixels);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
56
example/target.mk
Normal file
56
example/target.mk
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Based on https://make.mad-scientist.net/papers/multi-architecture-builds/
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
OBJDIR := _out_$(RUST_TARGET)-$(_link_type)-$(_profile)
|
||||||
|
|
||||||
|
# Define the rules to build in the target subdirectories.
|
||||||
|
#
|
||||||
|
MAKETARGET = $(MAKE) --no-print-directory -C $@ -f $(CURDIR)/Makefile \
|
||||||
|
SRCDIR=$(CURDIR) $(MAKECMDGOALS)
|
||||||
|
|
||||||
|
.PHONY: $(OBJDIR)
|
||||||
|
$(OBJDIR):
|
||||||
|
+@[ -d "$@" ] || mkdir -p "$@"
|
||||||
|
+@$(MAKETARGET)
|
||||||
|
|
||||||
|
# These rules keep make from trying to use the match-anything rule below to
|
||||||
|
# rebuild the makefiles--ouch! Obviously, if you don't follow my convention
|
||||||
|
# of using a `.mk' suffix on all non-standard makefiles you'll need to change
|
||||||
|
# the pattern rule.
|
||||||
|
#
|
||||||
|
Makefile : ;
|
||||||
|
%.mk :: ;
|
||||||
|
|
||||||
|
# Anything we don't know how to build will use this rule. The command is a
|
||||||
|
# do-nothing command, but the prerequisites ensure that the appropriate
|
||||||
|
# recursive invocations of make will occur.
|
||||||
|
#
|
||||||
|
% :: $(OBJDIR) ;
|
||||||
|
|
||||||
|
# The clean rule is best handled from the source directory: since we're
|
||||||
|
# rigorous about keeping the target directories containing only target files
|
||||||
|
# and the source directory containing only source files, `clean' is as trivial
|
||||||
|
# as removing the target directories!
|
||||||
|
#
|
||||||
|
.PHONY: clean clean-all help
|
||||||
|
clean:
|
||||||
|
rm -rf $(OBJDIR)
|
||||||
|
clean-all:
|
||||||
|
rm -rf _out_*
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "You have the choice of the following parameters:"
|
||||||
|
@echo ""
|
||||||
|
@echo "Variable | Description | Default | Values"
|
||||||
|
@echo "---------+----------------------+-----------+---------------------------"
|
||||||
|
@echo "LIBC | libc to link against | 'gnu' | 'gnu' or 'musl'"
|
||||||
|
@echo "PROFILE | Optimization profile | 'release' | 'debug' or 'size_optimized'"
|
||||||
|
@echo "LINK | | 'dynamic' | 'dynamic' or 'static'"
|
||||||
|
@echo "CARGO | cargo binary to use | 'cargo' | 'rustup run nightly cargo'"
|
||||||
|
@echo "CC | C compiler to use | 'gcc' | 'musl-gcc'"
|
||||||
|
@echo "STRIP | strip command to use | 'strip' | -"
|
||||||
|
@echo ""
|
||||||
|
@echo "When building this project, each configuration will result in a separate output directory."
|
||||||
|
@echo "The target clean only removes the output directory of the specified configuration."
|
||||||
|
@echo "The target clean-all can be used to remove the builds of all configurations."
|
||||||
63
flake.lock
generated
63
flake.lock
generated
|
|
@ -1,25 +1,80 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"fenix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751006353,
|
||||||
|
"narHash": "sha256-icKFXb83uv2ezRCfuq5G8QSwCuaoLywLljSL+UGmPPI=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"rev": "b37f026b49ecb295a448c96bcbb0c174c14fc91b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-filter": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533336,
|
||||||
|
"narHash": "sha256-oRam5PS1vcrr5UPgALW0eo1m/5/pls27Z/pabHNy2Ms=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-filter",
|
||||||
|
"rev": "f7653272fd234696ae94229839a99b73c9ab7de0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-filter",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1739357830,
|
"lastModified": 1750838302,
|
||||||
"narHash": "sha256-9xim3nJJUFbVbJCz48UP4fGRStVW5nv4VdbimbKxJ3I=",
|
"narHash": "sha256-aVkL3/yu50oQzi2YuKo0ceiCypVZpZXYd2P2p1FMJM4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "0ff09db9d034a04acd4e8908820ba0b410d7a33a",
|
"rev": "7284e2decc982b81a296ab35aa46e804baaa1cfe",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixos-24.11",
|
"ref": "nixos-25.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"fenix": "fenix",
|
||||||
|
"nix-filter": "nix-filter",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"rust-analyzer-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1750871759,
|
||||||
|
"narHash": "sha256-hMNZXMtlhfjQdu1F4Fa/UFiMoXdZag4cider2R9a648=",
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"rev": "317542c1e4a3ec3467d21d1c25f6a43b80d83e7d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"ref": "nightly",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
||||||
56
flake.nix
56
flake.nix
|
|
@ -2,16 +2,22 @@
|
||||||
description = "Flake for the servicepoint library.";
|
description = "Flake for the servicepoint library.";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||||
|
nix-filter.url = "github:numtide/nix-filter";
|
||||||
|
fenix = {
|
||||||
|
url = "github:nix-community/fenix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
inputs@{
|
inputs@{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
|
fenix,
|
||||||
|
nix-filter
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
lib = nixpkgs.lib;
|
|
||||||
supported-systems = [
|
supported-systems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
|
|
@ -20,52 +26,20 @@
|
||||||
];
|
];
|
||||||
forAllSystems =
|
forAllSystems =
|
||||||
f:
|
f:
|
||||||
lib.genAttrs supported-systems (
|
nixpkgs.lib.genAttrs supported-systems (
|
||||||
system:
|
system:
|
||||||
f rec {
|
f rec {
|
||||||
|
inherit system self;
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
inherit system;
|
lib = pkgs.lib // nix-filter.lib;
|
||||||
|
fenix = inputs.fenix.packages.${system};
|
||||||
|
selfPkgs = self.packages.${system};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells = forAllSystems (
|
packages = forAllSystems (import ./packages.nix);
|
||||||
{ pkgs, system }:
|
devShells = forAllSystems (import ./devShells.nix);
|
||||||
{
|
|
||||||
default = pkgs.mkShell rec {
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
xe
|
|
||||||
xz
|
|
||||||
libgcc
|
|
||||||
libunwind
|
|
||||||
pkgsStatic.musl
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
(pkgs.symlinkJoin {
|
|
||||||
name = "rust-toolchain";
|
|
||||||
paths = with pkgs; [
|
|
||||||
rustc
|
|
||||||
cargo
|
|
||||||
rustPlatform.rustcSrc
|
|
||||||
rustfmt
|
|
||||||
clippy
|
|
||||||
cargo-expand
|
|
||||||
cargo-tarpaulin
|
|
||||||
];
|
|
||||||
})
|
|
||||||
gcc
|
|
||||||
gdb
|
|
||||||
pkgsStatic.gcc
|
|
||||||
gnumake
|
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
|
|
||||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
|
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue