Bug 253844

Summary: [NEW PORT] net/opensips24 net/opensips31
Product: Ports & Packages Reporter: bambyster
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: New ---    
Severity: Affects Some People CC: daniel.engberg.lists
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
opensips24 and opensips31 ports
none
opensips24 and opensips31 ports
none
opensips31 port
none
Patch for opensips31 (WIP)
none
opensips31 port none

Description bambyster 2021-02-25 10:45:28 UTC
Created attachment 222820 [details]
opensips24 and opensips31 ports

Let me offer you two ports for openSIPS for the latest stable releases 2.4.9 and 3.1.1. While opensips-3.1.1 is python 3 compatible as is, however it was necessary to add a patch for opensips-2.4.9/modules/python/Makefile to make sure it is also Python 3 compatible.
Comment 1 bambyster 2021-03-17 11:45:14 UTC
Created attachment 223356 [details]
opensips24 and opensips31 ports

I have a follow up. The python module in opensips-2.4.9 is actually only compatible with Python 2 so I've added necessary patches for it to be compatible with Python 3 too.
Comment 2 daniel.engberg.lists 2021-03-17 20:56:38 UTC
Thanks for contributing!

OpenSIPS 2.4.x
https://www.opensips.org/About/AvailableVersions - Supported until: 24th of May 2021

Seems to be a very little to reason to have it in tree for 2 months?

Please attach patches as diff/patch files

A few things I spotted having a quick look

PORTVERSION --> DISTVERSION
https://docs.freebsd.org/en/books/porters-handbook/book.html
"Table 5.2. Package Naming Examples"

MASTER_SITES: http --> https (redirects to https)

Is it much work to get rid of gtar and ginstall as build deps?

GCC requirement: Just for 11, all versions, specific arch?

Does shebangfix really work on *.php files since it's not set as a dependency and is it a missing dependency?

Can't we reuse MAKE_ENV from framework instead of working around it?

do-configure seems a bit out of place, this should be in post-patch?

do-build can most likely use ports framework, see "5.13.3.11. Generic Variables Replacement"

"@${ECHO_CMD} "Stripping binaries in"... I understand the idea but we don't do this anywhere else in tree.

Do we need to use a lot of loops for stripping binaries or can this be reduced?

Try to fix as many issues as possible reported by portlint and portfmt
Comment 3 bambyster 2021-03-26 10:10:01 UTC
Created attachment 223605 [details]
opensips31 port

(In reply to daniel.engberg.lists from comment #2)

Thank you for your guidelines!

I agree that there is no reason to add port for opensips24. And I reworked the port for opensip31.

Initially I based my port on the previous now obsolete version of the net/opensips port. It looks like a bug in the Makefile in the opensips itself prevented the maintainer of the port from using MAKE_ENV and forced him to use custom do-build, strip and other extra stuff.

Now with this bug patched I've been able to make the port much more compact and straightforward. I removed dependencies on gtar, ginstall and gcc. I also removed the code which strips binaries.

I've rearranged the variables according to the handbook but portlint still complains about misplaced LIB_DEPENDS and USES.
Comment 4 daniel.engberg.lists 2021-03-27 11:20:08 UTC
Hi,

I made a few changes to your Makefile, mainly minor issue and utilizing the framework a bit more however I didn't test any options.

gettext-runtime (missing dep)
libxml2 --> USES=gnome + USE_GNOME=libxml2
net/xmlrpc-c dep removed, can't find any reference to where it's needed
redis dep removed, is this a runtime dep as it builds fine without?
Is python a run dep or is it used during compilation?
Remove *.php from SHEBANG_GLOB, I couldn't find any files directly calling PHP and/or it didn't work as intended (no shebang at L1)
C/CXX/LDFLAGS --> USES= localbase:ldflags
Moved BUILD_DEPS and LIB_DEPS for options below OPTIONS_ and _DESC

I also did a quick run using Poudriere (12.2) and isn't happy (yet) :-)

There however a few more issues that needs to be addressed

Warning: /usr/ports/net/opensips31/pkg-message not in UCL format, will be shown on initial install only.
Warning: See https://www.freebsd.org/doc/en/books/porters-handbook/pkg-files.html#porting-message
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: %%ETCDIR%%/scenario_callcenter.xml
Error: Orphaned: %%LIBDIR%%/modules/callops.so
Error: Orphaned: %%LIBDIR%%/modules/freeswitch.so
Error: Orphaned: %%LIBDIR%%/modules/freeswitch_scripting.so
Error: Orphaned: %%LIBDIR%%/modules/media_exchange.so
Error: Orphaned: %%LIBDIR%%/modules/proto_smpp.so
Error: Orphaned: %%LIBDIR%%/modules/qrouting.so
Error: Orphaned: %%LIBDIR%%/modules/rate_cacher.so
Error: Orphaned: sbin/osipsconfig
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.auth_jwt
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.callops
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.cgrates
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.compression
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.db_http
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.db_perlvdb
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.event_routing
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.event_stream
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.freeswitch
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.freeswitch_scripting
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.jsonrpc
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.media_exchange
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.mi_html
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.mid_registrar
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.proto_smpp
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.qrouting
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.rabbitmq
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.rabbitmq_consumer
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.rate_cacher
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.sip_i
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.siprec
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.stir_shaken
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.tracer
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.uuid
Error: Orphaned: %%PORTDOCS%%%%DOCSDIR%%/README.xml
===> Checking for items in pkg-plist which are not in STAGEDIR
===> Error: Plist issues found.
*** Error code 1

Best regards,
Daniel
Comment 5 daniel.engberg.lists 2021-03-27 11:21:00 UTC
Created attachment 223634 [details]
Patch for opensips31 (WIP)

Some additional fixes (WIP)
Comment 6 bambyster 2021-03-29 13:01:47 UTC
Created attachment 223681 [details]
opensips31 port

Hi,

Thank you very much for your help with the Makefile.

The xmlrpc-c and redis were there in the original port and I never checked if they are really required.

The python is both build and runtime dependency. The python module in opensips is linked against a shared library from the python package.

The pkg-plist and pkg-message issues have been resolved.

Best regards,
Andriy