diff -r 6f9166cf333a -r b3a835aa617c gmediaserver/gmediaserver.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmediaserver/gmediaserver.spec Mon Jan 12 19:09:19 2009 +0100 @@ -0,0 +1,171 @@ +## +## gmediaserver.spec -- OpenPKG RPM Specification +## Copyright (c) 2009 Michael Schloh von Bennewitz +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + + +# package information +Name: gmediaserver +Summary: UPnP Media Server +URL: http://www.gnu.org/software/gmediaserver/ +Vendor: Oskar Liljeblad +Packager: Michael Schloh von Bennewitz +Distribution: Michael Schloh von Bennewitz +Class: EVAL +Group: Network +License: GPL +Version: 0.13.0 +Release: 20090106 + +# package options +%option with_fsl yes + +# list of sources +Source0: http://www.very-clever.com/download/nongnu/gmediaserver/gmediaserver-%{version}.tar.gz +Source1: rc.gmediaserver +Source2: fsl.gmediaserver +Patch0: gmediaserver.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20040130, gcc +PreReq: OpenPKG, openpkg >= 20040130, gcc +BuildPreReq: libupnp, file, id3lib, taglib +PreReq: libupnp, file, id3lib, taglib +%if "%{with_fsl}" == "yes" +BuildPreReq: fsl >= 1.2.0 +PreReq: fsl >= 1.2.0 +%endif +AutoReq: no +AutoReqProv: no + +%description + GMediaServer is a console based UPnP compatible media server. + It serves audio and video files to those network connected media + players capable of receiving media over UPnP. + +%track + prog gmediaserver = { + version = %{version} + url = http://www.very-clever.com/download/nongnu/gmediaserver/ + regex = gmediaserver-(__VER__)\.tar\.gz + } + +%prep + # unpack sources + %setup -q + %patch -p0 + + # correct build configuration + %{l_shtool} subst \ + -e 's;\(LIBS="-lupnp\) \(\$LIBS"\);\1 -lixml -lthreadutil \2;' \ + -e 's;\(UPNP_LIBS="\$PTHREAD_LIBS -L\$prefixupnp/lib -lupnp\);\1 -lixml -lthreadutil;' \ + -e 's;\(LIBMAGIC=\)\(-lmagic\);\1"\2 -lz";' \ + configure + %{l_shtool} subst \ + -e 's/tm.tm_zone = "GMT";/tzname[0] = "GMT";/' \ + src/webclient.c + +%build + # prepare configuration + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O} -pthread" \ + CPPFLAGS="%{l_cppflags}" \ + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags} -pthread" \ + LIBS="%{l_fsl_libs}" \ + GREP="grep" \ + ./configure \ + --prefix=%{l_prefix} \ + --disable-nls + + # use the internal getopt definitions + cd lib && %{l_make} %{l_mflags} getopt.h iconv_.h + + # build using parallel make + %{l_make} %{l_mflags -O} + +%install + # remove previously existing installations + rm -rf $RPM_BUILD_ROOT + + # run the native installation logic + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + + # create additional installation paths + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/var/gmediaserver/log \ + $RPM_BUILD_ROOT%{l_prefix}/var/gmediaserver/run + + # correct the installation hierarchy + mv $RPM_BUILD_ROOT%{l_prefix}/share/man \ + $RPM_BUILD_ROOT%{l_prefix}/ + mv $RPM_BUILD_ROOT%{l_prefix}/share/info \ + $RPM_BUILD_ROOT%{l_prefix}/ + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share + + # strip binaries laden with symbols + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true + + # install runcommand script + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.gmediaserver} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install OSSP fsl configuration + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE fsl.gmediaserver} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%not %dir %{l_prefix}/etc/fsl' \ + '%config %{l_prefix}/etc/fsl/fsl.gmediaserver' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%pre + # before upgrading package, record runtime status and stop service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} gmediaserver status 2>/dev/null | tee %{l_tmpfile}` + %{l_rc} gmediaserver stop 2>/dev/null + exit 0 + +%post + if [ $1 -eq 2 ]; then + # after upgrading package, restore runtime status + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true + [ ".$gmediaserver_active" = .yes ] && %{l_rc} gmediaserver start + fi + exit 0 + +%preun + # before removing package, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} gmediaserver stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/gmediaserver/log/* >/dev/null 2>&1 || true + exit 0 +