gmediaserver/gmediaserver.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 89
784543bb550b
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 ##
     2 ##  gmediaserver.spec -- OpenPKG RPM Specification
     3 ##  Copyright (c) 2009 Michael Schloh von Bennewitz <michael@schloh.com>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    25 #   package information
    26 Name:         gmediaserver
    27 Summary:      UPnP Media Server
    28 URL:          http://www.gnu.org/software/gmediaserver/
    29 Vendor:       Oskar Liljeblad
    30 Packager:     Michael Schloh von Bennewitz
    31 Distribution: Europalab Networks Production
    32 Class:        EVAL
    33 Group:        Network
    34 License:      GPL
    35 Version:      0.13.0
    36 Release:      20090106
    38 #   package options
    39 %option       with_fsl  yes
    41 #   list of sources
    42 Source0:      http://www.very-clever.com/download/nongnu/gmediaserver/gmediaserver-%{version}.tar.gz
    43 Source1:      rc.gmediaserver
    44 Source2:      fsl.gmediaserver
    45 Patch0:       gmediaserver.patch
    47 #   build information
    48 Prefix:       %{l_prefix}
    49 BuildRoot:    %{l_buildroot}
    50 BuildPreReq:  OpenPKG, openpkg >= 20040130, make, gcc
    51 PreReq:       OpenPKG, openpkg >= 20040130
    52 BuildPreReq:  libupnp, file, id3lib, taglib
    53 PreReq:       libupnp, file, id3lib, taglib
    54 %if "%{with_fsl}" == "yes"
    55 BuildPreReq:  fsl >= 1.2.0
    56 PreReq:       fsl >= 1.2.0
    57 %endif
    58 AutoReq:      no
    59 AutoReqProv:  no
    61 %description
    62     GMediaServer is a console based UPnP compatible media server.
    63     It serves audio and video files to those network connected media
    64     players capable of receiving media over UPnP.
    66 %track
    67     prog gmediaserver = {
    68         version   = %{version}
    69         url       = http://www.very-clever.com/download/nongnu/gmediaserver/
    70         regex     = gmediaserver-(__VER__)\.tar\.gz
    71     }
    73 %prep
    74     #   unpack sources
    75     %setup -q
    76     %patch -p0
    78     #   correct build configuration
    79     %{l_shtool} subst \
    80         -e 's;\(LIBS="-lupnp\)  \(\$LIBS"\);\1 -lixml -lthreadutil \2;' \
    81         -e 's;\(UPNP_LIBS="\$PTHREAD_LIBS -L\$prefixupnp/lib -lupnp\);\1 -lixml -lthreadutil;' \
    82         -e 's;\(LIBMAGIC=\)\(-lmagic\);\1"\2 -lz";' \
    83         configure
    84     %{l_shtool} subst \
    85         -e 's/tm.tm_zone = "GMT";/tzname[0] = "GMT";/' \
    86         src/webclient.c
    88 %build
    89     #   prepare configuration
    90     CC="%{l_cc}" \
    91     CFLAGS="%{l_cflags -O} -pthread" \
    92     CPPFLAGS="%{l_cppflags}" \
    93     LDFLAGS="%{l_ldflags} %{l_fsl_ldflags} -pthread" \
    94     LIBS="%{l_fsl_libs}" \
    95     GREP="grep" \
    96     ./configure \
    97         --prefix=%{l_prefix} \
    98         --disable-nls
   100     #   use the internal getopt definitions
   101     cd lib && %{l_make} %{l_mflags} getopt.h iconv_.h
   103     #   build using parallel make
   104     %{l_make} %{l_mflags -O}
   106 %install
   107     #   remove previously existing installations
   108     rm -rf $RPM_BUILD_ROOT
   110     #   run the native installation logic
   111     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   113     #   create additional installation paths
   114     %{l_shtool} mkdir -f -p -m 755 \
   115         $RPM_BUILD_ROOT%{l_prefix}/share/gmediaserver \
   116         $RPM_BUILD_ROOT%{l_prefix}/var/gmediaserver/log \
   117         $RPM_BUILD_ROOT%{l_prefix}/var/gmediaserver/run
   119     #   correct the installation hierarchy
   120     mv $RPM_BUILD_ROOT%{l_prefix}/share/man \
   121        $RPM_BUILD_ROOT%{l_prefix}/
   122     mv $RPM_BUILD_ROOT%{l_prefix}/share/info \
   123        $RPM_BUILD_ROOT%{l_prefix}/
   125     #   strip binaries laden with symbols
   126     strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   128     #   install runcommand script
   129     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   130     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   131         %{SOURCE rc.gmediaserver} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   133     #   install OSSP fsl configuration
   134     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   135     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   136         %{SOURCE fsl.gmediaserver} \
   137         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   139     #   determine installation files
   140     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   141         %{l_files_std} \
   142         '%not %dir %{l_prefix}/etc/fsl' \
   143         '%config %{l_prefix}/etc/fsl/fsl.gmediaserver'
   145 %files -f files
   147 %clean
   148     rm -rf $RPM_BUILD_ROOT
   150 %pre
   151     #   before upgrading package, record runtime status and stop service
   152     [ $1 -eq 2 ] || exit 0
   153     eval `%{l_rc} gmediaserver status 2>/dev/null | tee %{l_tmpfile}`
   154     %{l_rc} gmediaserver stop 2>/dev/null
   155     exit 0
   157 %post
   158     if [ $1 -eq 2 ]; then
   159         #   after upgrading package, restore runtime status
   160         eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true
   161         [ ".$gmediaserver_active" = .yes ] && sleep 2 && %{l_rc} gmediaserver start
   162     fi
   163     exit 0
   165 %preun
   166     #   before removing package, stop service and remove log files
   167     [ $1 -eq 0 ] || exit 0
   168     %{l_rc} gmediaserver stop 2>/dev/null
   169     rm -f $RPM_INSTALL_PREFIX/var/gmediaserver/log/* >/dev/null 2>&1 || true
   170     exit 0

mercurial