gmediaserver/gmediaserver.spec

changeset 75
b3a835aa617c
child 85
e6a1cd7ed6ba
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gmediaserver/gmediaserver.spec	Mon Jan 12 19:09:19 2009 +0100
     1.3 @@ -0,0 +1,171 @@
     1.4 +##
     1.5 +##  gmediaserver.spec -- OpenPKG RPM Specification
     1.6 +##  Copyright (c) 2009 Michael Schloh von Bennewitz <michael@schloh.com>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +
    1.28 +#   package information
    1.29 +Name:         gmediaserver
    1.30 +Summary:      UPnP Media Server
    1.31 +URL:          http://www.gnu.org/software/gmediaserver/
    1.32 +Vendor:       Oskar Liljeblad
    1.33 +Packager:     Michael Schloh von Bennewitz
    1.34 +Distribution: Michael Schloh von Bennewitz
    1.35 +Class:        EVAL
    1.36 +Group:        Network
    1.37 +License:      GPL
    1.38 +Version:      0.13.0
    1.39 +Release:      20090106
    1.40 +
    1.41 +#   package options
    1.42 +%option       with_fsl  yes
    1.43 +
    1.44 +#   list of sources
    1.45 +Source0:      http://www.very-clever.com/download/nongnu/gmediaserver/gmediaserver-%{version}.tar.gz
    1.46 +Source1:      rc.gmediaserver
    1.47 +Source2:      fsl.gmediaserver
    1.48 +Patch0:       gmediaserver.patch
    1.49 +
    1.50 +#   build information
    1.51 +Prefix:       %{l_prefix}
    1.52 +BuildRoot:    %{l_buildroot}
    1.53 +BuildPreReq:  OpenPKG, openpkg >= 20040130, gcc
    1.54 +PreReq:       OpenPKG, openpkg >= 20040130, gcc
    1.55 +BuildPreReq:  libupnp, file, id3lib, taglib
    1.56 +PreReq:       libupnp, file, id3lib, taglib
    1.57 +%if "%{with_fsl}" == "yes"
    1.58 +BuildPreReq:  fsl >= 1.2.0
    1.59 +PreReq:       fsl >= 1.2.0
    1.60 +%endif
    1.61 +AutoReq:      no
    1.62 +AutoReqProv:  no
    1.63 +
    1.64 +%description
    1.65 +    GMediaServer is a console based UPnP compatible media server.
    1.66 +    It serves audio and video files to those network connected media
    1.67 +    players capable of receiving media over UPnP.
    1.68 +
    1.69 +%track
    1.70 +    prog gmediaserver = {
    1.71 +        version   = %{version}
    1.72 +        url       = http://www.very-clever.com/download/nongnu/gmediaserver/
    1.73 +        regex     = gmediaserver-(__VER__)\.tar\.gz
    1.74 +    }
    1.75 +
    1.76 +%prep
    1.77 +    #   unpack sources
    1.78 +    %setup -q
    1.79 +    %patch -p0
    1.80 +
    1.81 +    #   correct build configuration
    1.82 +    %{l_shtool} subst \
    1.83 +        -e 's;\(LIBS="-lupnp\)  \(\$LIBS"\);\1 -lixml -lthreadutil \2;' \
    1.84 +        -e 's;\(UPNP_LIBS="\$PTHREAD_LIBS -L\$prefixupnp/lib -lupnp\);\1 -lixml -lthreadutil;' \
    1.85 +        -e 's;\(LIBMAGIC=\)\(-lmagic\);\1"\2 -lz";' \
    1.86 +        configure
    1.87 +    %{l_shtool} subst \
    1.88 +        -e 's/tm.tm_zone = "GMT";/tzname[0] = "GMT";/' \
    1.89 +        src/webclient.c
    1.90 +
    1.91 +%build
    1.92 +    #   prepare configuration
    1.93 +    CC="%{l_cc}" \
    1.94 +    CFLAGS="%{l_cflags -O} -pthread" \
    1.95 +    CPPFLAGS="%{l_cppflags}" \
    1.96 +    LDFLAGS="%{l_ldflags} %{l_fsl_ldflags} -pthread" \
    1.97 +    LIBS="%{l_fsl_libs}" \
    1.98 +    GREP="grep" \
    1.99 +    ./configure \
   1.100 +        --prefix=%{l_prefix} \
   1.101 +        --disable-nls
   1.102 +
   1.103 +    #   use the internal getopt definitions
   1.104 +    cd lib && %{l_make} %{l_mflags} getopt.h iconv_.h
   1.105 +
   1.106 +    #   build using parallel make
   1.107 +    %{l_make} %{l_mflags -O}
   1.108 +
   1.109 +%install
   1.110 +    #   remove previously existing installations
   1.111 +    rm -rf $RPM_BUILD_ROOT
   1.112 +
   1.113 +    #   run the native installation logic
   1.114 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.115 +
   1.116 +    #   create additional installation paths
   1.117 +    %{l_shtool} mkdir -f -p -m 755 \
   1.118 +        $RPM_BUILD_ROOT%{l_prefix}/var/gmediaserver/log \
   1.119 +        $RPM_BUILD_ROOT%{l_prefix}/var/gmediaserver/run
   1.120 +
   1.121 +    #   correct the installation hierarchy
   1.122 +    mv $RPM_BUILD_ROOT%{l_prefix}/share/man \
   1.123 +       $RPM_BUILD_ROOT%{l_prefix}/
   1.124 +    mv $RPM_BUILD_ROOT%{l_prefix}/share/info \
   1.125 +       $RPM_BUILD_ROOT%{l_prefix}/
   1.126 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share
   1.127 +
   1.128 +    #   strip binaries laden with symbols
   1.129 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   1.130 +
   1.131 +    #   install runcommand script
   1.132 +    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   1.133 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.134 +        %{SOURCE rc.gmediaserver} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.135 +
   1.136 +    #   install OSSP fsl configuration
   1.137 +    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   1.138 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.139 +        %{SOURCE fsl.gmediaserver} \
   1.140 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   1.141 +
   1.142 +    #   determine installation files
   1.143 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   1.144 +        %{l_files_std} \
   1.145 +        '%not %dir %{l_prefix}/etc/fsl' \
   1.146 +        '%config %{l_prefix}/etc/fsl/fsl.gmediaserver'
   1.147 +
   1.148 +%files -f files
   1.149 +
   1.150 +%clean
   1.151 +    rm -rf $RPM_BUILD_ROOT
   1.152 +
   1.153 +%pre
   1.154 +    #   before upgrading package, record runtime status and stop service
   1.155 +    [ $1 -eq 2 ] || exit 0
   1.156 +    eval `%{l_rc} gmediaserver status 2>/dev/null | tee %{l_tmpfile}`
   1.157 +    %{l_rc} gmediaserver stop 2>/dev/null
   1.158 +    exit 0
   1.159 +
   1.160 +%post
   1.161 +    if [ $1 -eq 2 ]; then
   1.162 +        #   after upgrading package, restore runtime status
   1.163 +        eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true
   1.164 +        [ ".$gmediaserver_active" = .yes ] && %{l_rc} gmediaserver start
   1.165 +    fi
   1.166 +    exit 0
   1.167 +
   1.168 +%preun
   1.169 +    #   before removing package, stop service and remove log files
   1.170 +    [ $1 -eq 0 ] || exit 0
   1.171 +    %{l_rc} gmediaserver stop 2>/dev/null
   1.172 +    rm -f $RPM_INSTALL_PREFIX/var/gmediaserver/log/* >/dev/null 2>&1 || true
   1.173 +    exit 0
   1.174 +

mercurial