-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(capi): include rustsat version in header
- Loading branch information
Showing
5 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
VERSION=$(grep '^version = "[[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+"' Cargo.toml | cut -d '"' -f2) | ||
MAJOR=$(echo "${VERSION}" | cut -d '.' -f1) | ||
MINOR=$(echo "${VERSION}" | cut -d '.' -f2) | ||
PATCH=$(echo "${VERSION}" | cut -d '.' -f3) | ||
|
||
TMP_CONF=$(mktemp XXXXXXXXXX.cbindgen.toml) | ||
|
||
sed "s/after_includes = \"\"/after_includes = \"#define RUSTSAT_VERSION ${VERSION}\\\n#define RUSTSAT_VERSION_MAJOR ${MAJOR}\\\n#define RUSTSAT_VERSION_MINOR ${MINOR}\\\n#define RUSTSAT_VERSION_PATCH ${PATCH}\"/g" capi/cbindgen.toml > ${TMP_CONF} | ||
|
||
cbindgen -c ${TMP_CONF} --crate rustsat-capi -o capi/rustsat.h --verify | ||
|
||
rm ${TMP_CONF} |