A new user interface for you! Read more...

File jitsi.spec of Package jitsi

#
# spec file for package jitsi
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define libdir_name jitsi
%define debug_package %{nil}

%ifarch x86_64 amd64
  %define folder linux-64
%else
  %define folder linux
%endif

Name:           jitsi-unstable
Version:        2.6
Release:        5390
Summary:        Multiprotocol (SIP, XMPP/Jabber, ecc.) VoIP and instant messaging software
Group:          Productivity/Networking/Instant Messenger
License:        LGPL-2.1+
Url:            http://www.jitsi.org
## SOURCES AND PATCHES
# Main program
Source0:        jitsi-src-2.6.5390.tar.xz
Source1:        libjitsi.tar.xz
# Additional libraries
Source11:       portaudio.tar.xz
Source12:       vpxinclude.tar.xz
Source13:       jdic_misc.tar.xz
Source15:       sctp.tar.xz
Source14:       unbound-1.5.1.tar.xz
# Resources
Source21:       jitsi-32.sh
Source22:       jitsi-64.sh
Source23:       Jitsi.desktop
Source24:       jitsi_100x100.png
# PATCH-FIX-OPENSUSE build.xml-native-sysactivity.patch -- change an include directory
Patch1:         build.xml-native-sysactivity.patch
# PATCH-FIX-OPENSUSE build.xml-native-vpx.patch -- remove an useless included file
Patch2:         build.xml-native-vpx.patch
# PATCH-FIX-OPENSUSE configure.ac-libjunbound.patch -- remove some warnings that cause automake to fail
Patch3:         configure.ac-libjunbound.patch
Patch4:         build.xml-native-portaudio.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  java >= 1.7.0 java-devel >= 1.7.0 xalan-j2 ant
BuildRequires:  gcc-c++ dbus-1-devel xz unzip autoconf automake
BuildRequires:  speex speex-devel pulseaudio-libs alsa-lib-devel libvpx-devel
BuildRequires:  xorg-x11-proto-devel xorg-x11-devel
BuildRequires:  glib2-devel gtk2-devel gnome-vfs2-devel libgnome-devel
BuildRequires:  xml-commons-apis  
BuildRequires:  libmatroska-devel libebml-devel

%if 0%{?suse_version}
%if 0%{?suse_version} >= 1320
BuildRequires:  unbound-devel libunbound2
%endif
%if 0%{?suse_version} > 1320
BuildRequires:  speexdsp-devel
%endif
BuildRequires:  matthewlib-java update-desktop-files libtool
BuildRequires:  libexpat1 libexpat-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libasound2 libopus-devel pulseaudio-devel
%endif

%if 0%{?fedora}
BuildRequires:  libXScrnSaver-devel libX11-devel libXt-devel libXtst-devel libXv-devel 
BuildRequires:  libmatthew-java desktop-file-utils
BuildRequires:  sane-backends-libs expat expat-devel openssl-devel
BuildRequires:  opus-devel pulseaudio-libs-devel
BuildRequires:  unbound-devel unbound-libs
%endif

Requires:       java >= 1.7.0
%if 0%{?suse_version}
Requires:       matthewlib-java
%else
Requires:       libmatthew-java
%endif


%global __provides_exclude_from ^%{_libdir}/%{libdir_name}/.*$
%global __requires_exclude ^libcrypto.so[0-9\\._]*\\(OPENSSL[0-9\\._]*\\)[\\(\\)0-9a-zA-Z_]*$


%description
Jitsi is an audio/video and chat communicator that supports protocols
such as SIP, XMPP/Jabber, AIM/ICQ, Windows Live, Yahoo!, Bonjour and many other
useful features such as voice and chat encryption.


%prep
%setup -T -q -n jitsi -b 0
tar -xf %{SOURCE13}

# libjitsi
tar -xf %{SOURCE1}
cd libjitsi
tar -xf %{SOURCE11}
tar -xf %{SOURCE12}
%patch2
%patch4 -p1
cd ..

%patch1
%patch3


%build

export CFLAGS="%{optflags} $CFLAGS"
export CXXFLAGS="%{optflags} $CXXFLAGS"
export CPPFLAGS="%{optflags} $CPPFLAGS"

echo %{_libdir}
echo %{java_home}
echo $JAVA_HOME

rm lib/native/%{folder}/*

################################
#       BUILD LIBJITSI         #
################################

cd libjitsi

#Build main library
%ant rebuild
cp libjitsi.jar ../lib/installer-exclude

#Build jawtrenderer
rm lib/native/%{folder}/libjnawtrenderer.so
%ifarch x86_64 amd64
  export LIBRARY_PATH="%{java_home}/jre/lib/amd64"
  export LDFLAGS="-Wl,-rpath=%{java_home}/jre/lib/amd64"
%else
  export LIBRARY_PATH="%{java_home}/jre/lib/i386"
  export LDFLAGS="-Wl,-rpath=%{java_home}/jre/lib/i386"
%endif
%ant jawtrenderer
unset LDFLAGS
unset LIBRARY_PATH

#Build portaudio
rm lib/native/%{folder}/libjnportaudio.so
cd portaudio
autoreconf -if
%configure --disable-shared --enable-static --with-pic --with-jack=no
make clean
make %{?_smp_mflags}
cd ..
%ant portaudio -Dportaudio=$(pwd)/portaudio -Dspeex.dynamic=1

#Build ffmpeg
#%ant ffmpeg -Dffmpeg="" -Dlame="" -Dx264=""

#Build Opus
rm lib/native/%{folder}/libjnopus.so
export CPATH="/usr/include/opus:$CPATH"
%ant opus -Dopus=""

#Build libvpx
rm lib/native/%{folder}/libjnvpx.so
rm -f lib/native/%{folder}/libvpx.so.1
rm -f lib/native/%{folder}/libvpx.so
%ant libvpx -Dlibvpx=$(pwd)/vpxinclude

#Build video4linux2
rm lib/native/%{folder}/libjnvideo4linux2.so
%ant video4linux2

#Build pulseaudio
rm lib/native/%{folder}/libjnpulseaudio.so
gcc %{optflags} -fPIC -I%{_libdir}/jvm/java/include -I%{_libdir}/jvm/java/include/linux \
  -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux \
  -O2 -Wall src/native/linux/pulseaudio/org_jitsi_impl_neomedia_pulseaudio_PA.c \
  -lpulse -shared -o lib/native/%{folder}/libjnpulseaudio.so \
  -Wl,--no-undefined -lpulse -ldl && strip -x lib/native/%{folder}/libjnpulseaudio.so

#Build screencapture
rm lib/native/%{folder}/libjnscreencapture.so
%ant screencapture

#Build speex
rm lib/native/%{folder}/libjnspeex.so
%ant speex -Dspeex.dynamic=true

#Build g722
rm lib/native/%{folder}/libjng722.so
%ant g722

#Build usrsctp
rm lib/native/%{folder}/libjnsctp.so
cd src/native/sctp
tar -xJf %{SOURCE15}
cd sctp-1/KERN/usrsctp
libtoolize
aclocal
autoconf
touch AUTHORS NEWS README ChangeLog
automake --add-missing
%configure --with-pic
make %{?_smp_mflags}
cd ../../..
cd ../../..
%ant sctp -Dusrsctp=$(pwd)/src/native/sctp/sctp-1/KERN/usrsctp

#Copy built libraries into Jitsi main folder
cp lib/native/%{folder}/* ../lib/native/%{folder}/

cd ..


################################
#         BUILD JITSI          #
################################

#Build main program
%ant rebuild

#Build hid
%ant hid

#Build hwaddressretriever
%ant hwaddressretriever

#Build galagonotification
#Hidden dbus header
export CPATH="%{_libdir}/dbus-1.0/include"
%ant galagonotification

#Build sysactivity
%ant sysactivity

#Build globalshortcut
%ant globalshortcut

#Build jdic_misc
cd jdic_misc
%ifarch x86_64 amd64
  export LIBRARY_PATH="%{java_home}/jre/lib/amd64"
  export LDFLAGS="-Wl,-rpath=%{java_home}/jre/lib/amd64"
%else
  export LIBRARY_PATH="%{java_home}/jre/lib/i386"
  export LDFLAGS="-Wl,-rpath=%{java_home}/jre/lib/i386"
%endif
gcc %{optflags} -c -fPIC -I%{_libdir}/jvm/java/include -I%{_libdir}/jvm/java/include/linux \
  -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux -o alerter.o alerter.c
gcc -shared -o libjdic_misc.so alerter.o -ljawt
%ifarch x86_64 amd64
  cp libjdic_misc.so ../lib/native/linux-64
%else
  cp libjdic_misc.so ../lib/native/linux
%endif
unset LDFLAGS
unset LIBRARY_PATH
cd ..

#Build libjunbound
cd src/native/libjunbound
%if 0%{?suse_version} && 0%{?suse_version} <= 1310
	export CPATH="%{java_home}/include:%{java_home}/include/linux:$CPATH"
    libjunbound_dir=$(pwd)
	out=$libjunbound_dir/build
	prefix=$libjunbound_dir/unbound-lib
	mkdir -p $out
	mkdir -p $prefix
    cd $out
	tar -xJf %{SOURCE14}
    cd $out/unbound-1.5.1
	patch -p 1 -i $libjunbound_dir/unbound.patch
    export CFLAGS="%{optflags}"
    export CXXFLAGS="%{optflags}"
	./configure --with-pic --prefix=$prefix
	make %{?_smp_mflags}
	make install
	cd $out
	gcc $libjunbound_dir/src/net_java_sip_communicator_impl_dns_UnboundApi.cpp -fpic -shared -o libjunbound.so -I$JAVA_HOME/include -Wl,-Bstatic -L$prefix/lib -lunbound -I$prefix/include -Wl,-Bdynamic -lcrypto -lssl
	strip libjunbound.so
    ls -l
    cd $libjunbound_dir
    %ifarch x86_64 amd64
  		cp $out/libjunbound.so $libjunbound_dir/../../../lib/native/linux-64
	%else
  		cp $out/libjunbound.so $libjunbound_dir/../../../lib/native/linux
	%endif
%else
	autoreconf --install
	%configure
	make %{?_smp_mflags}
    %ifarch x86_64 amd64
  		cp src/.libs/libjunbound.so ../../../lib/native/linux-64
	%else
  		cp src/.libs/libjunbound.so ../../../lib/native/linux
	%endif
%endif

cd ../../..


%install

#Install bundles
mkdir -p %{buildroot}%{_libdir}/%{libdir_name}
mkdir -p %{buildroot}%{_libdir}/%{libdir_name}/sc-bundles
rm -f sc-bundles/*-slick.jar
cp -r sc-bundles/os-specific/linux/* %{buildroot}%{_libdir}/%{libdir_name}/sc-bundles/
rm -f -r sc-bundles/os-specific
cp -r sc-bundles/* %{buildroot}%{_libdir}/%{libdir_name}/sc-bundles/

#Install other bundles and libs
mkdir -p %{buildroot}%{_libdir}/%{libdir_name}/lib
cp -r lib/bundle %{buildroot}%{_libdir}/%{libdir_name}/lib/
rm -r -f lib/bundle

#Install native libraries
mkdir -p %{buildroot}%{_libdir}/%{libdir_name}/lib/native
%ifarch x86_64 amd64
    rm -r -f lib/native/linux-64/*exclude
    cp lib/native/linux-64/* %{buildroot}%{_libdir}/%{libdir_name}/lib/native/
%else
    rm -r -f lib/native/linux/*exclude
    cp lib/native/linux/* %{buildroot}%{_libdir}/%{libdir_name}/lib/native/
%endif
rm -r -f lib/native
rm -r -f lib/*exclude
rm -r -f lib/os-specific
cp -r lib/* %{buildroot}%{_libdir}/%{libdir_name}/lib/
rm -f %{buildroot}%{_libdir}/%{libdir_name}/lib/native/libunix-java.so
ln --symbolic %{_libdir}/libunix-java.so %{buildroot}%{_libdir}/%{libdir_name}/lib/native/libunix-java.so

#Install executable start script
mkdir -p %{buildroot}%{_bindir}
%ifarch x86_64 amd64
    cp -r %{SOURCE22} %{buildroot}%{_bindir}/jitsi
%else
    cp -r %{SOURCE21} %{buildroot}%{_bindir}/jitsi
%endif
sed -i -e "s;_JAVA_HOME_DIR_;%{java_home};"  %{buildroot}%{_bindir}/jitsi

#Install icons
mkdir -p %{buildroot}%{_datadir}/pixmaps
cp resources/images/logo/sc_logo_45x45.png %{buildroot}%{_datadir}/pixmaps/
cp %{SOURCE24} %{buildroot}%{_datadir}/pixmaps/
cp resources/install/debian/jitsi.svg %{buildroot}%{_datadir}/pixmaps/

#Install desktop file
mkdir -p %{buildroot}%{_datadir}/applications/
cp %{SOURCE23} %{buildroot}%{_datadir}/applications/
%if 0%{?suse_version}
  %suse_update_desktop_file Jitsi Network Telephony InstantMessaging
%else
  desktop-file-install --add-category="Network;Telephony" --dir=%{buildroot}%{_datadir}/applications %{SOURCE23}
%endif

# copy the documentation
mkdir -p %{buildroot}%{_mandir}/man1
cp resources/install/debian/jitsi.1.tmpl %{buildroot}%{_mandir}/man1/jitsi.1
sed -i -e "s/_PACKAGE_NAME_/jitsi/"  %{buildroot}%{_mandir}/man1/jitsi.1
sed -i -e "s/_APP_NAME_/Jitsi/"  %{buildroot}%{_mandir}/man1/jitsi.1
gzip %{buildroot}%{_mandir}/man1/jitsi.1


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%{_libdir}/%{libdir_name}
%{_datadir}/pixmaps/sc_logo_45x45.png
%{_datadir}/pixmaps/jitsi_100x100.png
%{_datadir}/pixmaps/jitsi.svg
%{_datadir}/applications/Jitsi.desktop
%{_mandir}/man1/jitsi.1.gz
%attr(0755,root,root) %{_bindir}/jitsi


%changelog