OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael van Elst
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src Date: 27-Dec-2002 11:31:52
Branch: HEAD Handle: 2002122710315100
Added files:
openpkg-src/xerces-c xerces-c-pth.patch
Modified files:
openpkg-src/xerces-c xerces-c.spec
Log:
make thread-support optional
preliminary with_pth (patch supplied for FreeBSD only)
Summary:
Revision Changes Path
1.1 +109 -0 openpkg-src/xerces-c/xerces-c-pth.patch
1.5 +52 -22 openpkg-src/xerces-c/xerces-c.spec
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/xerces-c/xerces-c-pth.patch
============================================================================
$ cvs diff -u -r0 -r1.1 xerces-c-pth.patch
--- /dev/null 2002-12-27 11:31:51.000000000 +0100
+++ xerces-c-pth.patch 2002-12-27 11:31:52.000000000 +0100
@@ -0,0 +1,109 @@
+--- src/xercesc/runConfigure.dist Fri Dec 27 10:26:26 2002
++++ src/xercesc/runConfigure Fri Dec 27 10:56:18 2002
+@@ -189,6 +189,7 @@
+ linkeroptions="$linkeroptions $2"; shift 2;;
+
+ -P)
++ prefix=$2
+ configureoptions="$configureoptions --prefix=$2"; shift 2;;
+
+ -C)
+@@ -301,8 +302,16 @@
+ ;;
+ esac
+ elif test $platform = "freebsd"; then
+- threadingLibs="-pthread -lc_r"
+- threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
++ case $thread in
++ pth)
++ threadingLibs="-L$prefix/lib -lpth -lc_r"
++ threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS -DUSE_PTH
-I$prefix/include"
++ ;;
++ *)
++ threadingLibs="-pthread -lc_r"
++ threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
++ ;;
++ esac
+ elif test $platform = "aix"; then
+ aix_version=`./config.guess`;
+ echo Found host system to be $aix_version
+--- src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp.dist Tue Aug 27
09:24:36 2002
++++ src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp Fri Dec 27
10:35:29 2002
+@@ -86,8 +86,12 @@
+ // ---------------------------------------------------------------------------
+
+ #if !defined(APP_NO_THREADS)
++#ifdef USE_PTH
++#include <pth.h>
++#else
+ #include <pthread.h>
+ #endif
++#endif
+
+ #ifndef _GNU_SOURCE
+ #error _GNU_SOURCE is not defined in your compile settings
+@@ -584,6 +588,14 @@
+
+ void* XMLPlatformUtils::makeMutex()
+ {
++#ifdef USE_PTH
++ pth_mutex_t* mutex = new pth_mutex_t;
++ if (pth_mutex_init(mutex))
++ {
++ ThrowXML(XMLPlatformUtilsException,
++ XMLExcepts::Mutex_CouldNotCreate);
++ }
++#else
+ pthread_mutex_t* mutex = new pthread_mutex_t;
+ pthread_mutexattr_t* attr = new pthread_mutexattr_t;
+ pthread_mutexattr_init(attr);
+@@ -595,20 +607,24 @@
+ }
+ pthread_mutexattr_destroy(attr);
+ delete attr;
++#endif
+ return (void*)(mutex);
+-
+ }
+
+ void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+ {
+ if (mtxHandle != NULL)
+ {
++#ifdef USE_PTH
++ delete (pth_mutex_t*)mtxHandle;
++#else
+ if (pthread_mutex_destroy((pthread_mutex_t*) mtxHandle))
+ {
+ ThrowXML(XMLPlatformUtilsException,
+ XMLExcepts::Mutex_CouldNotDestroy);
+ }
+ delete (pthread_mutex_t*)mtxHandle;
++#endif
+ }
+ }
+
+@@ -617,7 +633,11 @@
+ {
+ if (mtxHandle != NULL)
+ {
++#ifdef USE_PTH
++ if (pth_mutex_acquire((pth_mutex_t*) mtxHandle, FALSE, NULL))
++#else
+ if (pthread_mutex_lock((pthread_mutex_t*) mtxHandle))
++#endif
+ {
+ ThrowXML(XMLPlatformUtilsException,
+ XMLExcepts::Mutex_CouldNotLock);
+@@ -630,7 +650,11 @@
+ {
+ if (mtxHandle != NULL)
+ {
++#ifdef USE_PTH
++ if (pth_mutex_release((pth_mutex_t*) mtxHandle))
++#else
+ if (pthread_mutex_unlock((pthread_mutex_t*) mtxHandle))
++#endif
+ {
+ ThrowXML(XMLPlatformUtilsException,
+ XMLExcepts::Mutex_CouldNotUnlock);
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/xerces-c/xerces-c.spec
============================================================================
$ cvs diff -u -r1.4 -r1.5 xerces-c.spec
--- openpkg-src/xerces-c/xerces-c.spec 9 Dec 2002 16:38:09 -0000 1.4
+++ openpkg-src/xerces-c/xerces-c.spec 27 Dec 2002 10:31:51 -0000 1.5
@@ -26,6 +26,9 @@
%ifndef with_pth
%define with_pth no
%endif
+%ifndef with_threads
+%define with_threads no
+%endif
%define V_xerces 2.1.0
%define Vs_xerces 2_1_0
@@ -40,11 +43,16 @@
Group: Web
License: Apache Software License 1.1
Version: %{V_xerces}
-Release: 20021209
+Release: 20021227
# list of sources
Source0:
http://xml.apache.org/dist/xerces-c/stable/xerces-c-src%{Vs_xerces}.tar.gz
Patch0: xerces-c.patch
+Patch1: xerces-c-pth.patch
+
+%if "%{with_pth}" == "yes"
+%define with_threads yes
+%endif
# build information
Prefix: %{l_prefix}
@@ -62,32 +70,54 @@
Xerces-C++ is a validating XML parser written in a portable subset of C++.
Options:
+ --define 'with_threads' %{with_threads}'
--define 'with_pth %{with_pth}'
%prep
%setup -q -n xerces-c-src%{Vs_xerces}
%patch0 -p0
+%if "%{with_pth}" == "yes"
+ %patch1 -p0
+%endif
%build
rm -rf $RPM_BUILD_ROOT
- ( XERCESCROOT=`pwd` ; \
- export XERCESCROOT ; \
+ ( XERCESCROOT=`pwd` ;
+ export XERCESCROOT ;
%{l_shtool} subst \
-e 's;@l_ar@;%{l_libtool} --mode=link c++ -static -o;' \
obj/Makefile.in
- cd $XERCESCROOT/src/xercesc ; \
- autoconf ; \
- os="freebsd" ; \
- pt="pthread" ; \
- case "%{l_target}" in \
- *-freebsd*) os=freebsd ; pt=pthread ;; \
- *-linux*) os=linux ; pt=pthread ;; \
- *-solaris*) os=solaris ; pt=pthread ;; \
- *-irix*) os=irix ; pt=sproc ;; \
- *-hpux-10.*) os=hp-10 ; pt=none ;; \
- *-hpux-11.*) os=hp-11 ; pt=none ;; \
- *-aix*) os=aix ; pt=pthread ;; \
- esac ; \
+ cd $XERCESCROOT/src/xercesc ;
+ autoconf ;
+%if "%{with_threads}" == "yes"
+ os="freebsd" ;
+ pt="pthread" ;
+ case "%{l_target}" in
+%if "%{with_pth}" == "yes"
+ *-freebsd*) os=freebsd ; pt=pth ;;
+%else
+ *-freebsd*) os=freebsd ; pt=pthread ;;
+%endif
+ *-linux*) os=linux ; pt=pthread ;;
+ *-solaris*) os=solaris ; pt=pthread ;;
+ *-irix*) os=irix ; pt=sproc ;;
+ *-hpux-10.*) os=hp-10 ; pt=none ;;
+ *-hpux-11.*) os=hp-11 ; pt=none ;;
+ *-aix*) os=aix ; pt=pthread ;;
+ esac ;
+%else
+ os="freebsd" ;
+ pt="none" ;
+ case "%{l_target}" in
+ *-freebsd*) os=freebsd ;;
+ *-linux*) os=linux ;;
+ *-solaris*) os=solaris ;;
+ *-irix*) os=irix ;;
+ *-hpux-10.*) os=hp-10 ;;
+ *-hpux-11.*) os=hp-11 ;;
+ *-aix*) os=aix ;;
+ esac ;
+%endif
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
LDFLAGS="%{l_ldflags}" \
@@ -99,15 +129,15 @@
-minmem \
-nsocket \
-tnative \
- -r$pt ; \
- %{l_make} %{l_mflags} \
+ -r$pt
+ %{l_make} %{l_mflags}
)
%install
- ( XERCESCROOT=`pwd` ; \
- export XERCESCROOT ; \
- cd $XERCESCROOT/src/xercesc ; \
- %{l_make} %{l_mflags} install "PREFIX=$RPM_BUILD_ROOT%{l_prefix}" ; \
+ ( XERCESCROOT=`pwd` ;
+ export XERCESCROOT ;
+ cd $XERCESCROOT/src/xercesc ;
+ %{l_make} %{l_mflags} install "PREFIX=$RPM_BUILD_ROOT%{l_prefix}"
)
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]