File gpac.spec of Package gpac

# spec file for package gpac
# Copyright (c) 2012 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

%define soname		2

# workaround for Tumbleweed. Because we can't detect it directly.
%if 0%{?suse_version} >= 1210
%define xulrunner_version %(rpm -q --qf '%%{VERSION}' xulrunner-devel | sed 's|\\..*$||')
%define xulrunner192_version %(rpm -q --qf '%%{VERSION}' mozilla-xulrunner192-devel | sed 's|\\..*$||')

# - ugly hack to disable compilation with xulrunnner 17.0.2
%if 0%{?xulrunner_version} == 17
%define wo_applications 1
%define wo_applications 0

Name:           gpac
Version:        0.5.0.svn4296
License:        LGPL-2.1+
Summary:        A multimedia framework covering MPEG-4, VRML/X3D and SVG
Group:          Productivity/Multimedia/Video/Editors and Convertors
Source:         gpac-%{version}.tar.bz2
Source90:       %{name}-rpmlintrc
#PATCH-FIX-openSUSE - openSUSE only fix for sf#3574796
Patch0:         gpac-0.5.0-smjs_call_prop_stub.patch
#PATCH-FIX-UPSTREAM - enable osmozilla and osmo4_wx
Patch1:		gpac-0.5.0-enable_V4Studio.patch
#PATCH-FIX-UPSTREAM - fix SVGGen ldflags
Patch2:		gpac-0.5.0-SVGGen_abuild.patch
#PATCH-FIX-UPSTREAM - fix E: 64bit-portability-issue
Patch3:		gpac-0.5.0-64bit-portability.patch
#PATCH-FIX-UPSTREAM - export functions x264 needs
Patch4:		gpac-0.5.0-x264-export.patch
#PATCH-FIX-UPSTREAM - disable applications osmozilla, osmo4_wx
Patch10:	gpac-0.5.0-disable-applications.patch
BuildRequires:  DirectFB-devel
BuildRequires:  ImageMagick
BuildRequires:  Mesa-devel
BuildRequires:  alsa-devel
BuildRequires:  dos2unix
BuildRequires:  doxygen
BuildRequires:	 fdupes
BuildRequires:  freeglut-devel
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
%if 0%{?suse_version} >= 1140
BuildRequires:  libSDL-devel
BuildRequires:  SDL-devel
BuildRequires:  liba52-devel
BuildRequires:  libfaad-devel
BuildRequires:  libffmpeg-devel
# fix for evergreen 11
%if 0%{?suse_version} == 1110
BuildRequires:  libidl
BuildRequires:  libjpeg-devel
BuildRequires:  libmad-devel
BuildRequires:  libogg-devel
BuildRequires:  libpng-devel
BuildRequires:  libpulse-devel
BuildRequires:  librsvg-devel >= 2.5.0
BuildRequires:  libtheora-devel
BuildRequires:  libvorbis-devel
BuildRequires:  libxvidcore-devel
%if 0%{?suse_version} == 1140
BuildRequires:  mozilla-js192
%if 0%{?suse_version} > 1140
BuildRequires:  js-devel
%if 0%{?suse_version} <= 1140
%if ! 0%{?sles_version}
BuildRequires:  mozilla-xulrunner192-devel
BuildRequires:  xulrunner-devel
BuildRequires:  libopenssl-devel
%if 0%{?suse_version} >= 1140
BuildRequires:  pkgconfig(libopenjpeg)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  unzip
BuildRequires:  update-desktop-files
%if 0%{?suse_version} >= 1140
BuildRequires:  wxWidgets-wxcontainer-devel
BuildRequires:  wxGTK-devel
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

GPAC is a multimedia framework for MPEG-4, VRML/X3D and SVG/SMIL.

GPAC is built upon an implementation of the MPEG-4 Systems standard
(ISO/IEC 14496-1) developed from scratch in C.

The main development goal is to provide a clean (a.k.a. readable by
as many people as possible), small and flexible alternative to the
MPEG-4 Systems reference software (known as IM1 and distributed in
ISO/IEC 14496-5).

The second development goal is to achieve integration of recent
multimedia standards (SVG/SMIL, VRML, X3D, SWF, etc) into a single
framework. This stage is still under drafting but GPAC already
supports most of VRML97, some X3D as well as very simple SVG.

GPAC already features 2D and 3D multimedia playback, MPEG-4 Systems
encoders/multiplexers and publishing tools for content distribution.

GPAC is licensed under the GNU Lesser General Public License.

The current GPAC release (0.4.5) already covers a very large part of
the MPEG-4 standard, and features what can probably be seen as the
most advanced and robust 2D MPEG-4 Player available worldwide, as
well as a decent 3D MPEG-4/VRML player.

Author:         Jean Le Feuvre <jeanlf at>

%package -n libgpac%{soname}
Summary:        Shared libraries for gpac
Group:          System/Libraries

%description -n libgpac%{soname}
Shared libraries for package gpac.

%package -n libgpac-devel
Summary:        Development files for gpac
Group:          Development/Languages/C and C++
Requires:       libgpac%{soname} = %{version}
# old name
Provides:       gpac-devel = %{version}
Obsoletes:      gpac-devel < %{version}

%description -n libgpac-devel
Development files for gpac.

Author:         Jean Le Feuvre <>

%if ! %{wo_applications}
%package -n Osmo4
Summary:        MPEG-4 Media player based on gpac
Group:          Productivity/Multimedia/Video/Players
Requires:       %{name} = %{version}

%description -n Osmo4
Osmo4 is an MPEG-4 player with the following features:
* MPEG-4 Systems player:
* Optimized 2D graphics renderer compliant with the Complete2D Scene
  Graph and Graphics profiles.
* Video and audio presentation achieved through plugins
* Multimedia player features:
* Timeline controls: play, pause, step.
* Graphics features: antialising, zoom and pan, scalable resizing
  of rendering area
* Support for Advanced Text and Graphics extension of MPEG-4 Systems
* Frame export to JPG, PNG, BMP.

Osmo4 enables the use of MPEG-4 Systems in a vast aplication domain,
among which:
* downloaded or streamed cartoons
* synchronized, interactive mixes of graphics, text, video and audio
* applications benefiting from MPEG-7 and MPEG-21 advances: meta-data,
  encryption, watermarking, rights management

%if ! 0%{?sles_version}
%package browser-plugin
Summary:        Osmozilla is a GPAC plugin for Mozilla-based browsers
Group:          Productivity/Networking/Web/Utilities
Requires:       %{name} = %{version}

%description browser-plugin
Osmozilla is a GPAC plugin for Mozilla-based browsers.

%setup -q
%if 0%{?suse_version} >= 1210
%if 0%{?xulrunner_version} >= 16
%patch0 -p1
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%if %{wo_applications}
%patch10 -p1

# unpack amr files
install -dm 755 modules/amr_float_dec/amr_nb_ft
pushd modules/amr_float_dec/amr_nb_ft
    unzip -q %{SOURCE1}
    unzip -qj

install -dm 755 modules/amr_float_dec/amr_wb_ft
pushd modules/amr_float_dec/amr_wb_ft
    unzip -q %{SOURCE2}
    unzip -qj

# Fix encoding warnings
cp -p Changelog Changelog.origine
iconv -f ISO-8859-1 -t UTF8 Changelog.origine > Changelog
touch -r Changelog.origine Changelog
rm -rf Changelog.origine

cp -p doc/ doc/
iconv -f ISO-8859-1 -t UTF8 doc/ > doc/
touch -r doc/ doc/
rm -rf doc/

# regenerate plugin interface from IDL (see applications/osmozilla/readme.txt)
%if 0%{?suse_version} > 1140
pushd applications/osmozilla
    chmod 666 nsIOsmozilla.xpt_linux; rm nsIOsmozilla.xpt_linux
    chmod 666 nsIOsmozilla.h
    chmod 666 nsIOsmozilla.idl

    %define _IDL_DIR `pkg-config --variable=idldir libxul`
    %define _SDK_DIR `pkg-config --variable=sdkdir libxul`

    %{_SDK_DIR}/sdk/bin/ \
   	-I%{_IDL_DIR} \
        -o nsIOsmozilla.h \
        %{_SDK_DIR}/sdk/bin/ \
   	-I%{_IDL_DIR} \
       -o nsIOsmozilla.xpt \

    cp nsIOsmozilla.xpt nsIOsmozilla.xpt_linux
%if ! 0%{?sles_version}
pushd applications/osmozilla
    chmod 666 nsIOsmozilla.xpt_linux; rm nsIOsmozilla.xpt_linux
    chmod 666 nsIOsmozilla.h
    chmod 666 nsIOsmozilla.idl

    %define _IDL_DIR `pkg-config --variable=idldir libxul`
    %define _INC_DIR `pkg-config --variable=includedir libxul`
    %define _LIB_DIR `pkg-config --variable=libdir libxul`

    %{_LIB_DIR}/xpidl \
        -m header \
        -I%{_IDL_DIR} \
        -I%{_INC_DIR}/xpcom/idl \
    %{_LIB_DIR}/xpidl \
        -m typelib \
        -I%{_IDL_DIR} \
        -I%{_INC_DIR}/xpcom/idl \
    %{_LIB_DIR}/xpt_link \
        nposmozilla.xpt nsIOsmozilla.xpt

    cp nsIOsmozilla.xpt nsIOsmozilla.xpt_linux

# configure the beast
./configure \
    --prefix=%{_prefix} \
%ifarch x86_64
    --libdir=lib64 \
    --mandir=%{_mandir} \
%if ! 0%{?sles_version}
    --xulsdk-path=`pkg-config --variable=sdkdir libxul` \
%if %{wo_applications}
    --disable-scenegraph \
    --extra-cflags="%{optflags} -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DXP_UNIX -fPIC" 

# make the beast (NO parallel build possible ...)
# fix I: File is compiled without RPM_OPT_FLAGS gpac doesn't respect any flags at all
make all CFLAG="%{optflags}"
make sggen 
make -C applications/generators/SVG
make -C applications/udptsseg

# create dev-docs
pushd doc
    doxygen -u


# header files
make install-lib \

%if ! %{wo_applications}
# browser-plugin
%if ! 0%{?sles_version}
install -dm 755 %{buildroot}%{_libdir}/browser-plugins
install -m 755 bin/gcc/ \
install -m 755 bin/gcc/nposmozilla.xpt \

# generated sggen binaries
for i in MPEG4 SVG X3D; do
    install -m 755 applications/generators/$i/${i}Gen \
install -m 755 bin/gcc/mp4* \

# udptsseg
install -m 755 bin/gcc/udptsseg \

%if ! %{wo_applications}
# Osmo4
install -m 755 bin/gcc/Osmo4 \

# icon
install -dm 755 %{buildroot}%{_datadir}/pixmaps
convert -size 48x48 applications/osmo4_wx/osmo4.xpm \
install -m 644 Osmo4.png \

%if ! %{wo_applications}
# menu-entry
install -dm 755 %{buildroot}%{_datadir}/applications
cat > Osmo4.desktop << EOF
[Desktop Entry]
Comment=MPEG-4 Media player based on gpac
GenericName=MPEG-4 Media player based on gpac
%suse_update_desktop_file -i Osmo4 AudioVideo Player

# static lib
rm -rf %{buildroot}%{_libdir}/*.a

%fdupes %{buildroot}

%post -n libgpac%{soname} -p /sbin/ldconfig

%postun -n libgpac%{soname} -p /sbin/ldconfig

%doc doc/configuration.html
%if ! %{wo_applications}

%files -n libgpac%{soname}

%files -n libgpac-devel
%doc doc/CODING_STYLE doc/
%doc doc/html/*

%if ! %{wo_applications}
%files -n Osmo4

%if ! 0%{?sles_version}
%files browser-plugin