Bug 277445 - net/pjsip: take maintainership
Summary: net/pjsip: take maintainership
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Daniel Engberg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-03 08:31 UTC by Oliver Epper
Modified: 2024-04-17 17:03 UTC (History)
2 users (show)

See Also:


Attachments
Change the maintainer of net/pjsip (659 bytes, application/mbox)
2024-03-03 10:23 UTC, Oliver Epper
no flags Details
pjsip 2.14 (18.42 KB, application/mbox)
2024-03-08 12:00 UTC, Oliver Epper
no flags Details
pjsip-2.14 (18.31 KB, patch)
2024-03-08 19:35 UTC, Oliver Epper
no flags Details | Diff
Suggested Updates (6.57 KB, patch)
2024-03-12 21:43 UTC, Oliver Epper
no flags Details | Diff
Suggested Updates v2 (7.00 KB, patch)
2024-03-15 09:23 UTC, Oliver Epper
no flags Details | Diff
Patch for pjsip (WIP) (17.80 KB, patch)
2024-03-18 20:03 UTC, Daniel Engberg
no flags Details | Diff
pjsip-2.14.1 (42.17 KB, patch)
2024-03-27 11:19 UTC, Oliver Epper
no flags Details | Diff
pjsip-2.14.1_2 (42.24 KB, patch)
2024-03-28 14:28 UTC, Oliver Epper
no flags Details | Diff
Addition to pjsip-2.14.1_2 (655 bytes, patch)
2024-04-02 13:51 UTC, Oliver Epper
no flags Details | Diff
Patch for pjsip v2 (final) (21.66 KB, patch)
2024-04-04 22:08 UTC, Daniel Engberg
no flags Details | Diff
pjsip-2.14.1_rc1 (24.08 KB, patch)
2024-04-07 14:10 UTC, Oliver Epper
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Epper 2024-03-03 08:31:07 UTC
I volunteer to maintain this package. At the moment it is outdated and it configures features that don't end up in the resulting build-artefact (opus-codec).
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2024-03-03 08:53:09 UTC
Hi,

Sounds great, can you also provide a patch?

Best regards,
Daniel
Comment 2 Oliver Epper 2024-03-03 10:23:37 UTC
Created attachment 248892 [details]
Change the maintainer of net/pjsip

Sure. Here's just the change of the maintainer. I've already started working on an updated port but that will take a little longer and some more testing.
Comment 3 Oliver Epper 2024-03-08 12:00:25 UTC
Created attachment 249022 [details]
pjsip 2.14

So here's the real patch which brings pjsip 2.14. There were some troubles with the old version of this port that are now fixed:

- opus could be configured as a codec but the required functions did not make it in the resulting library, then.
- In pjsip there's an additional `make dep` step that should be done before building the library. This was not the case.
- The upstream defaults did not make it into the configuration and thus another configuration was introduced, but not synced with upstream.


Additionally there was (still in 2.14) a bug in the aconfigure script regarding `--disable-kqueue` which enabled it. I pointed that out with Teluu and it's already fixed for the upcoming version.

Possible troubles:

I thoroughly tested this port with the use-cases I have (mostly sip-clients). I deleted patches and configuration that I think are longer necessary or that I simply could not test in order to keep things tidy, clean and maintainable. According to `pkg info -rx pjsip` no other package depends on this, so I guess it should be safe.

As mentioned I am willing to maintain this port and incorporate changes that are important to other users.

greetings,
Oliver
Comment 4 Oliver Epper 2024-03-08 19:35:18 UTC
Created attachment 249035 [details]
pjsip-2.14

added a fix for the aarch64 build back in.
Comment 5 Daniel Engberg freebsd_committer freebsd_triage 2024-03-11 20:36:32 UTC
Hi,

Sorry for being late on this one

It looks like we can unbundle a few more libs?
pkg-config is missing?
https://pdr2.bofh.network/data/132-diizzy/2024-03-11_13h59m48s/logs/pjsip-2.14_1.log
https://docs.freebsd.org/en/books/porters-handbook/book/#bundled-libs-practices

Unless there's a very good reason not to make SHARED permanent instead as an option

Please sort OPTIONS_DEFINE and OPTIONS_DEFAULT alphabetical

* Move OPTIONS_SUB to below OPTIONS_DEFAULT
* Group OPTIONS_DEFINE, OPTIONS_DEFAULT and OPTIONS_SUB together

.if ${PORT_OPTIONS:MKQUEUE} can be replaced by KQUEUE_CONFIGURE_ON
See https://docs.freebsd.org/en/books/porters-handbook/book/#options-configure_on

How does it handle an unclean environment (ports) having external libs being available in mind?

Best regards,
Daniel
Comment 6 Oliver Epper 2024-03-11 21:07:11 UTC
Thanks very much for your time and effort!

I will prepare an improved patch tomorrow. Regarding the PORT_OPTIONS:MKQUEUE: I need to do that because of a bug in the upstream package that configures WITH kqueue even if the option `--disable-kqueue` was given. That's already fixed in upstream, but not for 2.14.

For reference:

https://github.com/pjsip/pjproject/issues/3877#event-12022667708

greetings
Oliver
Comment 7 Daniel Engberg freebsd_committer freebsd_triage 2024-03-11 21:13:35 UTC
Hi,

KQUEUE_CONFIGURE_ON/OFF is not the same as KQUEUE_CONFIGURE_ENABLE
https://docs.freebsd.org/en/books/porters-handbook/book/#options-configure_enable

Best regards,
Daniel
Comment 8 Oliver Epper 2024-03-11 21:15:35 UTC
Ah perfect. Thanks again. You're a great help!
Comment 9 Oliver Epper 2024-03-12 21:43:35 UTC
Created attachment 249121 [details]
Suggested Updates

Hi Dizzy,

I think I managed to incorporate all your suggestions. Thanks for the pointers. I made a second patch (to be applied after the first one). If two patches are inconvenient let me know and I will prepare one file.

greetings
Oliver
Comment 10 Oliver Epper 2024-03-12 22:16:35 UTC
Sorry I messed up. I removed a library that is essential. I will fix this run some tests and then update the second patch. Sorry for the noise.
Comment 11 Daniel Engberg freebsd_committer freebsd_triage 2024-03-13 06:30:01 UTC
Hi Oliver,

Sounds great, I'll be bit busy for the next days so no need to rush it.

Best regards,
Daniel
Comment 12 Oliver Epper 2024-03-15 09:23:57 UTC
Created attachment 249183 [details]
Suggested Updates v2

This reintroduces the missing dependency and adds the RESAMPLE and RESAMPLE_DLL option.
Comment 13 Daniel Engberg freebsd_committer freebsd_triage 2024-03-18 20:03:57 UTC
Created attachment 249281 [details]
Patch for pjsip (WIP)
Comment 14 Daniel Engberg freebsd_committer freebsd_triage 2024-03-18 20:28:14 UTC
Great progress, there are a few issues that needs to be fixed though.
I adjusted the layout to be a bit closer to Porters Handbook and the tree overall. This should combine both your patches into one.

- Try not to exceed 78 chars in width per line, it makes reading the Makefile much easier even if you're in a terminal

- Plist is broken with the default config, NO_SAMPLERATE should likely refer to RESAMPLE ?

- Some options depends on each other (SPEEXAEC breaks build if SPEEX is not selected for example

- Less is more, I understand the intention of providing flexibility but as you notice it's a pain trying to test and maintain all options while not breaking things. As the maintainer you have the freedom of deciding what's reasonable (to some extent) and I would highly recommend that you reduce the amount of options and decide on some hardcoded defaults.

While I'm not a user of the library a few things I would consider to make everyone's life easier.

Options,
AMR - Drop and permanently disable? I doubt anyone cares about this codec today

What's the correlation between FFMPEG, RESAMPLE, SAMPLERATE? Just different libraries for a resample algorithm?

G7* - Combine these as one option

GSM - Drop and permanently disable? Inferior to pretty much everything else available

ILBC - Drop option and keep it permanently enabled

L16 - Drop and permanently disable? Seems pretty useless given the very limited format support?

SHARED - Drop option and keep it permanently enabled

SPEEX* - Combine into one option

Best regards,
Daniel
Comment 15 Oliver Epper 2024-03-18 21:03:55 UTC
Hi Daniel,

thanks again for you great feedback. You're absolutely right it can become quite messy to test all possible combinations. So I will follow your advice and concentrate on what's actually useful. I'll be busy for two days, now but I will try to have a patch by the end of the week.

greetings,
Oliver
Comment 16 Daniel Engberg freebsd_committer freebsd_triage 2024-03-26 20:35:35 UTC
Take your time, no stress :-)
Comment 17 Oliver Epper 2024-03-26 20:37:37 UTC
I made good progress. I will have a new version ready very soon, now.
Comment 18 Oliver Epper 2024-03-27 11:19:09 UTC
Created attachment 249508 [details]
pjsip-2.14.1

Hi Daniel,

here's the new version of the patch.

- Try not to exceed 78 chars in width per line [...]
Done where feasible.

- Plist is broken with the default config, NO_SAMPLERATE should likely refer to RESAMPLE ?
plist is fixed and the Makefile calculates a variable that helps with the situation regaring the different resample options, now.

- Some options depends on each other [...]
This is fixed now that I discovered implies & prevents

- Less is more, [...]
pjsip is a complex library that covers a lot of ground. I totally expect people to have very different demands. I carefully tested the options that a) either depend on each other, or b) prevent each other while still trying to offer much flexibility. 


- AMR, G7*, GSM, ILBC, L16
I introduced a section for the codecs and disabled the one that are no longer widely used per default. Still offering them as an option. The codecs are generally not problematic to toggle on, or off.

-What's the correlation between FFMPEG, RESAMPLE, SAMPLERATE? [...]
pjsip offers a few different resampling implementations. The upstream default is `libresample` which can be build as a dso (RESAMPLEDLL) and will always be when SHARED is given. `libresample` is an alternative that I found has much worse performance on FreeBSD, but I think it should still be available as an option. The Speex Codecs brings a third resampling option. I reflected the implications and conflicts in the Makefile. `libswresample` from ffmpeg is not used for resampling.

Please don't hesitate to point out anything that still needs improvement. I appreciate your feedback. It helped me very much in learning how to setup a port for FreeBSD.

I tried to incorporate every thing you mentioned, but still opted for much flexibility. I deployed a poudriere system and tried a lot of different combinations on amd64 as well as arm64. I am happy to fix everything that might still be broken.

greetings,
Oliver
Comment 19 Daniel Engberg freebsd_committer freebsd_triage 2024-03-28 05:42:12 UTC
Thanks for the report,

It's starting to look really good!

I am a bit concerned about the amount of options as it will be taxing to test for each release (upstream unfortunately breaks things sometimes) but if you insist...

I would however simplify the logic regarding resampling libraries.
Always enforce it and use OPTIONS_SINGLE=
 https://docs.freebsd.org/en/books/porters-handbook/book/#makefile-options-options

Is files/config_site.h supposed to be empty?

Makefile should end with ".include <bsd.port.post.mk>"
https://docs.freebsd.org/en/books/porters-handbook/book/#dads-after-port-mk

Best regards,
Daniel
Comment 20 Oliver Epper 2024-03-28 14:28:41 UTC
Created attachment 249536 [details]
pjsip-2.14.1_2

Hi Daniel,

- I am a bit concerned about the amount of options [...]
I totally understand. With this many options it is no longer possible to test every combination. pjsip is a mature project that I follow closely and I am willing to support users with their special use-cases, if I can.

- I would however simplify the logic [...] OPTIONS_SINGLE [...]
Great tip! While it is possible to link against speexresample and libsamplerate (as opposed to building any one together with libresample) this could be considered a very esoteric use. This way it is much clearer.

- Is files/config_site.h supposed to be empty?
Technically yes, but I reintroduced the import of the sample file. While this does not add anything to the FreeBSD build it makes the intended use of the file clearer. And is in line with the upstream documentation. The file is needed for compilation and can be used for additional site-specific configuration of the build.

- Makefile should end with ".include <bsd.port.post.mk>"
Thanks for the hint. I didn't see that. Would be great of portlint could catch an error like that.

greetings,
Oliver
Comment 21 Oliver Epper 2024-03-28 14:32:52 UTC
Hi Daniel,

I forgot one thing:

I introduced NONE to RESAMPLEIMP, because it is possible and desirable to build the library without resampling. It is no real option, though and portlint gives a warning about this.

How can this be improved?

greetings,
Oliver
Comment 22 Daniel Engberg freebsd_committer freebsd_triage 2024-03-28 20:50:48 UTC
(In reply to Oliver Epper from comment #21)
It will complain, and it's not the end of the world =)
Comment 23 Oliver Epper 2024-04-02 13:51:49 UTC
Created attachment 249659 [details]
Addition to pjsip-2.14.1_2

True. But this get's rid of the warning. Do you have any further things that need changing?
Comment 24 Daniel Engberg freebsd_committer freebsd_triage 2024-04-03 22:22:43 UTC
Sorry, I'll have a look tomorrow at it
Comment 25 Daniel Engberg freebsd_committer freebsd_triage 2024-04-04 22:08:04 UTC
Created attachment 249719 [details]
Patch for pjsip v2 (final)

Some minor layout fixes, looks good otherwise.
I'll commit this version if that's ok with you once I've run some tests in Poudriere.
249659 just adds noise so I'm not going to commit that one.
Comment 26 Oliver Epper 2024-04-07 06:35:02 UTC
Hi Daniel,

sure that's ok. How did the tests go? Anything that still needs fixing?


greetings,
Oliver
Comment 27 Daniel Engberg freebsd_committer freebsd_triage 2024-04-07 07:52:44 UTC
Hi,

I managed to break it...

Take #1

pjsip # make pretty-print-config
+APPS -DEBUG -FFMPEG +KQUEUE +PA +PJSUA2 -RESAMPLEDLL +SHARED +SOUND +SRTP +UPNP +VIDEO -WEBRTC -YUV CODECS[ +AMR -BCG729 +G711 +G722 -G7221 +GSM -ILBC -L16 -OPUS -SILK +SPEEX -SPEEXAEC ] RESAMPLEIMP( -RESAMPLE -SAMPLERATE +SPEEXRESAMPLE -NONE )

===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: libexec/pjsip-apps/samples/pjsua2_demo
Error: Orphaned: libexec/pjsip-apps/samples/pjsua2_hello_reg
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: lib/libyuv-%%CONFIGURE_TARGET%%.a
Error: Missing: lib/libyuv.so
Error: Missing: lib/libyuv.so.2
===> Error: Plist issues found.

Take #2

root@freebsd-dev:/usr/ports/net/pjsip # make pretty-print-config
+APPS -DEBUG -FFMPEG +KQUEUE +PA +PJSUA2 +RESAMPLEDLL -SHARED +SOUND +SRTP -UPNP +VIDEO -WEBRTC -YUV CODECS[ -AMR -BCG729 +G711 +G722 -G7221 -GSM -ILBC -L16 +OPUS -SILK +SPEEX -SPEEXAEC ] RESAMPLEIMP( +RESAMPLE -SAMPLERATE -SPEEXRESAMPLE -NONE )

===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: libexec/pjsip-apps/samples/pjsua2_demo
Error: Orphaned: libexec/pjsip-apps/samples/pjsua2_hello_reg
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: lib/libyuv-%%CONFIGURE_TARGET%%.a
===> Error: Plist issues found.

Best regards,
Daniel
Comment 28 Oliver Epper 2024-04-07 09:58:37 UTC
Thats good!

I will fix this.

greetings,
Oliver
Comment 29 Oliver Epper 2024-04-07 14:10:22 UTC
Created attachment 249805 [details]
pjsip-2.14.1_rc1

Hi Daniel,

can you please run your tests, again with this patch?

greetings,
Oliver
Comment 30 Daniel Engberg freebsd_committer freebsd_triage 2024-04-07 16:46:37 UTC
Hi,

Apps are still broken,

===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: libexec/pjsip-apps/samples/pjsua2_demo
Error: Orphaned: libexec/pjsip-apps/samples/pjsua2_hello_reg
===> Checking for items in pkg-plist which are not in STAGEDIR
===> Error: Plist issues found.

make pretty-print-config
+APPS -DEBUG +FFMPEG +KQUEUE +PA +PJSUA2 -RESAMPLEDLL +SHARED +SOUND +SRTP -UPNP +VIDEO +WEBRTC -YUV CODECS[ +AMR -BCG729 +G711 +G722 -G7221 -GSM +ILBC -L16 +OPUS -SILK +SPEEX -SPEEXAEC ] RESAMPLEIMP( -RESAMPLE -SAMPLERATE +SPEEXRESAMPLE -NONE )
Comment 31 Oliver Epper 2024-04-07 19:57:28 UTC
Hi,

I cannot reproduce this. I've just successfully build the package with your configuration under poudriere.

Can you give me more details about what you did for testing?

greetings,
Oliver
Comment 32 Daniel Engberg freebsd_committer freebsd_triage 2024-04-07 20:58:42 UTC
Hi,

I tried this in plain ports tree,

https://github.com/pjsip/pjproject/blob/2.14.1/pjsip-apps/build/Samples.mak#L51

No idea where it's called though :-/

Best regards,
Daniel
Comment 33 Oliver Epper 2024-04-07 21:14:29 UTC
Hi,

Not sure if I ever build the pjsua2 (C++-API) examples. I wanted to include the pjsua (C-API) examples in the build because they can serve as a easy integration test.

I still don't understand why the build seems to break for you and I can built with the same options for x86 and arm64 without a problem.

I'll double check everything, tomorrow.

greetings,
Oliver

P.S.: Thanks again for all the time you're putting in. I really appreciate your efforts.
Comment 34 Oliver Epper 2024-04-09 09:14:41 UTC
Hi Daniel,

I fixed the missing entires for the pjsua2 apps but I found another problem:

The aconfigure scripts automatically picks up a lot of libraries when they are installed in the system. In order to make all dependencies known I tried to be very explicit in the port.

I noticed the following:

When I build & install the package with all the options turned on everything works. When I then reconfigure & build (without further deinstalling) the package with no options selected the resulting binaries still have a lot of dependencies to some of the libraries from the previous install (not wanted).

I went through all options and tried to be explicit about every case regarding what should happen. In some cases there is no symmetry in the options (i.e. —with-A &—disable-A).

I think I managed to find working combinations for all options that I have included in the build (sadly I needed to introduce even more options just to be able to turn them off, when installed in the system).

BUT: When having the software installed (all options enabled) and then trying to build a version with all options turned off the build breaks with missing symbols from options that are not selected.

This does not happen, when I uninstall the package prior to starting the new build.

What’s even more suspicious:

When I copy the aconfigure command-line that the port created and run manually:

```pre
./aconfigure […] // from the previous make-config run logged in config.log
gmake dep && gmake clean && gmake
```

everything works as expected!

This is not true when running `make clean && make` or just `make` from the package directory.

So there’s something that I clearly did not understand or noticed about the build-system. Can you help me with an idea?

greetings,
Oliver
Comment 35 Oliver Epper 2024-04-09 09:19:09 UTC
Hi Daniel,

I thing I know the difference:

The build-system puts `/usr/local/lib/` in the linker path. So it sees the old `libpj-something` (that still has the dependencies that is no longer configured) before the newly build `libpj-something` in the working dir (that no longer has the dependency) when linking one of the sample binaries.

How can I prevent this from happening?

thanks,
Oliver
Comment 36 Daniel Engberg freebsd_committer freebsd_triage 2024-04-13 09:19:37 UTC
Hi,

Been a bit busy but I think you might be seeing this due to USES= localbase ?

Best regards,
Daniel
Comment 37 Oliver Epper 2024-04-17 17:03:54 UTC
Hi Daniel,

you're right. But I don't think I can remove that without breaking things in just another way. Say I want to build against libsamplerate it would not pick up the header in /usr/local/include, would it?

So as far as I understand this right now, I need the option to be able to unbundle the 3rd party libraries. But then I fall in the trap of linking against the old versions of my own libraries with consecutive builds, right?

This has to happen a lot, I guess. Is it considered to be ok that one has to uninstall a package in order to build it in a reliable way?


greetings,
Oliver Epper