From fabcf8a2ce8aa705f3939e4b98d8260778d99abb Mon Sep 17 00:00:00 2001
From: Andreas Wacknitz <A.Wacknitz@gmx.de>
Date: Wed, 01 Nov 2023 22:45:46 +0100
Subject: [PATCH] swi-prolog: fix libjpeg8-turbo usage

---
 components/runtime/swi-prolog/Makefile                      |   15 ++-
 components/runtime/swi-prolog/test/results-all.master       |  166 +++++++++++++++++++---------------------
 components/runtime/swi-prolog/pkg5                          |    3 
 components/runtime/swi-prolog/manifests/sample-manifest.p5m |    2 
 4 files changed, 90 insertions(+), 96 deletions(-)

diff --git a/components/runtime/swi-prolog/Makefile b/components/runtime/swi-prolog/Makefile
index 7ba7280..7e7a816 100644
--- a/components/runtime/swi-prolog/Makefile
+++ b/components/runtime/swi-prolog/Makefile
@@ -14,11 +14,12 @@
 
 BUILD_STYLE= cmake
 OPENSSL_VERSION= 3.1
+USE_DEFAULT_TEST_TRANSFORMS= yes
 include ../../../make-rules/shared-macros.mk
 
 COMPONENT_NAME=		swipl
 COMPONENT_VERSION=	9.0.4
-COMPONENT_REVISION=	1
+COMPONENT_REVISION=	2
 COMPONENT_SUMMARY=	Robust, mature, free. Prolog for the real world.
 COMPONENT_PROJECT_URL= https://www.swi-prolog.org
 COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
@@ -31,6 +32,11 @@
 COMPONENT_LICENSE_FILE=	LICENSE
 
 include $(WS_MAKE_RULES)/common.mk
+
+# build with the distribution preferred libjpeg implementation
+CFLAGS   += $(JPEG_CPPFLAGS) $(JPEG_CFLAGS)
+CXXFLAGS += $(JPEG_CPPFLAGS) $(JPEG_CXXFLAGS)
+LDFLAGS  += $(JPEG_LDFLAGS)
 
 JAVA_HOME=/usr/jdk/openjdk1.8.0
 PCRE_INCLUDE=/usr/include/pcre
@@ -56,18 +62,15 @@
 CMAKE_OPTIONS += -DJAVA_INCLUDE_PATH=$(JAVA_HOME)/include
 CMAKE_OPTIONS += -DJAVA_AWT_LIBRARY=/usr/java/jre/lib/amd64/libjawt.so
 CMAKE_OPTIONS += -DJAVA_JVM_LIBRARY=/usr/java/jre/lib/amd64/server/libjvm.so
+CMAKE_OPTIONS += -DJPEG_LIBRARY=$(JPEG_LIBDIR)/libjpeg.so
 
 CMAKE_ENV += CPPFLAGS="$(CPPFLAGS)"
-
-COMPONENT_TEST_TRANSFORMS += \
-	'-e "s/\s\s*[0-9][0-9]*\.[0-9][0-9]* sec/ SEC sec/"'
 
 # Auto-generated dependencies
 REQUIRED_PACKAGES += $(GCC_RUNTIME_PKG)
 REQUIRED_PACKAGES += $(GXX_RUNTIME_PKG)
+REQUIRED_PACKAGES += $(JPEG_IMPLEM_PKG)
 REQUIRED_PACKAGES += database/berkeleydb-5
-REQUIRED_PACKAGES += image/library/libjpeg6
-REQUIRED_PACKAGES += image/library/libjpeg6-ijg
 REQUIRED_PACKAGES += library/gmp
 REQUIRED_PACKAGES += library/libarchive
 REQUIRED_PACKAGES += library/libedit
diff --git a/components/runtime/swi-prolog/manifests/sample-manifest.p5m b/components/runtime/swi-prolog/manifests/sample-manifest.p5m
index 6e1f6c8..bb03f82 100644
--- a/components/runtime/swi-prolog/manifests/sample-manifest.p5m
+++ b/components/runtime/swi-prolog/manifests/sample-manifest.p5m
@@ -10,7 +10,7 @@
 #
 
 #
-# Copyright 2022 <contributor>
+# Copyright 2023 <contributor>
 #
 
 set name=pkg.fmri value=pkg:/$(COMPONENT_FMRI)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
diff --git a/components/runtime/swi-prolog/pkg5 b/components/runtime/swi-prolog/pkg5
index a405451..d2d2ec3 100644
--- a/components/runtime/swi-prolog/pkg5
+++ b/components/runtime/swi-prolog/pkg5
@@ -1,8 +1,7 @@
 {
     "dependencies": [
         "database/berkeleydb-5",
-        "image/library/libjpeg6",
-        "image/library/libjpeg6-ijg",
+        "image/library/libjpeg8-turbo",
         "library/gmp",
         "library/libarchive",
         "library/libedit",
diff --git a/components/runtime/swi-prolog/test/results-all.master b/components/runtime/swi-prolog/test/results-all.master
index 4213d5e..fc34bef 100644
--- a/components/runtime/swi-prolog/test/results-all.master
+++ b/components/runtime/swi-prolog/test/results-all.master
@@ -1,169 +1,161 @@
-Test project $(@D)
       Start  1: swipl:abi-version
- 1/79 Test  #1: swipl:abi-version ................   Passed SEC sec
+ 1/79 Test  #1: swipl:abi-version ................   Passed    
       Start  2: swipl:basic
- 2/79 Test  #2: swipl:basic ......................   Passed SEC sec
+ 2/79 Test  #2: swipl:basic ......................   Passed    
       Start  3: swipl:unprotected
- 3/79 Test  #3: swipl:unprotected ................   Passed SEC sec
+ 3/79 Test  #3: swipl:unprotected ................   Passed    
       Start  4: swipl:core
- 4/79 Test  #4: swipl:core .......................   Passed SEC sec
+ 4/79 Test  #4: swipl:core .......................   Passed    
       Start  5: swipl:attvar
- 5/79 Test  #5: swipl:attvar .....................   Passed SEC sec
+ 5/79 Test  #5: swipl:attvar .....................   Passed    
       Start  6: swipl:debug
- 6/79 Test  #6: swipl:debug ......................   Passed SEC sec
+ 6/79 Test  #6: swipl:debug ......................   Passed    
       Start  7: swipl:tabling
- 7/79 Test  #7: swipl:tabling ....................   Passed SEC sec
+ 7/79 Test  #7: swipl:tabling ....................   Passed    
       Start  8: swipl:library
- 8/79 Test  #8: swipl:library ....................   Passed SEC sec
+ 8/79 Test  #8: swipl:library ....................   Passed    
       Start  9: swipl:compile
- 9/79 Test  #9: swipl:compile ....................   Passed SEC sec
+ 9/79 Test  #9: swipl:compile ....................   Passed    
       Start 10: swipl:charset
-10/79 Test #10: swipl:charset ....................   Passed SEC sec
+10/79 Test #10: swipl:charset ....................   Passed    
       Start 11: swipl:eclipse
-11/79 Test #11: swipl:eclipse ....................   Passed SEC sec
+11/79 Test #11: swipl:eclipse ....................   Passed    
       Start 12: swipl:clp
-12/79 Test #12: swipl:clp ........................   Passed SEC sec
+12/79 Test #12: swipl:clp ........................   Passed    
       Start 13: swipl:GC
-13/79 Test #13: swipl:GC .........................   Passed SEC sec
+13/79 Test #13: swipl:GC .........................   Passed    
       Start 14: swipl:save
-14/79 Test #14: swipl:save .......................   Passed SEC sec
+14/79 Test #14: swipl:save .......................   Passed    
       Start 15: swipl:files
-15/79 Test #15: swipl:files ......................   Passed SEC sec
+15/79 Test #15: swipl:files ......................   Passed    
       Start 16: swipl:transaction
-16/79 Test #16: swipl:transaction ................   Passed SEC sec
+16/79 Test #16: swipl:transaction ................   Passed    
       Start 17: swipl:xsb/basic_tests
-17/79 Test #17: swipl:xsb/basic_tests ............   Passed SEC sec
+17/79 Test #17: swipl:xsb/basic_tests ............   Passed    
       Start 18: swipl:xsb/ai_tests
-18/79 Test #18: swipl:xsb/ai_tests ...............   Passed SEC sec
+18/79 Test #18: swipl:xsb/ai_tests ...............   Passed    
       Start 19: swipl:xsb/ptq
-19/79 Test #19: swipl:xsb/ptq ....................   Passed SEC sec
+19/79 Test #19: swipl:xsb/ptq ....................   Passed    
       Start 20: swipl:xsb/neg_tests
-20/79 Test #20: swipl:xsb/neg_tests ..............   Passed SEC sec
+20/79 Test #20: swipl:xsb/neg_tests ..............   Passed    
       Start 21: swipl:xsb/delay_tests
-21/79 Test #21: swipl:xsb/delay_tests ............   Passed SEC sec
+21/79 Test #21: swipl:xsb/delay_tests ............   Passed    
       Start 22: swipl:xsb/wfs_tests
-22/79 Test #22: swipl:xsb/wfs_tests ..............   Passed SEC sec
+22/79 Test #22: swipl:xsb/wfs_tests ..............   Passed    
       Start 23: swipl:xsb/table_tests
-23/79 Test #23: swipl:xsb/table_tests ............   Passed SEC sec
+23/79 Test #23: swipl:xsb/table_tests ............   Passed    
       Start 24: swipl:xsb/incremental_tests
-24/79 Test #24: swipl:xsb/incremental_tests ......   Passed SEC sec
+24/79 Test #24: swipl:xsb/incremental_tests ......   Passed    
       Start 25: swipl:xsb/nonmt_tests
-25/79 Test #25: swipl:xsb/nonmt_tests ............   Passed SEC sec
+25/79 Test #25: swipl:xsb/nonmt_tests ............   Passed    
       Start 26: swipl:xsb/sub_tests
-26/79 Test #26: swipl:xsb/sub_tests ..............   Passed SEC sec
+26/79 Test #26: swipl:xsb/sub_tests ..............   Passed    
       Start 27: swipl:thread
-27/79 Test #27: swipl:thread .....................   Passed SEC sec
+27/79 Test #27: swipl:thread .....................   Passed    
       Start 28: swipl:thread_wait
-28/79 Test #28: swipl:thread_wait ................   Passed SEC sec
+28/79 Test #28: swipl:thread_wait ................   Passed    
       Start 29: swipl:rational
-29/79 Test #29: swipl:rational ...................   Passed SEC sec
+29/79 Test #29: swipl:rational ...................   Passed    
       Start 30: chr:chr
-30/79 Test #30: chr:chr ..........................   Passed SEC sec
+30/79 Test #30: chr:chr ..........................   Passed    
       Start 31: clib:crypt
-31/79 Test #31: clib:crypt .......................   Passed SEC sec
+31/79 Test #31: clib:crypt .......................   Passed    
       Start 32: clib:memfile
-32/79 Test #32: clib:memfile .....................   Passed SEC sec
+32/79 Test #32: clib:memfile .....................   Passed    
       Start 33: clib:readutil
-33/79 Test #33: clib:readutil ....................   Passed SEC sec
+33/79 Test #33: clib:readutil ....................   Passed    
       Start 34: clib:stream
-34/79 Test #34: clib:stream ......................   Passed SEC sec
+34/79 Test #34: clib:stream ......................   Passed    
       Start 35: clib:uri
-35/79 Test #35: clib:uri .........................   Passed SEC sec
+35/79 Test #35: clib:uri .........................   Passed    
       Start 36: clib:cgi
-36/79 Test #36: clib:cgi .........................   Passed SEC sec
+36/79 Test #36: clib:cgi .........................   Passed    
       Start 37: clib:time
-37/79 Test #37: clib:time ........................   Passed SEC sec
+37/79 Test #37: clib:time ........................   Passed    
       Start 38: clib:process
-38/79 Test #38: clib:process .....................   Passed SEC sec
+38/79 Test #38: clib:process .....................   Passed    
       Start 39: clib:socket
-39/79 Test #39: clib:socket ......................   Passed SEC sec
+39/79 Test #39: clib:socket ......................   Passed    
       Start 40: clib:af_unix
-40/79 Test #40: clib:af_unix .....................   Passed SEC sec
+40/79 Test #40: clib:af_unix .....................   Passed    
       Start 41: clib:udp_sockets
-41/79 Test #41: clib:udp_sockets .................   Passed SEC sec
+41/79 Test #41: clib:udp_sockets .................   Passed    
       Start 42: cpp:ffi
-42/79 Test #42: cpp:ffi ..........................   Passed SEC sec
+42/79 Test #42: cpp:ffi ..........................   Passed    
       Start 43: cpp:cpp
-43/79 Test #43: cpp:cpp ..........................   Passed SEC sec
+43/79 Test #43: cpp:cpp ..........................   Passed    
       Start 44: http:json
-44/79 Test #44: http:json ........................   Passed SEC sec
+44/79 Test #44: http:json ........................   Passed    
       Start 45: http:term_html
-45/79 Test #45: http:term_html ...................   Passed SEC sec
+45/79 Test #45: http:term_html ...................   Passed    
       Start 46: http:cgi_stream
-46/79 Test #46: http:cgi_stream ..................   Passed SEC sec
+46/79 Test #46: http:cgi_stream ..................   Passed    
       Start 47: http:http
-47/79 Test #47: http:http ........................   Passed SEC sec
+47/79 Test #47: http:http ........................   Passed    
       Start 48: http:multipart
-48/79 Test #48: http:multipart ...................   Passed SEC sec
+48/79 Test #48: http:multipart ...................   Passed    
       Start 49: http:proxy
-49/79 Test #49: http:proxy .......................   Passed SEC sec
+49/79 Test #49: http:proxy .......................   Passed    
       Start 50: http:websocket
-50/79 Test #50: http:websocket ...................   Passed SEC sec
+50/79 Test #50: http:websocket ...................   Passed    
       Start 51: http:graphql
-51/79 Test #51: http:graphql .....................   Passed SEC sec
+51/79 Test #51: http:graphql .....................   Passed    
       Start 52: mqi:mqi
-52/79 Test #52: mqi:mqi ..........................   Passed SEC sec
+52/79 Test #52: mqi:mqi ..........................   Passed    
       Start 53: nlp:nlp
-53/79 Test #53: nlp:nlp ..........................   Passed SEC sec
+53/79 Test #53: nlp:nlp ..........................   Passed    
       Start 54: redis:redis
-54/79 Test #54: redis:redis ......................   Passed SEC sec
+54/79 Test #54: redis:redis ......................   Passed    
       Start 55: pengines:pengines
-55/79 Test #55: pengines:pengines ................   Passed SEC sec
+55/79 Test #55: pengines:pengines ................   Passed    
       Start 56: protobufs:protobufs
-56/79 Test #56: protobufs:protobufs ..............   Passed SEC sec
+56/79 Test #56: protobufs:protobufs ..............   Passed    
       Start 57: RDF:rdf
-57/79 Test #57: RDF:rdf ..........................   Passed SEC sec
+57/79 Test #57: RDF:rdf ..........................   Passed    
       Start 58: RDF:write
-58/79 Test #58: RDF:write ........................   Passed SEC sec
+58/79 Test #58: RDF:write ........................   Passed    
       Start 59: semweb:turtle
-59/79 Test #59: semweb:turtle ....................   Passed SEC sec
+59/79 Test #59: semweb:turtle ....................   Passed    
       Start 60: semweb:ntriples
-60/79 Test #60: semweb:ntriples ..................   Passed SEC sec
+60/79 Test #60: semweb:ntriples ..................   Passed    
       Start 61: semweb:turtle2
-61/79 Test #61: semweb:turtle2 ...................   Passed SEC sec
+61/79 Test #61: semweb:turtle2 ...................   Passed    
       Start 62: semweb:con
-62/79 Test #62: semweb:con .......................   Passed SEC sec
+62/79 Test #62: semweb:con .......................   Passed    
       Start 63: semweb:litmap
-63/79 Test #63: semweb:litmap ....................   Passed SEC sec
+63/79 Test #63: semweb:litmap ....................   Passed    
       Start 64: semweb:load
-64/79 Test #64: semweb:load ......................   Passed SEC sec
+64/79 Test #64: semweb:load ......................   Passed    
       Start 65: semweb:rdf11
-65/79 Test #65: semweb:rdf11 .....................   Passed SEC sec
+65/79 Test #65: semweb:rdf11 .....................   Passed    
       Start 66: semweb:rdf_db
-66/79 Test #66: semweb:rdf_db ....................   Passed SEC sec
+66/79 Test #66: semweb:rdf_db ....................   Passed    
       Start 67: semweb:subprop
-67/79 Test #67: semweb:subprop ...................   Passed SEC sec
+67/79 Test #67: semweb:subprop ...................   Passed    
       Start 68: sgml:sgml
-68/79 Test #68: sgml:sgml ........................   Passed SEC sec
+68/79 Test #68: sgml:sgml ........................   Passed    
       Start 69: sgml:sgml_write
-69/79 Test #69: sgml:sgml_write ..................   Passed SEC sec
+69/79 Test #69: sgml:sgml_write ..................   Passed    
       Start 70: sgml:xsd
-70/79 Test #70: sgml:xsd .........................   Passed SEC sec
+70/79 Test #70: sgml:xsd .........................   Passed    
       Start 71: sgml:c14n
-71/79 Test #71: sgml:c14n ........................   Passed SEC sec
+71/79 Test #71: sgml:c14n ........................   Passed    
       Start 72: zlib:zlib
-72/79 Test #72: zlib:zlib ........................   Passed SEC sec
+72/79 Test #72: zlib:zlib ........................   Passed    
       Start 73: archive:archive
-73/79 Test #73: archive:archive ..................   Passed SEC sec
+73/79 Test #73: archive:archive ..................   Passed    
       Start 74: odbc:odbc
-74/79 Test #74: odbc:odbc ........................   Passed SEC sec
+74/79 Test #74: odbc:odbc ........................   Passed    
       Start 75: bdb:bdb
-75/79 Test #75: bdb:bdb ..........................   Passed SEC sec
+75/79 Test #75: bdb:bdb ..........................   Passed    
       Start 76: pcre:pcre
-76/79 Test #76: pcre:pcre ........................***Failed SEC sec
+76/79 Test #76: pcre:pcre ........................***Failed    
       Start 77: yaml:yaml
-77/79 Test #77: yaml:yaml ........................   Passed SEC sec
+77/79 Test #77: yaml:yaml ........................   Passed    
       Start 78: ssl:ssl
-78/79 Test #78: ssl:ssl ..........................   Passed SEC sec
+78/79 Test #78: ssl:ssl ..........................   Passed    
       Start 79: xpce:xpce
-79/79 Test #79: xpce:xpce ........................   Passed SEC sec
-
+79/79 Test #79: xpce:xpce ........................   Passed    
 99% tests passed, 1 tests failed out of 79
-
-Total Test time (real) = SEC sec
-
-The following tests FAILED:
 	 76 - pcre:pcre (Failed)
-Errors while running CTest
-Output from these tests are in: $(@D)/Testing/Temporary/LastTest.log
 Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.

--
Gitblit v1.9.3