diff --git a/info.yml b/info.yml new file mode 100644 index 0000000..34b2984 --- /dev/null +++ b/info.yml @@ -0,0 +1,21 @@ +name: rust-bindgen +description: Automatically generate Rust FFI bindings to C and C++ libraries +version: 0.72.1 +revision: 2 +url: https://github.com/rust-lang/rust-bindgen +license: BSD-3-Clause +maintainers: + - enumdev@enumerated.dev +architecture: any +type: source +depends: + - clang + - gcc-libs + - glibc +make_depends: + - rustc +downloads: + - url: https://github.com/rust-lang/rust-bindgen/archive/refs/tags/v${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: 4ffb17061b2d71f19c5062d2e17e64107248f484f9775c0b7d30a16a8238dfd1 diff --git a/pkg.info b/pkg.info deleted file mode 100644 index 64e3562..0000000 --- a/pkg.info +++ /dev/null @@ -1,9 +0,0 @@ -name: rust-bindgen -description: Automatically generate Rust FFI bindings to C and C++ libraries -version: 0.72.1 -url: https://github.com/rust-lang/rust-bindgen -license: BSD-3-Clause -architecture: any -depends: ["clang", "gcc-libs"] -make_depends: ["rustc"] -type: source diff --git a/source.sh b/recipe.sh similarity index 64% rename from source.sh rename to recipe.sh index d591623..6d8d91f 100644 --- a/source.sh +++ b/recipe.sh @@ -1,27 +1,19 @@ -# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT -DOWNLOAD="https://github.com/rust-lang/rust-bindgen/archive/refs/tags/v${BPM_PKG_VERSION}.tar.gz" -FILENAME="${DOWNLOAD##*/}" - # The prepare function is executed in the root of the temp directory -# This function is used for downloading files and putting them into the correct location +# This function is used for putting downloaded files to the correct location or applying patches prepare() { - wget "$DOWNLOAD" - tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" + cd "$BPM_SOURCE" + # Fetch cargo dependencies + cargo fetch --locked --target "$(rustc --print host-tuple)" } # The build function is executed in the source directory # This function is used to compile the source code build() { - cargo build --release -} - -# The check function is executed in the source directory -# This function is used to run tests to verify the package has been compiled correctly -check() { - cargo test --release + cargo build --release --frozen } # The package function is executed in the source directory @@ -37,5 +29,10 @@ package() { install -d "$BPM_OUTPUT"/usr/share/zsh/site-functions/ target/release/bindgen --generate-shell-completions zsh > "$BPM_OUTPUT"/usr/share/zsh/site-functions/_bindgen - install -Dm644 LICENSE "$BPM_OUTPUT"/usr/share/licenses/rust-bindgen/LICENSE + # Generate fish completions + install -d "$BPM_OUTPUT"/usr/share/fish/vendor_completions.d/ + target/release/bindgen --generate-shell-completions fish > "$BPM_OUTPUT"/usr/share/fish/vendor_completions.d/bindgen.fish + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/rust-bindgen/LICENSE }