Hi, MFC: Fix for ghostscript 10.02.1, which removes finddevice, backported to lilypond-2.22.2.
ok (for OPENBSD_7_4)? Index: Makefile =================================================================== RCS file: /cvs/ports/print/lilypond/Makefile,v diff -u -p -r1.58 Makefile --- Makefile 25 Sep 2023 17:07:35 -0000 1.58 +++ Makefile 8 Nov 2023 21:49:27 -0000 @@ -8,7 +8,7 @@ PKGNAME-main= lilypond-${VERSION} PKGNAME-docs= lilypond-docs-${VERSION} CATEGORIES= print -REVISION-main= 1 +REVISION-main= 2 URW_V= 20200910 DISTFILES= ${DISTNAME}.tar.gz Index: patches/patch-scm_backend-library_scm =================================================================== RCS file: patches/patch-scm_backend-library_scm diff -N patches/patch-scm_backend-library_scm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-scm_backend-library_scm 8 Nov 2023 21:49:27 -0000 @@ -0,0 +1,47 @@ +Fix for ghostscript 10.02.1 (finddevice removed) by backporting +https://gitlab.com/lilypond/lilypond/-/merge_requests/2160/diffs?commit_id=3d1a7fa40fae01c40c60344a09d0bcf01896557a + +Index: scm/backend-library.scm +--- scm/backend-library.scm.orig ++++ scm/backend-library.scm +@@ -115,10 +115,16 @@ + "/CompatibilityLevel 1.4" + (if (not is-eps) + (ly:format "/PageSize [~$ ~$]" paper-width paper-height)) +- "(pdfwrite) finddevice putdeviceprops pop" +- ;; `setdevice` does not set some defaults. So we use +- ;; `selectdevide` instead. +- "(pdfwrite) selectdevice" ++ "/OutputDevice /pdfwrite >> setpagedevice" ++ ;; `setpagedevice` does not set some defaults, creating ++ ;; larger output files than necessary. To fix this we use ++ ;; the undocumented, internal `.setdefaultscreen` procedure ++ ;; (tested with gs 10.02.1). ++ "/.setdefaultscreen where {" ++ "pop .setdefaultscreen" ++ "} {" ++ "(Warning: .setdefaultscreen not available) print" ++ "} ifelse" + ;; from Resource/Init/gs_pdfwr.ps; needed here because we + ;; do not have the pdfwrite device initially (-dNODISPLAY). + "newpath fill" +@@ -136,10 +142,15 @@ + (ly:gs-api (gs-cmd-args is-eps #f) + (string-join + (list +- (ly:format "mark /OutputFile (~a)" flush-name) +- "(pdfwrite) finddevice putdeviceprops pop" +- ;; see above +- "(pdfwrite) selectdevice" ++ "<<" ++ (ly:format "/OutputFile (~a)" flush-name) ++ "/OutputDevice /pdfwrite >> setpagedevice" ++ ;; see above ++ "/.setdefaultscreen where {" ++ "pop .setdefaultscreen" ++ "} {" ++ "(Warning: .setdefaultscreen not available) print" ++ "} ifelse" + ;; see above + "newpath fill") + " ")) Index: patches/patch-scm_framework-ps_scm =================================================================== RCS file: patches/patch-scm_framework-ps_scm diff -N patches/patch-scm_framework-ps_scm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-scm_framework-ps_scm 8 Nov 2023 21:49:27 -0000 @@ -0,0 +1,17 @@ +Fix for ghostscript 10.02.1 (finddevice removed) by backporting +https://gitlab.com/lilypond/lilypond/-/merge_requests/2160/diffs?commit_id=3d1a7fa40fae01c40c60344a09d0bcf01896557a + +Index: scm/framework-ps.scm +--- scm/framework-ps.scm.orig ++++ scm/framework-ps.scm +@@ -610,8 +610,8 @@ + (begin + (display " + /currentpagedevice where { +- pop currentpagedevice /Name known { +- currentpagedevice /Name get (pdfwrite) eq { ++ pop currentpagedevice /OutputDevice known { ++ currentpagedevice /OutputDevice get (pdfwrite) eq { + << /NeverEmbed [" port) + (display (string-concatenate + (map (lambda (f) (string-append " /" f)) Index: patches/patch-scm_ps-to-png_scm =================================================================== RCS file: patches/patch-scm_ps-to-png_scm diff -N patches/patch-scm_ps-to-png_scm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-scm_ps-to-png_scm 8 Nov 2023 21:49:27 -0000 @@ -0,0 +1,43 @@ +Fix for ghostscript 10.02.1 (finddevice removed) by backporting +https://gitlab.com/lilypond/lilypond/-/merge_requests/2160/diffs?commit_id=3d1a7fa40fae01c40c60344a09d0bcf01896557a + +Index: scm/ps-to-png.scm +--- scm/ps-to-png.scm.orig ++++ scm/ps-to-png.scm +@@ -108,7 +108,8 @@ + (filter + string? + (list +- (ly:format "mark /OutputFile (~a)" pngn-gs) ++ "<<" ++ (ly:format "/OutputFile (~a)" pngn-gs) + "/GraphicsAlphaBits 4 /TextAlphaBits 4" + (if fit-page + ;; Get available resolution and magnify it according +@@ -123,20 +124,12 @@ currentpagedevice /HWResolution get 1 get ~a mul \ + (ly:format "/DownScaleFactor ~a" anti-alias-factor) + (if (or (not is-eps) fit-page) + (ly:format "/PageSize [~a ~a]" width height)) +- ;; We use `findprotodevice` because `finddevice` always returns +- ;; the same device instance and we can't reset the page number of +- ;; the device. `findprotodevice copydevice` creates a new device +- ;; instance each time, which can reset the page number. +- (ly:format "(~a) findprotodevice copydevice" pixmap-format) +- "putdeviceprops setdevice" +- ;; We want to use `selectdevice` instead of `setdevice` because +- ;; `setdevice` doesn't set some defaults. But using `selectdevice` +- ;; can't reset the page number because `selectdevice` uses +- ;; `finddevice` internally. So, as a workaround, we use an +- ;; undocumented `.setdefaultscreen` procedure which is used inside +- ;; `selectdevice` to set the defaults. It works in Ghostscript +- ;; 9.52 but may not work if the internal implementation of +- ;; `selectdevice` is changed in the future. ++ (ly:format "/OutputDevice /~a" pixmap-format) ++ ">> setpagedevice" ++ ;; `setpagedevice` does not set some defaults, creating ++ ;; larger output files than necessary. To fix this we use ++ ;; the undocumented, internal `.setdefaultscreen` procedure ++ ;; (tested with gs 10.02.1). + "/.setdefaultscreen where {" + "pop .setdefaultscreen" + "} {" Index: patches/patch-scripts_build_output-distance_py =================================================================== RCS file: patches/patch-scripts_build_output-distance_py diff -N patches/patch-scripts_build_output-distance_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-scripts_build_output-distance_py 8 Nov 2023 21:49:27 -0000 @@ -0,0 +1,19 @@ +Fix for ghostscript 10.02.1 (finddevice removed) by backporting +https://gitlab.com/lilypond/lilypond/-/merge_requests/2160/diffs?commit_id=3d1a7fa40fae01c40c60344a09d0bcf01896557a + +Index: scripts/build/output-distance.py +--- scripts/build/output-distance.py.orig ++++ scripts/build/output-distance.py +@@ -720,10 +720,10 @@ class SignatureFileLink (FileLink): + for f in glob.glob(base): + outfile = (out_dir + '/' + f).replace('.eps', '.png') + driver.write(''' +- mark /OutputFile (%s) ++ << /OutputFile (%s) + /GraphicsAlphaBits 4 /TextAlphaBits 4 + /HWResolution [101 101] +- (png16m) finddevice putdeviceprops setdevice ++ /OutputDevice /png16m >> setpagedevice + (%s) run + ''' % (outfile, f)) + files_created[oldnew].append(outfile)