Attached is an updated port of pijul with
- explicit BUILD_DEPENDS = devel/llvm
- no COMPILER set
- no mention of clang in WANTLIB
- fixed missing license and patch comments

main change:
--8<---------------cut here---------------start------------->8---
WANTLIB +=      c c++abi crypto gmp hogweed nettle pthread sodium ssl

MODULES =       devel/cargo
# bindgen uses libclang.so at build time to generate rust interface for nettle
BUILD_DEPENDS = devel/llvm
LIB_DEPENDS =   devel/gmp security/libnettle security/libsodium
--8<---------------cut here---------------end--------------->8---

Sebastien Marie writes:

> On Sat, May 11, 2019 at 03:54:01PM -0400, Jeremie Courreges-Anglas wrote:
>> On Sat, May 11 2019, Sebastien Marie wrote:
>> >
>> > c++ is added due to COMPILER=ports-clang usage. It automatically adds
>> > MODULES += lang/clang.
>> >
>> > So I think we don't bother.
>> 
>> Hmm, should this port use COMPILER?  Or BUILD/RUN_DEPENDS = lang/llvm?
>> Or LIB_DEPENDS + add clang in WANTLIB, so that pijul gets updated
>> whenever libclang.so is bumped (happens infrequently, but still).
>>
>
> I hesitated a bit about it.
>
> libclang.so is used by bindgen crate. it is used only at build time
> to generate a rust interface for libnettle (read C file and generate
> rust file with rights function/type for directly call the library), and
> nettle is in WANTLIB.

Thanks for pointing me in the right direction. Here is what I learned
after after reading through the
tutorial. https://rust-lang.github.io/rust-bindgen/tutorial-0.html

Interesting files I looked at were:
modcargo-crates/nettle-sys-1.0.1/build.rs
modcargo-crates/nettle-sys-1.0.1/src/lib.rs

These are similar to steps 3.1.3 and 3.1.4 in the aforementioned tutorial.

modcargo-crates/clang-sys-0.26.4/build/{dynamic,common}.rs

Detects the version of clang based on the major and minor numbers in the
file name.
--8<---------------cut here---------------start------------->8---
    if cfg!(any(target_os="openbsd", target_os="freebsd", target_os="netbsd")) 
{^M
        // Some BSD distributions don't create a `libclang.so` symlink either, 
but use^M
        // a different naming scheme for versioned files (e.g., 
`libclang.so.7.0`).^M   
        files.push("libclang.so.*".into());^M
    }
--8<---------------cut here---------------end--------------->8---

These are the dependencies if you unravel them at:
(https://crates.io/crates/nettle-sys/reverse_dependencies)

nettle --> nettle-sys --> bindgen --> clang-sys

>
> an explicit BUILD_DEPENDS+=devel/llvm could be added. but as
> COMPILER=ports-clang adds MODULES+=lang/clang, and its adds
> BUILD_DEPENDS+=devel/llvm in the port...

Even if libclang gets a bump, I suppose not having clang in WANTLIB
risks not updating pijul. However, isn't listing llvm in BUILD_DEPENDS
sufficient for using the bumped libclang the next time a bulk build is
performed?

It is only generating bindings to C (not C++), and the docs
(https://rust-lang.github.io/rust-bindgen/requirements.html) say that
3.7 and 3.8 versions of clang will probably work. So, it might be ok to
have libclang get bumped and not trigger a pijul update, as long as the
nettle bindings are still generated correctly.

Attachment: pijul.tar.gz
Description: Binary data

Reply via email to