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