From 8e2d5a5e78a84aaaf1b36a09b181e7f2f6080670 Mon Sep 17 00:00:00 2001
From: Damian Minkov <damencho@jitsi.org>
Date: Fri, 6 Jun 2014 11:25:09 +0300
Subject: [PATCH] Adds speex dynamic for building speex binary, needed for
 debian source package.

---
 src/native/build.xml | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/src/native/build.xml b/src/native/build.xml
index 2aba4f4c..6fd39e84 100644
--- a/src/native/build.xml
+++ b/src/native/build.xml
@@ -578,7 +578,31 @@
   <!-- compile jnspeex library -->
   <target name="speex" description="Build jnspeex shared library" depends="init-native">
 
-    <fail message="speex repository not set!" unless="speex" />
+      <condition property="is.speex.set" value="true">
+          <and>
+              <isset property="speex"/>
+              <not>
+                  <isset property="speex.dynamic"/>
+              </not>
+          </and>
+      </condition>
+      <condition property="is.speex.set" value="true">
+          <and>
+              <isset property="speex.dynamic"/>
+              <not>
+                  <isset property="speex"/>
+              </not>
+          </and>
+      </condition>
+
+      <condition property="is.speex.dynamic.set" value="true">
+          <and>
+              <isset property="speex.dynamic"/>
+              <isset property="is.running.linux"/>
+          </and>
+      </condition>
+
+      <fail message="speex repository not set!" unless="is.speex.set" />
 
     <cc outtype="shared" name="gcc" outfile="${native_install_dir}/jnspeex" objdir="${obj}">
       <!-- common compiler flags -->
@@ -602,10 +626,13 @@
       <!-- static libraries MUST be at the end otherwise
       they will not be added to shared library
       -->
-      <linkerarg value="-Wl,-Bstatic" location="end" if="is.running.linux" />
-      <linkerarg value="-lspeex" location="end" if="is.running.linux" />
-      <linkerarg value="-lspeexdsp" location="end" if="is.running.linux" />
+      <linkerarg value="-Wl,-z,relro" if="is.running.debian"/>
+      <linkerarg value="-Wl,-Bstatic" location="end" if="is.running.linux" unless="speex.dynamic"/>
+      <linkerarg value="-lspeex" location="end" if="is.running.linux" unless="speex.dynamic"/>
+      <linkerarg value="-lspeexdsp" location="end" if="is.running.linux" unless="speex.dynamic"/>
       <linkerarg value="-Wl,-Bdynamic" location="end" if="is.running.linux" />
+      <linkerarg value="-lspeex" location="end" if="is.speex.dynamic.set"/>
+      <linkerarg value="-lspeexdsp" location="end" if="is.speex.dynamic.set"/>
       <linkerarg value="-lm" location="end" if="is.running.linux" />
 
       <!-- Mac OS X specific flags -->
-- 
GitLab