Blob Blame History Raw
%global WTSRVDIR        /var/spool/wt
%global WTRUNDIR        %{WTSRVDIR}/run

%global WTRUNUSER       apache
%global WTRUNGROUP      apache

Name:           wt
Version:        3.3.0
Release:        2%{?dist}
Summary:        C++ library for developing web applications

Group:          Development/Libraries
# For a breakdown of the licensing, see PACKAGE-LICENSING
License:        GPLv2 and Boost and MIT and (Boost or MIT) and BSD and zlib
URL:            http://www.webtoolkit.eu/wt
# Following archive was made from upstream tarball downloaded from
#  http://citylan.dl.sourceforge.net/project/witty/wt/3.3.0/wt-3.3.0.tar.gz
# by running ./wt-generate-tarball.sh 3.3.0 from tarball's directory
Source0:        %{name}-%{version}-free.tar.xz
Source1:        %{name}-%{version}-PACKAGE-LICENSING
# wt toolkit contains bundled non-free library (IBPP) that we cannot ship.
# Therefore we use this script to remove its code before shipping it.
# Download the upstream tarball and invoke this script while in the
# tarball's directory:
#   sh wt-generate-tarball.sh UPSTREAM_VERSION
Source2:        wt-generate-tarball.sh

BuildRequires:  cmake >= 2.6 boost-devel%{_isa} >= 1.41 openssl-devel
BuildRequires:  GraphicsMagick-devel pango-devel sqlite-devel postgresql-devel
BuildRequires:  libharu-devel fcgi-devel zlib-devel qt-devel

%description
Web C++ library with widget oriented API that uses well-tested patterns of
desktop GUI development tailored to the web. To the developer, it offers
abstraction of web-specific implementation details, including client-server
protocols, event handling, graphics support, graceful degradation (or
progressive enhancement), and URL handling.

%package        dbo
Summary:        Wt::Dbo ORM library and Sqlite3 back-end
Group:          Development/Libraries

%description    dbo
This package contains the Wt::Dbo Object-Relational Mapping library
and Sqlite3 back-end of it.

%package        dbo-postgres
Summary:        PostgreSQL back-end for the Wt::Dbo ORM library
Group:          Development/Libraries
Requires:       %{name}-dbo%{?_isa} = %{version}-%{release}

%description    dbo-postgres
This package contains the PostgresSQL back-end for the Wt::Dbo ORM library.
 
%package        devel
Summary:        Libraries and header files for witty web development
Group:          Development/Libraries
Requires:       %{name}%{?_isa}              = %{version}-%{release}
Requires:       %{name}-dbo%{?_isa}          = %{version}-%{release}
Requires:       %{name}-dbo-postgres%{?_isa} = %{version}-%{release}
Requires:       cmake

%description    devel
This package contains the files necessary to develop
applications using the Wt toolkit and the Wt::Dbo ORM library.

%package        examples
Summary:        Examples for Wt
Group:          Development/Libraries
License:        GPLv2 and MIT
Requires:       %{name}%{?_isa}     = %{version}-%{release}
Requires:       %{name}-dbo%{?_isa} = %{version}-%{release}

%description    examples
This package contains programming examples distributed with official Wt
release.

%package        doc
Summary:        Documents for the Wt toolkit
Group:          Documentation
BuildArch:      noarch

%description    doc
This package contains the documents for Wt API and examples.

%prep
%setup -q -n %{name}-%{version}
for d in src resources examples; do
    find $d -type f \( -iregex '.*\.\([hc]\|js\|css\)' -o -executable \) | \
        xargs -r chmod -v 0644
done
find examples -type f -name .htaccess | while read f; do
    mv -v $f `dirname $f`/htaccess
done
# conversion to UTF-8
convdir=`mktemp -d`
for f in examples/style/CornerImage.h; do
    tmpf=${convdir}/`basename $f`
    iconv -f iso-8859-2 -t UTF-8 $f >$tmpf
    mv $tmpf $f
done
rmdir $convdir

%build
mkdir wt-build
cd wt-build
## wtdbofirebird library bundles IBPP c++ client library for firebird
## that is licensed under IBPP License, which is marked as Non-Free
## by Red Hat Legal
## let's not package it, until licensing issues are solved
%cmake .. \
    -DCONNECTOR_HTTP=ON \
    -DCONNECTOR_FCGI=ON \
    -DUSE_SYSTEM_SQLITE3=ON \
    -DWEBUSER="%{WTRUNUSER}" \
    -DWEBGROUP="%{WTRUNGROUP}" \
    -DRUNDIR="%{WTRUNDIR}" \
    -DINSTALL_EXAMPLES=ON \
    -DENABLE_FIREBIRD=OFF \
    -DEXAMPLES_DESTINATION=%{_lib}/Wt/examples
make %{?_smp_mflags}

%install
pushd wt-build
make install DESTDIR=$RPM_BUILD_ROOT
install -v -m 0755 -d ${RPM_BUILD_ROOT}/%{_sysconfdir}/%{name}
cp -v wt_config.xml ${RPM_BUILD_ROOT}/%{_sysconfdir}/%{name}

# makes an absolute symlink to resources directory
make_rsc_link() {
    ln -vs "%{_datadir}/Wt/resources" \
        "${RPM_BUILD_ROOT}%{_libdir}/Wt/examples/$1"
}

# installation of examples
pushd examples
for d in `find . -maxdepth 1 -mindepth 1 -type d | \
        grep -v '^\(CMakeFiles\|feature\)$'`; do
    # create a symlink for each example pointing on resources dir
    make_rsc_link $d
done
for d in `find feature -maxdepth 1 -mindepth 1 -type d | grep -v 'CMakeFiles'`;
do  # create a symlink for each feature example pointing on resources dir
    make_rsc_link $d
done
popd # examples
popd # wt-build

# installation of documentation
for d in %{name} %{name}-dbo %{name}-doc; do
    install -v -m 0755 -d ${RPM_BUILD_ROOT}%{_defaultdocdir}/$d-%{version}/
    cp -v LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/$d-%{version}/
    install -vm 644  %{SOURCE1} \
    ${RPM_BUILD_ROOT}%{_defaultdocdir}/$d-%{version}/PACKAGE-LICENSING
done
cp -vr README.md ReleaseNotes.html Changelog \
    ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-%{version}/
cp -vr INSTALL*.html doc/* ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-doc-%{version}/

pushd ${RPM_BUILD_ROOT}
mkdir -vp .%{WTSRVDIR}
mkdir -vp .%{WTRUNDIR}
install -v -m 0755 -d .%{_datadir}/cmake/Modules
mv -v .%{_prefix}/cmake/*.cmake .%{_datadir}/cmake/Modules

# cleanup
rm -rfv ${_prefix}/cmake
for d in examples reference; do
    rm -v .%{_defaultdocdir}/%{name}-doc-%{version}/$d/html/installdox
done
rm -v .%{_defaultdocdir}/%{name}-doc-%{version}/main
find .%{_libdir}/Wt/examples -regex '.*/\(CMakeFiles\|.*\.cmake\|Doxygen\)' | \
    xargs rm -rfv
# these scripts were used to generate pictures
find .%{_datadir}/Wt/resources -name 'generate.sh' | xargs rm -v
popd

%post                -p /sbin/ldconfig
%postun              -p /sbin/ldconfig
%post   dbo          -p /sbin/ldconfig
%postun dbo          -p /sbin/ldconfig
%post   dbo-postgres -p /sbin/ldconfig
%postun dbo-postgres -p /sbin/ldconfig

%files
%config(noreplace) %{_sysconfdir}/%{name}/wt_config.xml
%{_libdir}/libwt.so.*
%{_libdir}/libwtfcgi.so.*
%{_libdir}/libwthttp.so.*
%{_libdir}/libwttest.so.*
%dir %{_defaultdocdir}/%{name}-%{version}
%doc %{_defaultdocdir}/%{name}-%{version}/README.md
%doc %{_defaultdocdir}/%{name}-%{version}/LICENSE
%doc %{_defaultdocdir}/%{name}-%{version}/ReleaseNotes.html
%doc %{_defaultdocdir}/%{name}-%{version}/Changelog
%doc %{_defaultdocdir}/%{name}-%{version}/PACKAGE-LICENSING
%dir %{_datadir}/Wt
%dir %{_datadir}/Wt/resources
%{_datadir}/Wt/resources/*
%dir %{WTSRVDIR}
%dir %{WTRUNDIR}

%files dbo
%dir %{_defaultdocdir}/%{name}-dbo-%{version}
%doc %{_defaultdocdir}/%{name}-dbo-%{version}/LICENSE
%doc %{_defaultdocdir}/%{name}-dbo-%{version}/PACKAGE-LICENSING
%{_libdir}/libwtdbo.so.*
%{_libdir}/libwtdbosqlite3.so.*

%files dbo-postgres
%{_libdir}/libwtdbopostgres.so.*

%files devel
# header files
%dir %{_includedir}/Wt
%{_includedir}/Wt/*
%{_libdir}/*.so
%{_datadir}/cmake/Modules/*.cmake

%files examples
%dir %{_libdir}/Wt
%dir %{_libdir}/Wt/examples
%{_libdir}/Wt/examples/*

%files doc
%dir %{_defaultdocdir}/%{name}-doc-%{version}
%doc %{_defaultdocdir}/%{name}-doc-%{version}/LICENSE
%doc %{_defaultdocdir}/%{name}-doc-%{version}/PACKAGE-LICENSING
%{_defaultdocdir}/%{name}-doc-%{version}/*.html
%dir %{_defaultdocdir}/%{name}-doc-%{version}/images
%dir %{_defaultdocdir}/%{name}-doc-%{version}/reference
%dir %{_defaultdocdir}/%{name}-doc-%{version}/tutorial
%dir %{_defaultdocdir}/%{name}-doc-%{version}/examples
%{_defaultdocdir}/%{name}-doc-%{version}/images/*
%{_defaultdocdir}/%{name}-doc-%{version}/reference/*
%{_defaultdocdir}/%{name}-doc-%{version}/tutorial/*
%{_defaultdocdir}/%{name}-doc-%{version}/examples/*

%changelog
* Wed Jun 26 2013 Michal Minar <miminar@redhat.com> 3.3.0-2
- Using LZMA2 compression for source archive.

* Thu Jun 20 2013 Michal Minar <miminar@redhat.com> 3.3.0-1
- Version 3.3.0

* Sat Feb 09 2013 Denis Arnaud <denis.arnaud_fedora@m4x.org> - 3.2.3-2
- Rebuild for Boost-1.53.0

* Wed Dec 26 2012 Michal Minar <miminar@redhat.com> - 3.2.3-1
- Version 3.2.3

* Mon Dec 24 2012 Rex Dieter <rdieter@fedoraproject.org> 3.2.2-7.p1
- rebuild (GraphicsMagick)

* Thu Sep 13 2012 Michal Minar <miminar@redhat.com> - 3.2.2-6.p1
- fixed changelog line

* Wed Sep 12 2012 Michal Minar <miminar@redhat.com> - 3.2.2-5.p1
- Added wt-generate-tarball.sh script for source tarball generation
  from upstream tarball, in order to remove the IBPP non-free library
  from source.

* Mon Sep 03 2012 Michal Minar <miminar@redhat.com> - 3.2.2-4.p1
- separated doc dirs for independent subpackages -dbo and -doc

* Fri Aug 24 2012 Michal Minar <miminar@redhat.com> - 3.2.2-3.p1
- Own examples directory.
- Include a copy of license in wt-doc.
- Added License tag for wt-examples.

* Fri Aug 24 2012 Michal Minar <miminar@redhat.com> - 3.2.2-2.p1
- Not packaging back-end due to licensing issues.

* Tue Aug 21 2012 Michal Minar <miminar@redhat.com> - 3.2.2-1.p1
- Initial Package for FE.