DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5563>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5563

Add capacity to build Xerces as static library

           Summary: Add capacity to build Xerces as static library
           Product: Xerces-C++
           Version: 1.5.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Build
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


We have customers who require a static build of all the libraries that are
compiled into programs that they distribute internally. They also prefer that
any 3rd-party libraries we require be unchanged from the original distribution. 

In pursuit of these two goals, here is a change to the Xerces distribution that
adds a new option: "-s" (build a static library) to runConfigure; and supports
that change with changes to two Makefile.in, Makefile.incl and configure.in. 

This change is for Unixes only (not quite "All" as above). the changed files are

..../src/configure.in  -- add --enable-static command-line option
..../src/Makefile.in   -- know about build_static: pass it to Makefile.incl
..../src/Makefile.incl -- know about static library extension
..../src/runConfigure  -- add -s (create static library) flag
..../obj/Makefile.in   -- know how to build static lib

I have provided a diff -c file of all the changes, since diff -c is more robust
than plain diff when it works against files that differ slightly from the
originals. I wanted that because I did my work against 1.5.1, not 1.6.0. 

If you wish to contact me, I will be happy to supply the diffs in some other
form.

============ here is a diff -c patchfile =============

diff -c -r xerces-c-src1_5_1/obj/Makefile.in
xerces-c-src1_5_1_WITH_STATIC_BUILD/obj/Makefile.in
*** xerces-c-src1_5_1/obj/Makefile.in   Fri Dec 21 13:35:03 2001
--- xerces-c-src1_5_1_WITH_STATIC_BUILD/obj/Makefile.in Wed Jul 18 07:15:34
2001***************
*** 75,81 ****
  LIBS = @libs@
  OSVER = @osver@
  TRANSCODER = @transcoder@
- BUILD_STATIC = @build_static@
  
  include ../version.incl
  include ../src/Makefile.incl
--- 75,80 ----
***************
*** 92,99 ****
  endif
  THISLIB=${LIB}/${LIBNAME}
  
- ## static versus dynamic builds
- 
  ALL_OBJECTS=$(wildcard $(XML_OBJ_DIR)/*.o)
  
  #######################################################
--- 91,96 ----
***************
*** 109,130 ****
  
  ifeq (${PLATFORM},HPUX)
    ifeq (${CXX},CC)
!     ifneq (${BUILD_STATIC} yes)
!       ######  Start HP-UX  CC compiler specific stuff #######
  
!       DUMMYEXE=$(XML_LIB_DIR)/dummyExe
!       TEMPLATESOBJS=$(wildcard $(TEMPLATESREPOSITORY)/*.o)
  
!       all: $(DUMMYEXE) ${THISLIB}${VER}${SHLIBSUFFIX}
!         ${RM} $(DUMMYEXE)
  
!       $(DUMMYEXE): $(ALL_OBJECTS)
!         ${MAKE_SHARED} -o ${@} $^ $(PLATFORM_LIBRARIES) $(ALLLIBS)
  
-     endif
      ######  End HP-UX  CC compiler specific stuff #######
    else
!     all: ${THISLIB}${VER}${LIB_SUFFIX}
    endif
  else
     ## Start OS390BATCH ##
--- 106,125 ----
  
  ifeq (${PLATFORM},HPUX)
    ifeq (${CXX},CC)
!     ######  Start HP-UX  CC compiler specific stuff #######
  
!     DUMMYEXE=$(XML_LIB_DIR)/dummyExe
!     TEMPLATESOBJS=$(wildcard $(TEMPLATESREPOSITORY)/*.o)
  
!     all: $(DUMMYEXE) ${THISLIB}${VER}${SHLIBSUFFIX}
!       \rm -f $(DUMMYEXE)
  
!     $(DUMMYEXE): $(ALL_OBJECTS)
!       ${MAKE_SHARED} -o ${@} $^ $(PLATFORM_LIBRARIES) $(ALLLIBS)
  
      ######  End HP-UX  CC compiler specific stuff #######
    else
!     all: ${THISLIB}${VER}${SHLIBSUFFIX}
    endif
  else
     ## Start OS390BATCH ##
***************
*** 132,138 ****
  all: ${BATCH_TARGET}
     ## End OS390BATCH ##
    else
! all: ${THISLIB}${VER}${LIB_SUFFIX}
    endif
  endif
  
--- 127,133 ----
  all: ${BATCH_TARGET}
     ## End OS390BATCH ##
    else
! all: ${THISLIB}${VER}${SHLIBSUFFIX}
    endif
  endif
  
***************
*** 148,159 ****
  # link your application.                               #
  ########################################################
  
- ########################################################
- #                                                      #
- # Default behavior: Build a shared library.            #
- #                                                      #
- ########################################################
- 
  ${THISLIB}${VER}${SHLIBSUFFIX}:       $(ALL_OBJECTS)
        @echo Building ${THISLIB}${VER}${SHLIBSUFFIX}
        ${MAKE_SHARED} -o ${@} $^ $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES)
$(EXTRA_LINK_OPTIONS) $(ALLLIBS)
--- 143,148 ----
***************
*** 169,187 ****
  endif
  endif
  
! ## End OS390 and OS390BATCH for shared library build
! 
! ########################################################
! #                                                      #
! # Optionally: Build a static library.                  #
! #                                                      #
! ########################################################
  
- ## No special for OS390 static builds. May be same as this? I don't know.
- ${THISLIB}${VER}.a:   $(ALL_OBJECTS)
-       @echo Building ${THISLIB}${VER}${LIB_SUFFIX}
-       -rm -f $@
-       $(AR) $@ $^ $(EXTRA_LINK_OPTIONS)
  
  clean:
        @echo "Making clean in obj ..."
--- 158,165 ----
  endif
  endif
  
! ## End OS390 and OS390BATCH
  
  
  clean:
        @echo "Making clean in obj ..."
diff -c -r xerces-c-src1_5_1/src/Makefile.in
xerces-c-src1_5_1_WITH_STATIC_BUILD/src/Makefile.in
*** xerces-c-src1_5_1/src/Makefile.in   Fri Dec 21 13:15:43 2001
--- xerces-c-src1_5_1_WITH_STATIC_BUILD/src/Makefile.in Wed Jul 18 07:15:48
2001***************
*** 73,79 ****
  CD=cd
  RM=rm
  CHMODE=chmod
- BUILD_STATIC = @build_static@
  
  include ../version.incl
  include Makefile.incl
--- 73,78 ----
***************
*** 107,113 ****
  
  compile:: Prepare Util Sax Internal Framework Parsers Sax2 Dom IDom
Validators  
! lib:: ${THISLIB}${VER}${LIB_SUFFIX}
  
  Prepare::
        @echo Preparing the directory structure for a build ...
--- 106,112 ----
  
  compile:: Prepare Util Sax Internal Framework Parsers Sax2 Dom IDom
Validators  
! lib:: ${THISLIB}${VER}${SHLIBSUFFIX}
  
  Prepare::
        @echo Preparing the directory structure for a build ...
***************
*** 160,167 ****
        @echo Building "validators"
        ${CD} $(VALIDATORS_DIR) ; $(MAKE) $(MAKE_FLAGS) ; ${CD} ..
  
! ${THISLIB}${VER}${LIB_SUFFIX}:: compile
!       @echo Building ${THISLIB}${VER}${LIB_SUFFIX}
        ${CD} $(XML_OBJ_DIR)/.. ; $(MAKE) -k $(MAKE_FLAGS) ; ${CD} ..
  
  install::
--- 159,166 ----
        @echo Building "validators"
        ${CD} $(VALIDATORS_DIR) ; $(MAKE) $(MAKE_FLAGS) ; ${CD} ..
  
! ${THISLIB}${VER}${SHLIBSUFFIX}:: compile
!       @echo Building ${THISLIB}${VER}${SHLIBSUFFIX}
        ${CD} $(XML_OBJ_DIR)/.. ; $(MAKE) -k $(MAKE_FLAGS) ; ${CD} ..
  
  install::
diff -c -r xerces-c-src1_5_1/src/Makefile.incl
xerces-c-src1_5_1_WITH_STATIC_BUILD/src/Makefile.incl
*** xerces-c-src1_5_1/src/Makefile.incl Fri Dec 21 13:15:49 2001
--- xerces-c-src1_5_1_WITH_STATIC_BUILD/src/Makefile.incl       Wed Jul 18
07:15:48 2001
***************
*** 398,410 ****
        SHLIBSUFFIX=.dylib
  endif
  
- #================ Handle Static versus dynamic library ===========
- 
- ifeq (${BUILD_STATIC},yes)
- LIB_SUFFIX = .a
- else
- LIB_SUFFIX = ${SHLIBSUFFIX}
- endif
  
  ###################### STANDARD TOOLS #############################
  ifeq (${PLATFORM}, OS400)
--- 398,403 ----
diff -c -r xerces-c-src1_5_1/src/configure.in
xerces-c-src1_5_1_WITH_STATIC_BUILD/src/configure.in
*** xerces-c-src1_5_1/src/configure.in  Fri Dec 21 13:15:56 2001
--- xerces-c-src1_5_1_WITH_STATIC_BUILD/src/configure.in        Wed Jul 18
07:15:42 2001
***************
*** 21,28 ****
  dnl Checks for typedefs
  AC_CHECK_TYPE(XMLByte,unsigned char)
  
- AC_ARG_ENABLE(static, [  --enable-static: allow static build of library])
- 
  dnl Determine the host system and Makefile fragment
  AC_CANONICAL_HOST
  
--- 21,26 ----
***************
*** 98,106 ****
  
  threads=${THREADS}
  AC_SUBST(threads)
- 
- build_static=${enable_static}
- AC_SUBST(build_static)
  
  dnl output the Makefiles
  AC_OUTPUT([Makefile \
--- 96,101 ----
diff -c -r xerces-c-src1_5_1/src/runConfigure
xerces-c-src1_5_1_WITH_STATIC_BUILD/src/runConfigure
*** xerces-c-src1_5_1/src/runConfigure  Fri Dec 21 13:16:10 2001
--- xerces-c-src1_5_1_WITH_STATIC_BUILD/src/runConfigure        Wed Jul 18
07:15:48 2001
***************
*** 87,93 ****
      echo "       -n <net accessor> can be 'fileonly', 'libwww', 'socket' or
'native'"
      echo "       -t <transcoder> can be 'icu', 'Iconv400', 'Iconv390' or
'native'"
      echo "       -r <thread option> can be 'pthread' or 'dce' (only used on
aix, HP-11 and solaris) or 'none'"
-     echo "       -s (specifies that you want to build a static library, rather
than dynamic)"
      echo "       -l <extra linker options>"
      echo "       -z <extra compiler options>"
      echo "       -P <install-prefix>"
--- 87,92 ----
***************
*** 119,127 ****
  
  # Get the command line parameters
  if test -x /usr/bin/getopt; then
! set -- `getopt p:c:x:dm:n:st:r:l:z:P:C:h $*`
  else
! set -- `getopts p:c:x:dm:n:st:r:l:z:P:C:h `$*``
  fi
  if [ $? != 0 ]
     then
--- 118,126 ----
  
  # Get the command line parameters
  if test -x /usr/bin/getopt; then
! set -- `getopt p:c:x:dm:n:t:r:l:z:P:C:h $*`
  else
! set -- `getopts p:c:x:dm:n:t:r:l:z:P:C:h `$*``
  fi
  if [ $? != 0 ]
     then
***************
*** 131,137 ****
  
  # Set up the default values for each parameter
  debug=off                # by default debug is off
- staticbuild=off          # be default create dynamic library
  transcoder=native        # by default use native transcoder
  msgloader=inmem          # by default use inmem message loader
  netaccessor=socket       # by default use socket (can do HTTP URL's)
--- 130,135 ----
***************
*** 159,168 ****
     -n)
          netaccessor=$2; shift 2;;
  
-    -s)
-         staticbuild=on; shift 
-         configureoptions="$configureoptions --enable-static" ;;
- 
     -t)
          transcoder=$2; shift 2;;
  
--- 157,162 ----
***************
*** 240,250 ****
      debugflag="-g";
  fi
  
- if test $staticbuild = "off" ; then
-    echo "Will build a dynamic library"
- else
-    echo "Will build a static library"
- fi
  
  #
  # Check for the threading option
--- 234,239 ----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to