Installing libxml2 as an Os400 service program doesn't work anymore

Roberto Bizzozero via xml <[email protected]> Wed, 13 Mar 2019 18:17:18 +0100
Newsgroups gmane.comp.gnome.lib.xml.general
Message-ID <CALkJ+zaHZXrTCxh2LDg6-Vovm-KUk-Y9jN+BuV8Z9=7BpndUyw@mail.gmail.com>
Hello, I tried to install the LIBXML2 and service program on a V7R3M0 IBMi
machine, but it failed to compile it, basically for the 100 char limit of
the source file but also for other problems concerning the OS400 version.

I fixed it in a branch I created, I attach the diff files, if you are
interested.

Also, here it is the issue I've opened on the Gitlab repository:

https://gitlab.gnome.org/GNOME/libxml2/issues/48

Thanks,

Roberto.

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
https://mail.gnome.org/mailman/listinfo/xml
0001-fix-to-make-it-work-in-OS400-version-V7R2M0.patch (application/octet-stream, 3.7 KB)
From 528ad4fba3f51c6b3c83cdf90cbe3960c334c3b4 Mon Sep 17 00:00:00 2001
From: Roberto Bizzozero <[email protected]>
Date: Wed, 13 Mar 2019 11:59:11 +0100
Subject: [PATCH 1/2] fix to make it work in OS400 version >= V7R2M0

---
 Makefile.am              | 2 +-
 include/libxml/threads.h | 3 ++-
 os400/README400          | 6 ++----
 os400/initscript.sh      | 2 +-
 os400/make-src.sh        | 6 +++++-
 trio.c                   | 3 ++-
 6 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 174b9843..4855227b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,7 +40,7 @@ docb_sources =
 endif
 
 if WITH_TRIO_SOURCES
-trio_sources = triostr.c trio.c
+trio_sources = triostr.c trio.c trionan.c
 else
 trio_sources =
 endif
diff --git a/include/libxml/threads.h b/include/libxml/threads.h
index 9969ae7c..96f4b7b7 100644
--- a/include/libxml/threads.h
+++ b/include/libxml/threads.h
@@ -73,7 +73,8 @@ XMLPUBFUN xmlGlobalStatePtr XMLCALL
 			xmlGetGlobalState(void);
 
 #ifdef HAVE_PTHREAD_H
-#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
+#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS)\
+       && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
 #if defined(LIBXML_STATIC_FOR_DLL)
 int XMLCALL
 xmlDllMain(void *hinstDLL, unsigned long fdwReason,
diff --git a/os400/README400 b/os400/README400
index fff923cd..40ec1f3e 100644
--- a/os400/README400
+++ b/os400/README400
@@ -38,10 +38,8 @@ _ Change current directory to ./os400
 _ Edit file iniscript.sh. You may want to change tunable configuration
   parameters, like debug info generation, optimisation level, listing option,
   target library, zlib availability, etc.
-_ Copy any file in the current directory to makelog (i.e.:
-  cp initscript.sh makelog): this is intended to create the makelog file with
-  an ASCII CCSID!
-_ Enter the command "sh make.sh >makelog 2>&1'
+_ Enter the command "touch -C 819 makelog" to create a log file with an ASCII CCSID.
+_ Enter the command "sh make.sh >makelog 2>&1"
 _ Examine the makelog file to check for compilation errors.
 
   Leaving file initscript.sh unchanged, this will produce the following
diff --git a/os400/initscript.sh b/os400/initscript.sh
index 42ce54d5..30d6bf55 100644
--- a/os400/initscript.sh
+++ b/os400/initscript.sh
@@ -50,7 +50,7 @@ setenv TGTCCSID         '500'           # Target CCSID of objects.
 setenv DEBUG            '*ALL'          # Debug level.
 setenv OPTIMIZE         '10'            # Optimisation level.
 setenv OUTPUT           '*NONE'         # Compilation output option.
-setenv TGTRLS           'V6R1M0'        # Target OS release.
+setenv TGTRLS           'V7R1M0'        # Target OS release.
 setenv IFSDIR           '/libxml2'      # Installation IFS directory.
 
 
diff --git a/os400/make-src.sh b/os400/make-src.sh
index 4c03c565..608e46aa 100644
--- a/os400/make-src.sh
+++ b/os400/make-src.sh
@@ -198,7 +198,11 @@ do      SIGNATURE=`echo "${PGMEXP}" | sed 's/^LIBXML2_//'`
         done
         echo ' ENDPGMEXP'
         PGMLVL=PRV
-done            > "${BSF}"
+done            > tempbndsrc
+
+CMD="CPY OBJ('`pwd`/tempbndsrc') TOOBJ('${BSF}')"
+CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
+system "${CMD}"
 
 
 #       Build the service program if needed.
diff --git a/trio.c b/trio.c
index c8b9c84e..c55e58ea 100644
--- a/trio.c
+++ b/trio.c
@@ -89,7 +89,8 @@
 
 #include <assert.h>
 #include <ctype.h>
-#if !defined(TRIO_COMPILER_SUPPORTS_C99)
+/* no need to define isblank if OS400 version is >= V7R2M0 */
+#if !defined(TRIO_COMPILER_SUPPORTS_C99) && !(__OS400_TGTVRM__ >= 720)
 # define isblank(x) (((x)==32) || ((x)==9))
 #endif
 #if defined(TRIO_COMPILER_ANCIENT)
-- 
2.17.1.windows.1
0002-provided-cleaning.patch (application/octet-stream, 2.2 KB)
From 733aeaf8aed92aa5df6f65ff0c252c30cdfe48b4 Mon Sep 17 00:00:00 2001
From: Roberto Bizzozero <[email protected]>
Date: Wed, 13 Mar 2019 14:24:39 +0100
Subject: [PATCH 2/2] provided cleaning

---
 include/libxml/threads.h | 1 +
 os400/make-include.sh    | 1 +
 os400/make-rpg.sh        | 4 ++++
 os400/make.sh            | 1 +
 4 files changed, 7 insertions(+)

diff --git a/include/libxml/threads.h b/include/libxml/threads.h
index 96f4b7b7..1a6fdbc7 100644
--- a/include/libxml/threads.h
+++ b/include/libxml/threads.h
@@ -73,6 +73,7 @@ XMLPUBFUN xmlGlobalStatePtr XMLCALL
 			xmlGetGlobalState(void);
 
 #ifdef HAVE_PTHREAD_H
+/* line has been folded to respect OS400 limit of 100 chars*/
 #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS)\
        && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
 #if defined(LIBXML_STATIC_FOR_DLL)
diff --git a/os400/make-include.sh b/os400/make-include.sh
index 4e5b0589..a4084863 100644
--- a/os400/make-include.sh
+++ b/os400/make-include.sh
@@ -70,6 +70,7 @@ do      CMD="cat \"${HFILE}\""
                 CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DEST}')"
                 CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
                 system "${CMD}"
+                rm -f tmphdrfile
         fi
 
         IFSFILE="${IFSDIR}/include/libxml/`basename \"${HFILE}\" .in`"
diff --git a/os400/make-rpg.sh b/os400/make-rpg.sh
index 664b47bf..feeb9c1e 100644
--- a/os400/make-rpg.sh
+++ b/os400/make-rpg.sh
@@ -96,5 +96,9 @@ do      IFSCMD="cat \"${HFILE}\""
                 CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DB2DEST}')"
                 CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
                 system "${CMD}"
+                rm -f tmphdrfile
         fi
 done
+
+rm -f "tmpsubstfile"[12]
+
diff --git a/os400/make.sh b/os400/make.sh
index 860365eb..50cc9935 100644
--- a/os400/make.sh
+++ b/os400/make.sh
@@ -55,6 +55,7 @@ do      if [ -f "${TEXT}" ]
                         CMD="${CMD} TOCCSID(${TGTCCSID})"
                         CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
                         system "${CMD}"
+                        rm -f "${TOPDIR}/tmpfile"[12]
                 fi
         fi
 done
-- 
2.17.1.windows.1