lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 70a973c 08/15: Build xmlwrapp as external lib


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 70a973c 08/15: Build xmlwrapp as external library, similarly to libxml2
Date: Fri, 9 Oct 2020 12:05:27 -0400 (EDT)

branch: master
commit 70a973c81fc720618a24b76c266ac88d388fb372
Author: Vadim Zeitlin <vadim@tt-solutions.com>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Build xmlwrapp as external library, similarly to libxml2
    
    Instead of embedding xmlwrapp sources in xml_xslt_wrapp.cpp, build and
    install this library similarly to the other XML-related libraries.
    
    Rename install_libxml2_libxslt.sh to install_xml_libraries.sh, as
    listing all three library names in it would make it too long, while
    listing the first two, but not the third one would be inconsistent.
---
 .github/workflows/ci.yml                           |  4 +-
 install_msw.sh                                     |  2 +-
 ..._libxml2_libxslt.sh => install_xml_libraries.sh | 39 +++++++++++++++++-
 msw_common.make                                    |  6 +--
 objects.make                                       | 18 +--------
 posix_fhs.make                                     |  8 +---
 third_party/xmlwrapp                               |  2 +-
 workhorse.make                                     |  4 +-
 xml_xslt_wrapp.cpp                                 | 46 ----------------------
 9 files changed, 49 insertions(+), 80 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 859012b..d1299c2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -77,11 +77,11 @@ jobs:
             /opt/lmi/local/${{ env.LMI_COMPILER }}_${{ env.LMI_TRIPLET }}
             /opt/lmi/local/include
             /opt/lmi/local/share
-          key: build-${{ env.LMI_COMPILER }}-${{ env.gcc_version }}-${{ 
env.LMI_TRIPLET }}-${{ hashFiles('install_libxml2_libxslt.sh', 'install_wx.sh', 
'install_wxpdfdoc.sh') }}-${{ env.xml2_sha1 }}-${{ env.xslt_sha1 }}
+          key: build-${{ env.LMI_COMPILER }}-${{ env.gcc_version }}-${{ 
env.LMI_TRIPLET }}-${{ hashFiles('install_xml_libraries.sh', 'install_wx.sh', 
'install_wxpdfdoc.sh') }}-${{ env.xml2_sha1 }}-${{ env.xslt_sha1 }}
 
       - name: Build libxml2
         if: steps.cache-local.outputs.cache-hit != 'true'
-        run: ./install_libxml2_libxslt.sh
+        run: ./install_xml_libraries.sh
 
       - name: Build wxWidgets
         if: steps.cache-local.outputs.cache-hit != 'true'
diff --git a/install_msw.sh b/install_msw.sh
index 3084474..7be7176 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -270,7 +270,7 @@ do
       printf 'No MinGW compiler for this triplet.\n'
     fi
 
-    ./install_libxml2_libxslt.sh
+    ./install_xml_libraries.sh
 
     ./install_wx.sh
     ./install_wxpdfdoc.sh
diff --git a/install_libxml2_libxslt.sh b/install_xml_libraries.sh
similarity index 85%
rename from install_libxml2_libxslt.sh
rename to install_xml_libraries.sh
index dcb2746..1b61e3f 100755
--- a/install_libxml2_libxslt.sh
+++ b/install_xml_libraries.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Install libxml2 and libxslt with options suitable for lmi.
+# Install libxml2, libxslt and xmlwrapp with options suitable for lmi.
 #
 # Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 
2016, 2017, 2018, 2019, 2020 Gregory W. Chicares.
 #
@@ -93,7 +93,7 @@ xmlsoft_common_cflags=$(echo '
   -Wno-unused-variable
 ' | tr '\n' ' ' | tr -s ' ' )
 
-xmlsoft_common_options="
+third_party_libraries_common_options="
   --prefix=$prefix
   --exec-prefix=$exec_prefix
   --build=$build_type
@@ -101,6 +101,10 @@ xmlsoft_common_options="
   --disable-dependency-tracking
   --disable-static
   --enable-shared
+"
+
+xmlsoft_common_options="
+  $third_party_libraries_common_options
   --with-debug
   --without-python
 "
@@ -131,6 +135,13 @@ libxslt_options="
   --without-crypto
 "
 
+xmlwrapp_options="
+  $third_party_libraries_common_options
+  --disable-docs
+  --disable-examples
+  --disable-tests
+"
+
 # Actually build ##############################################################
 
 # Nonchalantly remove pkgconfig and cmake subdirectories, even though
@@ -141,13 +152,17 @@ libxslt_options="
 # each package's makefile.
 if [ "$xml_skip_clean" != 1 ]; then
     rm --force --recursive "$exec_prefix"/bin/*xml2*
+    rm --force --recursive "$exec_prefix"/bin/*xmlwrapp*
     rm --force --recursive "$exec_prefix"/bin/*xslt*
     rm --force --recursive "$exec_prefix"/bin/xmllint*
     rm --force --recursive "$exec_prefix"/bin/xmlcatalog*
     rm --force --recursive "$exec_prefix"/include/libxml2
+    rm --force --recursive "$exec_prefix"/include/libxmlwrapp
     rm --force --recursive "$exec_prefix"/include/libxslt
+    rm --force --recursive "$exec_prefix"/include/libxsltwrapp
     rm --force --recursive "$exec_prefix"/include/libexslt
     rm --force --recursive "$exec_prefix"/lib/*xml2*
+    rm --force --recursive "$exec_prefix"/lib/*xmlwrapp*
     rm --force --recursive "$exec_prefix"/lib/*xslt*
     rm --force --recursive "$exec_prefix"/lib/cmake
     rm --force --recursive "$exec_prefix"/lib/pkgconfig
@@ -172,6 +187,24 @@ for lib in libxml2 libxslt; do
     $MAKE install
 done
 
+# Building xmlwrapp is similar, but sufficiently different to not try to fit it
+# into the loop above, but reuse the same structure for it just to emphasize
+# the similarity.
+for lib in xmlwrapp; do
+    libdir="$srcdir/third_party/$lib"
+    if [ ! -x "$libdir/configure" ]; then
+        cd "$libdir"
+        ./bootstrap
+    fi
+    mkdir --parents "$build_dir/$lib"
+    cd "$build_dir/$lib"
+    # shellcheck disable=SC2046
+    "$libdir/configure" \
+        PKG_CONFIG_LIBDIR=$exec_prefix/lib/pkgconfig \
+        $xmlwrapp_options
+    $MAKE install
+done
+
 # autotools: 'make install' doesn't respect group permissions--see:
 #   https://lists.gnu.org/archive/html/automake/2019-01/msg00000.html
 # After the 'chmod' calls, the 'find' command should find nothing.
@@ -185,6 +218,8 @@ chmod -R g=u "$build_dir"
 chmod -R g=u "$prefix"/include/libexslt
 chmod -R g=u "$prefix"/include/libxml2
 chmod -R g=u "$prefix"/include/libxslt
+chmod -R g=u "$prefix"/include/xmlwrapp
+chmod -R g=u "$prefix"/include/xsltwrapp
 chmod -R g=u "$prefix"/share/doc/libxml2-*
 chmod -R g=u "$prefix"/share/doc/libxslt-*
 chmod -R g=u "$prefix"/share/gtk-doc/html/libxml2
diff --git a/msw_common.make b/msw_common.make
index c7f353c..4c19d1a 100644
--- a/msw_common.make
+++ b/msw_common.make
@@ -41,7 +41,9 @@ platform_defines := \
 
 platform_gui_ldflags := -mwindows
 
-platform_gnome_xml_libraries := \
+platform_xml_libraries := \
+  -lxsltwrapp \
+  -lxmlwrapp \
   -lexslt \
   -lxslt \
   -lxml2 \
@@ -58,8 +60,6 @@ platform_boost_libraries :=
 
 platform_cgicc_libraries :=
 
-platform_xmlwrapp_libraries :=
-
 
################################################################################
 
 # HTML server's cgi-bin directory. Not used yet. Eventually, an
diff --git a/objects.make b/objects.make
index f8f0839..3b95865 100644
--- a/objects.make
+++ b/objects.make
@@ -65,7 +65,7 @@ boost_regex_objects := \
 # run correctly.
 
 ifneq (,$(USE_SO_ATTRIBUTES))
-  duplicated_objects = $(boost_filesystem_objects) $(xmlwrapp_objects)
+  duplicated_objects = $(boost_filesystem_objects)
 endif
 
 # GNU cgicc.
@@ -109,11 +109,7 @@ cgicc_3_1_4_objects = \
   HTTPHeaders.o \
   MStreamable.o \
 
-# xmlwrapp and xsltwrapp.
-
-xmlwrapp_objects := xml_xslt_wrapp.o
-
-# For systems that already have boost, cgicc, and xmlwrapp libraries
+# For systems that already have boost and cgicc libraries
 # installed, define 'HAVE_THIRD_PARTY_LIBRARIES' to use them instead
 # of using the workarounds above.
 #
@@ -125,7 +121,6 @@ ifdef HAVE_THIRD_PARTY_LIBRARIES
   boost_filesystem_objects :=
   boost_regex_objects :=
   cgicc_objects :=
-  xmlwrapp_objects :=
 endif
 
 
################################################################################
@@ -176,7 +171,6 @@ cli_objects := \
 
 common_common_objects := \
   $(boost_filesystem_objects) \
-  $(xmlwrapp_objects) \
   actuarial_table.o \
   alert.o \
   calendar_date.o \
@@ -505,7 +499,6 @@ account_value_test$(EXEEXT): \
 actuarial_table_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
-  $(xmlwrapp_objects) \
   actuarial_table.o \
   actuarial_table_test.o \
   cso_table.o \
@@ -585,7 +578,6 @@ commutation_functions_test$(EXEEXT): \
 configurable_settings_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
-  $(xmlwrapp_objects) \
   calendar_date.o \
   configurable_settings.o \
   configurable_settings_test.o \
@@ -701,7 +693,6 @@ input_sequence_test$(EXEEXT): \
 input_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
-  $(xmlwrapp_objects) \
   calendar_date.o \
   ce_product_name.o \
   configurable_settings.o \
@@ -751,7 +742,6 @@ interpolate_string_test$(EXEEXT): \
 irc7702a_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
-  $(xmlwrapp_objects) \
   calendar_date.o \
   global_settings.o \
   ihs_irc7702a.o \
@@ -771,7 +761,6 @@ istream_to_string_test$(EXEEXT): \
 ledger_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
-  $(xmlwrapp_objects) \
   calendar_date.o \
   configurable_settings.o \
   crc32.o \
@@ -890,7 +879,6 @@ path_utility_test$(EXEEXT): \
 premium_tax_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
-  $(xmlwrapp_objects) \
   calendar_date.o \
   data_directory.o \
   database.o \
@@ -928,7 +916,6 @@ print_matrix_test$(EXEEXT): \
 product_file_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
-  $(xmlwrapp_objects) \
   calendar_date.o \
   data_directory.o \
   database.o \
@@ -1076,7 +1063,6 @@ wx_new_test$(EXEEXT): \
 xml_serialize_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
-  $(xmlwrapp_objects) \
   calendar_date.o \
   global_settings.o \
   miscellany.o \
diff --git a/posix_fhs.make b/posix_fhs.make
index 517b967..5decdab 100644
--- a/posix_fhs.make
+++ b/posix_fhs.make
@@ -31,19 +31,15 @@ PERFORM :=
 platform_boost_libraries := \
   -lboost_filesystem-gcc \
 
-platform_xmlwrapp_libraries := \
-  -lxsltwrapp \
-  -lxmlwrapp \
-
 # The libraries referenced above may be used if desired, but are not
 # necessary because lmi compiles their source code to object files.
 platform_boost_libraries :=
-platform_xmlwrapp_libraries :=
 
 # '-lexslt'--see:
 #   http://mail.gnome.org/archives/xslt/2001-October/msg00133.html
 
-platform_gnome_xml_libraries := \
+platform_xml_libraries := \
+  $(shell xmlwrapp-config --libs) \
   -lexslt \
   $(shell xslt-config --libs) \
   $(shell xml2-config --libs) \
diff --git a/third_party/xmlwrapp b/third_party/xmlwrapp
index 19a317c..07a55f5 160000
--- a/third_party/xmlwrapp
+++ b/third_party/xmlwrapp
@@ -1 +1 @@
-Subproject commit 19a317ce7a123fdb40d7a91e2e99f368492c7b23
+Subproject commit 07a55f536170f94bc676b6dfb4179f149d65ab59
diff --git a/workhorse.make b/workhorse.make
index a35141e..28da707 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -309,7 +309,6 @@ lmi_include_directories := \
 sys_include_directories := \
   $(compiler_include_directory) \
   $(wx_include_paths) \
-  $(srcdir)/third_party/xmlwrapp/include \
   /opt/lmi/third_party/include \
   $(localincludedir) \
   $(localincludedir)/libxml2 \
@@ -742,8 +741,7 @@ $(product_file_sources): tutelary_flag += 
$(product_file_flags)
 
 REQUIRED_LIBS := \
   $(platform_boost_libraries) \
-  $(platform_xmlwrapp_libraries) \
-  $(platform_gnome_xml_libraries) \
+  $(platform_xml_libraries) \
 
 wx_ldflags = \
   $(wx_library_paths) $(wx_libraries) \
diff --git a/xml_xslt_wrapp.cpp b/xml_xslt_wrapp.cpp
deleted file mode 100644
index 0cf16e3..0000000
--- a/xml_xslt_wrapp.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Include xmlwrapp and xsltwrapp sources.
-//
-// Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 
2019, 2020 Gregory W. Chicares.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as
-// published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-//
-// https://savannah.nongnu.org/projects/lmi
-// email: <gchicares@sbcglobal.net>
-// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
-
-#include "pchfile.hpp"
-
-#if defined __GNUC__ && !defined __clang__
-#   pragma GCC diagnostic ignored "-Wsuggest-override"
-#   pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-#endif // defined __GNUC__ && !defined __clang__
-
-#include "third_party/xmlwrapp/src/libxml/ait_impl.cxx"
-#include "third_party/xmlwrapp/src/libxml/attributes.cxx"
-#include "third_party/xmlwrapp/src/libxml/document.cxx"
-#include "third_party/xmlwrapp/src/libxml/dtd_impl.cxx"
-#include "third_party/xmlwrapp/src/libxml/errors.cxx"
-#include "third_party/xmlwrapp/src/libxml/event_parser.cxx"
-#include "third_party/xmlwrapp/src/libxml/init.cxx"
-#include "third_party/xmlwrapp/src/libxml/node.cxx"
-#include "third_party/xmlwrapp/src/libxml/node_iterator.cxx"
-#include "third_party/xmlwrapp/src/libxml/node_manip.cxx"
-#include "third_party/xmlwrapp/src/libxml/nodes_view.cxx"
-#include "third_party/xmlwrapp/src/libxml/relaxng.cxx"
-#include "third_party/xmlwrapp/src/libxml/schema.cxx"
-#include "third_party/xmlwrapp/src/libxml/tree_parser.cxx"
-#include "third_party/xmlwrapp/src/libxml/utility.cxx"
-#include "third_party/xmlwrapp/src/libxml/xpath.cxx"
-#include "third_party/xmlwrapp/src/libxslt/init.cxx"
-#include "third_party/xmlwrapp/src/libxslt/stylesheet.cxx"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]