#13 Use bundled jansson and pjproject for epel
Opened 3 years ago by spike. Modified 3 years ago
rpms/ spike/asterisk fix-epel-build  into  rawhide

file modified
+26
@@ -12,7 +12,13 @@ 

  %global           tmpfilesd        1

  

  %global           apidoc     0

+ %if 0%{?fedora}

  %global           mysql      1

+ %endif

+ %if 0%{?rhel}

+ # Disable mysql for epel until RHBZ#1652293 is resolved

+ %global           mysql      0

+ %endif

  %global           odbc       1

  %global           postgresql 1

  %global           radius     1
@@ -61,6 +67,10 @@ 

  #"551F 2910 4B21 0608 0C6C  2851 073B 0C1F C9B2 E352" \

  #"57E7 69BC 3790 6C09 1E7F  641F 6CB4 4E55 7BD9 82D8" > asterisk-gpgkeys.gpg

  Source7:          asterisk-gpgkeys.gpg

+ %if 0%{?rhel}

+ Source8:          https://raw.githubusercontent.com/asterisk/third-party/master/jansson/2.11/jansson-2.11.tar.bz2

+ Source9:          https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.7.2/pjproject-2.7.2.tar.bz2

PJProject 2.8 is out, and the 16.1.0 release of Asterisk actually prefers it.

+ %endif

  

  %if 0%{?fedora}

  Patch0:           asterisk-mariadb.patch
@@ -197,8 +207,10 @@ 

  

  BuildRequires:    uw-imap-devel

  

+ %if 0%{?fedora}

  BuildRequires:    pjproject-devel

  BuildRequires:    jansson-devel

+ %endif

  

  Requires(pre):    %{_sbindir}/useradd

  Requires(pre):    %{_sbindir}/groupadd
@@ -676,6 +688,11 @@ 

  %{__perl} -pi -e 's/^MENUSELECT_RES=(.*)$/MENUSELECT_RES=\1 res_http_post/g' menuselect.makeopts

  %endif

  

+ %if 0%{?rhel}

+ cp %{SOURCE8} %{_builddir}/asterisk-%{version}/third-party/jansson/

+ cp %{SOURCE9} %{_builddir}/asterisk-%{version}/third-party/pjproject/

+ %endif

+ 

  %build

  

  export CFLAGS="%{optflags}"
@@ -695,7 +712,12 @@ 

  %configure

  popd

  

+ %if 0%{?fedora}

  %configure --with-imap=system --with-gsm=/usr --with-ilbc=/usr --with-libedit=yes --with-srtp --with-pjproject=/usr --without-pjproject-bundled LDFLAGS="%{ldflags}"

+ %endif

+ %if 0%{?rhel}

+ %configure --with-imap=system --with-gsm=/usr --with-ilbc=/usr --with-libedit=yes --with-srtp --with-pjproject-bundled --with-jansson-bundled LDFLAGS="%{ldflags}"

+ %endif

  

  %make_build menuselect-tree NOISY_BUILD=1

  %{__perl} -n -i -e 'print unless /openr2/i' menuselect-tree
@@ -903,6 +925,10 @@ 

  %{_unitdir}/asterisk.service

  

  %{_libdir}/libasteriskssl.so.1

+ %if 0%{?rhel} >= 7

+ %{_libdir}/libasteriskpj.so

+ %{_libdir}/libasteriskpj.so.2

+ %endif

  

  %dir %{_libdir}/asterisk

  %dir %{_libdir}/asterisk/modules

file modified
+2
@@ -1,2 +1,4 @@ 

  SHA512 (asterisk-16.0.1.tar.gz) = 49ef314187a6818beafa18d5d9bb59954c87fb3b920a416bb2509ad1f452281dd22600a78105d7965836ad8ae060955485503945dcea78da3842d3ecb97611bb

  SHA512 (asterisk-16.0.1.tar.gz.asc) = d31cc43094bcf922bed46e917905158d0051f4bec29b60f1d3984189b6bc7cc9cdbe2f42676b0afdb05e11f95661d8a40984f6e48fd00abc13a2b409ff58067b

+ SHA512 (jansson-2.11.tar.bz2) = 3a9ef8c470d203ef65f214d979d0a8dfc034ff1417b2af7071564c804e33d51f7b30915c7d62ac2156092aef756e4cdc3298a67205b913ffc312dcafeeefc1dc

+ SHA512 (pjproject-2.7.2.tar.bz2) = 3d355ffcbbeed62cfc711e574a987dc06043ccf4f2625820adffa89167022b8306fcee3fada71d3d45e7b902fc9c65ac8221de101cbafed25362a3921f702afd

Bundles jansson 2.11 and pjproject 2.7.2 which are the versions the asterisk configure script pulls when --with-pjproject-bundled and --with-jansson-bundled are specified.
Those are needed since

  • jansson 2.10 (which is included in epel7) doesn't have json_sprintf()
  • building asterisk with pjproject 2.3 (which is the current version in epel7) fails with
    res_pjsip_session.c:4070:10: error: 'pjsip_inv_session' has no member named 'following_fork'

Open questions:

  • Is bundling libraries this way in line with the epel guidelines?
  • Should one prefer conditionals to check for fedora/epel or write a separate spec file for each branch?
  • Is %{_libdir} the right place for libasteriskpj.so and should it be part of the main package?
  • Is it ok to copy the tarballs in the prep stage by doing cp %{SOURCE8} %{_builddir}/asterisk-%{version}/third-party/jansson/?

Test build can be found here: https://copr.fedorainfracloud.org/coprs/spike/asterisk/build/837439/

Open questions:

Is bundling libraries this way in line with the epel guidelines?

I still haven't taken the time to figure out if EPEL allows bundling (like Fedora does now), especially for packages that are in the distro (but are older versions).

Should one prefer conditionals to check for fedora/epel or write a separate spec file for each branch?

I would prefer to use conditionals, unless it's absolutely too unwieldy.

Is %{_libdir} the right place for libasteriskpj.so and should it be part of the main package?

I would think it should be in %{_libdir}/asterisk, but that's just a guess.

Is it ok to copy the tarballs in the prep stage by doing cp %{SOURCE8} %{_builddir}/asterisk-%{version}/third-party/jansson/?

That should probably work... Ideally we'd put the tarballs in a separate directory and pass "--with-download-cache=blah" to ./configure but I haven't been able to get that to work.

Test build can be found here: https://copr.fedorainfracloud.org/coprs/spike/asterisk/build/837439/

PJProject 2.8 is out, and the 16.1.0 release of Asterisk actually prefers it.

Is it ok to copy the tarballs in the prep stage by doing cp %{SOURCE8} %{_builddir}/asterisk-%{version}/third-party/jansson/?

That should probably work... Ideally we'd put the tarballs in a separate directory and pass "--with-download-cache=blah" to ./configure but I haven't been able to get that to work.

As far as I can see those flags (--with-download-cache as well as --with-externals-cache) can only be used to specify where the tarballs would be downloaded to, not where to find already downloaded tarballs. However, configure checks asterisk-16.0.1/third-party/jansson and asterisk-16.0.1/third-party/pjproject if the tarballs are already present and extracts them.

Is %{_libdir} the right place for libasteriskpj.so and should it be part of the main package?

I would think it should be in %{_libdir}/asterisk, but that's just a guess.

Since make install puts it %{_libdir} I assume this is correct.

PJProject 2.8 is out, and the 16.1.0 release of Asterisk actually prefers it.

So... you update the master branch to 16.1.0 first and I'll rebase?