File SOPE.spec of Package SOPE

#
# spec file for package SOPE
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define         sope_name              sope49
%define         sope_soname            4_9
%define         sope_soversion         4.9
%define         sope_version           5.12.2

%define         sbjson_version         2.3.1
%define         sbjson_major_version   2
%define         sope_makeflags         messages=yes
%define         apache_modules_dir     %{_usr}/lib/httpd/modules
%define         apache_conf_dir        %{_sysconfdir}/httpd/conf.d
%define         oracle_support         0

%if 0%{?suse_version} > 1500
%define _lto_cflags %{nil}
%endif

Name:           %{sope_name}
Version:        %{sope_version}
Release:        0
Summary:        SOPE is an extensive set of frameworks
License:        GPL-1.0-or-later
Group:          Development/Libraries/Other
URL:            https://github.com/inverse-inc/sope
#Source:         http://packages.inverse.ca/SOGo/sources/SOPE-%%{sope_version}.tar.gz
Source:         https://packages.sogo.nu/sources/SOPE-%{sope_version}.tar.gz
Patch1:         SOPE-Fix_StringEncoding.patch

BuildRequires:  gnustep-base-devel
BuildRequires:  gnustep-make
BuildRequires:  libxml2-devel
BuildRequires:  mysql-devel
BuildRequires:  openldap2-devel
BuildRequires:  postgresql-devel

%if ( 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150200 )
%if 0%{?suse_version} < 1506
BuildRequires:  pkgconfig(openssl)
%else
BuildRequires:  openssl-devel > 2.0.0
%endif
%else
BuildRequires:  pkgconfig(openssl) < 2.0.0
%endif

%if 0%{?sle_version} == 150200 && 0%{?is_opensuse} 
BuildConflicts:  postgresql14-devel-mini
%endif
%if ( 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150200 )
BuildRequires:  postgresql-server-devel
%endif
BuildRequires:  gcc-objc
%if 0%{?sle_version} == 120200 && 0%{?is_opensuse}
BuildRequires:  libffi6
%endif
%if 0%{?sle_version} == 120100 && 0%{?is_opensuse}
BuildRequires:  libffi6
%endif

%description
SOPE is an extensive set of frameworks which form a complete Web application server environment.
Besides the Apple WebObjects compatible appserver extended with Zope concepts, 
it contains a large set of reusable classes: XML processing (SAX, DOM, XML-RPC),
MIME/IMAP4 processing, LDAP connectivity, RDBMS connectivity, and iCalendar parsing. 

#########################################
%package xml
Summary:        SOPE libraries for XML processing
Group:          Development/Libraries/Other
#AutoReqProv:  off
Provides:       SOPE-xml = %{sope_version}
Obsoletes:      SOPE-xml < %{sope_version}

%description xml
The SOPE libraries for XML processing contain:

  * a SAX2 Implementation for Objective-C
  * an attempt to implement DOM on top of SaxObjC
  * an XML-RPC implementation (without a transport layer)

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

%package xml-devel
Summary:        Development files for the SOPE XML libraries
Group:          Development/Libraries/Other
Requires:       libxml2-devel
Requires:       %{sope_name}-xml = %{version}
#AutoReqProv:  off

%description xml-devel
This package contains the development files of the SOPE XML libraries.

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

#########################################
%package -n libSBJson%{sbjson_major_version}
Version:        %{sbjson_version}
Summary:        JSON framework
Group:          Development/Libraries/Other

%description -n libSBJson%{sbjson_major_version}
The SBJson library is a high performance JSON library in Objective-C.

Project homepage is: http://code.google.com/p/json-framework/

%package -n libSBJson%{sbjson_major_version}-devel
Version:        %{sbjson_version}
Summary:        JSON framework (devel)
Group:          Development/Libraries/Other
Requires:       libSBJson%{sbjson_major_version} = %{version}

%description -n libSBJson%{sbjson_major_version}-devel
The SBJson library is a high performance JSON library in Objective-C.

Those are the files required for development.

Project homepage is: http://code.google.com/p/json-framework/

#########################################
%package core
Summary:        Core libraries of the SOPE application server
Group:          Development/Libraries/Other
Requires:       %{sope_name}-xml
#AutoReqProv:  off
Provides:       SOPE-core = %{sope_version}
Obsoletes:      SOPE-core < %{sope_version}

%description core
The SOPE core libraries contain:

  * various Foundation extensions
  * a java.io like stream and socket library

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

%package core-devel
Summary:        Development files for the SOPE core libraries
Group:          Development/Libraries/Other
Requires:       %{sope_name}-core = %{sope_version}
#AutoReqProv:  off

%description core-devel
This package contains the header files for the SOPE core
libraries,  which are part of the SOPE application server framework.

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

#########################################
%package -n libNGMime%{sope_soname}
Summary:        SOPE libraries for MIME processing
Group:          Development/Libraries/Other
Requires:       %{sope_name}-core
Requires:       %{sope_name}-xml
#AutoReqProv:  off

%description -n libNGMime%{sope_soname}
The SOPE libraries for MIME processing contain:

  * classes for processing MIME entities
  * a full IMAP4 implementation
  * prototypical POP3 and SMTP processor

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

%package -n libNGMime%{sope_soname}-devel
Summary:        Development files for the SOPE MIME libraries
Group:          Development/Libraries/Other
Requires:       libNGMime%{sope_soname} = %{sope_version}
#AutoReqProv:  off

%description -n libNGMime%{sope_soname}-devel
This package contains the development files of the SOPE
MIME libraries.

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

#########################################
%package appserver
Summary:        SOPE application server libraries
Group:          Development/Libraries/Other
Requires:       libNGMime%{sope_soname}
Requires:       %{sope_name}-core
Requires:       %{sope_name}-xml
#AutoReqProv:  off
Provides:       SOPE-appserver = %{sope_version}
Obsoletes:      SOPE-appserver < %{sope_version}

%description appserver
The SOPE application server libraries provide:

  * template rendering engine, lots of dynamic elements
  * HTTP client/server
  * XML-RPC client
  * WebDAV server framework
  * session management
  * scripting extensions for Foundation, JavaScript bridge
  * DOM tree rendering library

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

%package appserver-devel
Summary:        Development files for the SOPE application server libraries
Group:          Development/Libraries/Other
Requires:       %{sope_name}-appserver = %{sope_version}
#AutoReqProv:  off

%description appserver-devel
This package contains the development files for the SOPE application server
libraries.

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

#########################################
%package -n libNGLdap%{sope_soname}
Summary:        SOPE libraries for LDAP access
Group:          Development/Libraries/Other
Requires:       %{sope_name}-core
Requires:       %{sope_name}-xml
#AutoReqProv:  off

%description -n libNGLdap%{sope_soname}
The SOPE libraries for LDAP access contain an Objective-C wrapper for
LDAP directory services.

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

%package -n libNGLdap%{sope_soname}-devel
Summary:        Development files for the SOPE LDAP libraries
Group:          Development/Libraries/Other
Requires:       libNGLdap%{sope_soname}  = %{sope_version}
#AutoReqProv:  off

%description -n libNGLdap%{sope_soname}-devel
This package contains the development files of the SOPE
LDAP libraries.

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

#########################################
%package -n libGDLAccess%{sope_soname}
Summary:        GNUstep database libraries for SOPE
Group:          Development/Libraries/Other
Requires:       %{sope_name}-core
Requires:       %{sope_name}-xml
#AutoReqProv:  off

%description -n libGDLAccess%{sope_soname}
This package contains a fork of the GNUstep database libraries used
by the SOPE application server (excluding GDLContentStore).

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

%package gdl1-postgresql
Summary:        PostgreSQL connector for SOPE's fork of the GNUstep database environment
Group:          Development/Libraries/Other
Requires:       libGDLAccess%{sope_soname}
Provides:       SOPE-gdl1-any-database
#AutoReqProv:  off

%description gdl1-postgresql
This package contains the PostgreSQL connector for SOPE's fork of the
GNUstep database libraries.

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

%if %{oracle_support}
%package gdl1-oracle
Summary:        Oracle connector for SOPE's fork of the GNUstep database environment
Group:          Development/Libraries/Other
Requires:       libGDLAccess%{sope_soname}
Provides:       SOPE-gdl1-any-database
#Requires:    oracle-instantclient-basic
#AutoReqProv:  off

%description gdl1-oracle
This package contains the Oracle connector for SOPE's fork of the
GNUstep database libraries.
%endif

%package gdl1-mysql
Summary:        MySQL connector for SOPE's fork of the GNUstep database environment
Group:          Development/Libraries/Other
Requires:       libGDLAccess%{sope_soname}
Provides:       SOPE-gdl1-any-database
#AutoReqProv:  off

%description gdl1-mysql
This package contains the MySQL connector for SOPE's fork of the
GNUstep database libraries.

#%%package gdl1-sqlite3
#Summary:      SQLite3 connector for SOPE's fork of the GNUstep database environment
#Group:        Development/Libraries/Objective C
#Requires:     %%{sope_name}-gdl1
#AutoReqProv:  off
#
#%%description gdl1-sqlite3
#This package contains the SQLite3 connector for SOPE's fork of the
#GNUstep database libraries.
#
#SOPE is a framework for developing web applications and services. The
#name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

%package -n libGDLAccess%{sope_soname}-devel
Summary:        Development files for the GNUstep database libraries
Group:          Development/Libraries/Other
Requires:       libGDLAccess%{sope_soname} = %{sope_version}
#AutoReqProv:  off

%description -n libGDLAccess%{sope_soname}-devel
This package contains the header files for SOPE's fork of the GNUstep
database libraries.

SOPE is a framework for developing web applications and services. The
name "SOPE" (SKYRiX Object Publishing Environment) is inspired by ZOPE.

#%%package -n mod_ngobjweb
#Summary:      mod_ngobjweb apache module
#Group:        Development/Libraries
#AutoReqProv:  off
#Requires:     %%{ngobjweb_requires}
#
#%%description -n mod_ngobjweb
#Enables apache to handle HTTP requests for the
#OpenGroupware.org application server.

########################################

%prep
%setup -q -n SOPE
%if 0%{?suse_version} > 1500
%patch1 -p1
%endif

# ****************************** build ********************************
%build
case %{_target_platform} in
ppc64-*)
  export CC="gcc -m64";;
*)
  export CC="gcc";;
esac

%ifarch x86_64
  ORACLELIB_PATH="%{_libdir}/oracle/11.2/client64/lib/"
%else
  ORACLELIB_PATH="%{_libdir}/oracle/11.2/client/lib/"
%endif

if [ -f %{_prefix}/lib/rpm/redhat/config.sub ]
then
  cp %{_prefix}/lib/rpm/redhat/{config.sub,config.guess} sope-core/NGStreams/
elif [ -f %{_prefix}/lib/rpm/config.sub ]
then
  cp %{_prefix}/lib/rpm/{config.sub,config.guess} sope-core/NGStreams/
fi

# %%configure isn't used here because this configure is not based on autoconf
./configure \
            --disable-debug \
            --disable-strip \
            --with-gnustep

make %{?_smp_mflags} CC="$CC" %{sope_makeflags}
cd sope-gdl1/MySQL
make %{?_smp_mflags} CC="$CC" LDFLAGS="-L/usr/%{_lib}/mysql" %{sope_makeflags}
%if %{oracle_support}
cd ../Oracle8
make %{?_smp_mflags} CC="$CC" LDFLAGS="-L$ORACLELIB_PATH" %{sope_makeflags}
%endif
#export PATH=$PATH:/usr/sbin
#cd ../../sope-appserver/mod_ngobjweb/
#if [ -x /usr/bin/apr-1-config ]
#then
#  aprconfig=/usr/bin/apr-1-config
#else
#  aprconfig=/usr/bin/apr-config
#fi
#make apr=$aprconfig apxs=/usr/sbin/apxs


# ****************************** install ******************************
%install
make %{sope_makeflags} DESTDIR=%{buildroot} \
			GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \
                       install

cd sope-gdl1/MySQL
make %{sope_makeflags} DESTDIR=%{buildroot} \
                        GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \
                       install
%if %{oracle_support}
cd ../Oracle8
make %{sope_makeflags} DESTDIR=%{buildroot} \
                        GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \
                       install
%endif

rm -f %{buildroot}%{_bindir}/otest
rm -fr %{buildroot}%{_libdir}/GNUstep/GDLAdaptors-%{sope_version}/SQLite3.gdladaptor

# rm -f ${RPM_BUILD_ROOT}/usr/GNUstep/System/Tools/Admin/sope-4.9
# export PATH=$PATH:/usr/sbin
#mkdir -p ${RPM_BUILD_ROOT}%%{apache_modules_dir}
#cp sope-appserver/mod_ngobjweb/mod_ngobjweb.so ${RPM_BUILD_ROOT}%%{apache_modules_dir}/
#
#mkdir -p ${RPM_BUILD_ROOT}%%{apache_conf_dir}
#echo "#Here we load the 'mod_ngobjweb.so' module
#
#LoadModule ngobjweb_module %%{apache_modules_dir}/mod_ngobjweb.so
#" > ${RPM_BUILD_ROOT}%%{apache_conf_dir}/ngobjweb.conf

# rm -f ${RPM_BUILD_ROOT}%%{prefix}/Tools/rss2plist1
# rm -f ${RPM_BUILD_ROOT}%%{prefix}/Tools/rss2plist2
# rm -f ${RPM_BUILD_ROOT}%%{prefix}/Tools/rssparse
# rm -f ${RPM_BUILD_ROOT}%%{prefix}/Tools/testqp
# rm -fr ${RPM_BUILD_ROOT}%%{prefix}/man/

# ****************************** post/-un *****************************
%post appserver
/sbin/ldconfig
%postun appserver
/sbin/ldconfig
%post core
/sbin/ldconfig
%postun core
/sbin/ldconfig
%post xml
/sbin/ldconfig
%postun xml
/sbin/ldconfig
%post -n libGDLAccess%{sope_soname}
/sbin/ldconfig
%postun -n libGDLAccess%{sope_soname}
/sbin/ldconfig
%post -n libNGLdap%{sope_soname}
/sbin/ldconfig
%postun -n libNGLdap%{sope_soname}
/sbin/ldconfig
%post -n libNGMime%{sope_soname}
/sbin/ldconfig
%postun -n libNGMime%{sope_soname}
/sbin/ldconfig
%post -n libSBJson%{sbjson_major_version}
/sbin/ldconfig
%postun -n libSBJson%{sbjson_major_version}
/sbin/ldconfig

# ****************************** clean ********************************

# ****************************** files ********************************
%files xml
%defattr(-,root,root,-)
%{_libdir}/libDOM*.so.%{sope_soversion}*
%{_libdir}/libSaxObjC*.so.%{sope_soversion}*
%{_libdir}/libXmlRpc*.so.%{sope_soversion}*
%{_libdir}/GNUstep/SaxDrivers-%{sope_soversion}

%files xml-devel
%{_includedir}/DOM
%{_includedir}/SaxObjC
%{_includedir}/XmlRpc
%{_libdir}/libDOM*.so
%{_libdir}/libSaxObjC*.so
%{_libdir}/libXmlRpc*.so

%files -n libSBJson%{sbjson_major_version}
%{_libdir}/libSBJson.so.%{sbjson_major_version}*

%files -n libSBJson%{sbjson_major_version}-devel
%{_includedir}/SBJson
%{_libdir}/libSBJson.so

%files core
%{_libdir}/libEOControl*.so.*
%{_libdir}/libNGExtensions*.so.%{sope_soversion}*
%{_libdir}/libNGStreams*.so.%{sope_soversion}*

%files core-devel
%{_includedir}/EOControl
%{_includedir}/NGExtensions
%{_includedir}/NGStreams
%{_libdir}/libEOControl*.so
%{_libdir}/libNGExtensions*.so
%{_libdir}/libNGStreams*.so

%files -n libNGMime%{sope_soname}
%{_libdir}/libNGMime*.so.%{sope_soversion}*

%files -n libNGMime%{sope_soname}-devel
%{_includedir}/NGImap4
%{_includedir}/NGMail
%{_includedir}/NGMime
%{_libdir}/libNGMime*.so

%files appserver
%{_libdir}/libNGObjWeb*.so.%{sope_soversion}*
%{_libdir}/libWEExtensions*.so.%{sope_soversion}*
%{_libdir}/libWOExtensions*.so.%{sope_soversion}*
%dir %{_libdir}/GNUstep/
%dir %{_libdir}/GNUstep/Libraries/
%dir %{_libdir}/GNUstep/Libraries/Resources
%dir %{_libdir}/GNUstep/Libraries/Resources/NGObjWeb
%{_libdir}/GNUstep/Libraries/Resources/NGObjWeb/*
%{_libdir}/GNUstep/SoProducts-%{sope_soversion}
%{_libdir}/GNUstep/WOxElemBuilders-%{sope_soversion}

%files appserver-devel
%{_bindir}/wod
%{_includedir}/NGHttp
%{_includedir}/NGObjWeb
%{_includedir}/WEExtensions
%{_includedir}/WOExtensions
%{_libdir}/libNGObjWeb*.so
%{_libdir}/libWEExtensions*.so
%{_libdir}/libWOExtensions*.so
%if 0%{?el7}
%{_libdir}/GNUstep/Makefiles
%else
%{_datadir}/GNUstep/Makefiles
%endif

%files -n libNGLdap%{sope_soname}
%{_libdir}/libNGLdap*.so.%{sope_soversion}*

%files -n libNGLdap%{sope_soname}-devel
%{_includedir}/NGLdap
%{_libdir}/libNGLdap*.so

%files -n libGDLAccess%{sope_soname}
%{_bindir}/connect-EOAdaptor
%{_bindir}/load-EOAdaptor
%{_libdir}/libGDLAccess*.so.%{sope_soversion}*

%files gdl1-postgresql
%dir %{_libdir}/GNUstep/GDLAdaptors-%{sope_soversion}
%{_libdir}/GNUstep/GDLAdaptors-%{sope_soversion}/PostgreSQL.gdladaptor

%if %{oracle_support}
%files gdl1-oracle
%dir %{_libdir}/GNUstep/GDLAdaptors-%{sope_soversion}
%{_libdir}/GNUstep/GDLAdaptors-%{sope_soversion}/Oracle8.gdladaptor
%endif

%files gdl1-mysql
%dir %{_libdir}/GNUstep/GDLAdaptors-%{sope_soversion}
%{_libdir}/GNUstep/GDLAdaptors-%{sope_soversion}/MySQL.gdladaptor

#%%files gdl1-sqlite3
#%%defattr(-,root,root,-)
#%%{_libdir}/GNUstep/GDLAdaptors-%%{sope_soversion}/SQLite3.gdladaptor

%files -n libGDLAccess%{sope_soname}-devel
%{_includedir}/GDLAccess
%{_libdir}/libGDLAccess*.so

#%%files -n mod_ngobjweb
#%%defattr(-,root,root,-)
#%%{apache_modules_dir}/mod_ngobjweb.so
#%%config %%{apache_conf_dir}/ngobjweb.conf

%changelog
openSUSE Build Service is sponsored by