Author: pierre Date: Thu Nov 5 13:00:20 2020 New Revision: 4215 Log: Fix asymptote build with ghostscript-9.53
Added: trunk/asymptote/asymptote-2.67-ghostscript_fix-1.patch Added: trunk/asymptote/asymptote-2.67-ghostscript_fix-1.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/asymptote/asymptote-2.67-ghostscript_fix-1.patch Thu Nov 5 13:00:20 2020 (r4215) @@ -0,0 +1,165 @@ +Submitted By: Pierre Labastie <pierre dot labastie at neuf dot fr> +Date: 2020-11-05 +Initial Package Version: 2.67 +Upstream Status: Committed +Origin: Upstream +Description: Fixes broken install with ghostscript-9.53. +From 3361214340d58235f4dbb8f24017d0cd5d94da72 Mon Sep 17 00:00:00 2001 +From: John Bowman <[email protected]> +Date: Sun, 25 Oct 2020 22:24:51 -0600 +Subject: [PATCH] Use ps2write instead of eps2write where possible, for + compatibility with gs 9.53. + +--- + picture.cc | 7 +------ + runlabel.in | 44 ++++++++++++-------------------------------- + settings.cc | 2 ++ + 3 files changed, 15 insertions(+), 38 deletions(-) + +diff --git a/picture.cc b/picture.cc +index c4d2ecd7d..821cbc0f9 100644 +--- a/picture.cc ++++ b/picture.cc +@@ -671,12 +671,7 @@ int picture::pdftoeps(const string& pdfname, const string& epsname, bool eps) + if(safe) + cmd.push_back("-dSAFER"); + string texengine=getSetting<string>("tex"); +- +- if(eps) +- cmd.push_back("-sDEVICE="+getSetting<string>("epsdriver")); +- else +- cmd.push_back("-sDEVICE=ps2write"); +- ++ cmd.push_back("-sDEVICE="+getSetting<string>(eps ? "epsdriver": "psdriver")); + cmd.push_back("-sOutputFile="+stripDir(epsname)); + cmd.push_back(stripDir(pdfname)); + +diff --git a/runlabel.in b/runlabel.in +index 61f66bfcb..632f68df5 100644 +--- a/runlabel.in ++++ b/runlabel.in +@@ -87,7 +87,7 @@ void showpath(std::ostream& ps) + fillpath(ps); + } + +-array *readpath(const string& psname, bool keep, bool pdf=false, ++array *readpath(const string& psname, bool keep, + double hscale=1.0, double vsign=1.0) + { + double vscale=vsign*hscale; +@@ -111,8 +111,8 @@ array *readpath(const string& psname, bool keep, bool pdf=false, + #else + const string null="/dev/null"; + #endif +- string epsdriver=getSetting<string>("epsdriver"); +- cmd.push_back("-sDEVICE="+epsdriver); ++ string psdriver=getSetting<string>("psdriver"); ++ cmd.push_back("-sDEVICE="+psdriver); + cmd.push_back("-sOutputFile="+null); + cmd.push_back(stripDir(psname)); + iopipestream gs(cmd,"gs","Ghostscript"); +@@ -120,7 +120,7 @@ array *readpath(const string& psname, bool keep, bool pdf=false, + stringstream buf; + string s=gs.readline(); + if(s.empty()) break; +- if(!pdf) gs << newl; ++ gs << newl; + + // Workaround broken stringstream container in libc++. + #ifdef _LIBCPP_VERSION +@@ -288,13 +288,9 @@ patharray2 *_texpath(stringarray *s, penarray *p) + string pdfname,pdfname2,psname2; + bool keep=getSetting<bool>("keep"); + +- bool legacygs=false; + if(!status) { + if(xe) { +-// Use legacy ghostscript driver for gs-9.13 and earlier. +- string epsdriver=getSetting<string>("epsdriver"); +- legacygs=epsdriver == "epswrite"; +- ++ string psdriver=getSetting<string>("psdriver"); + pdfname=auxname(prefix,"pdf"); + pdfname2=auxname(prefix+"_","pdf"); + psname2=auxname(prefix+"_","ps"); +@@ -323,28 +319,13 @@ patharray2 *_texpath(stringarray *s, penarray *p) + cmd.push_back("-dNOPAUSE"); + cmd.push_back("-dBATCH"); + if(safe) cmd.push_back("-dSAFER"); +- cmd.push_back("-sDEVICE="+epsdriver); +- // Work around eps2write bug that forces all postscript to first page. +- cmd.push_back("-sOutputFile="+psname2+(legacygs ? "" : "%d")); ++ cmd.push_back("-sDEVICE="+psdriver); ++ cmd.push_back("-sOutputFile="+psname2); + cmd.push_back(pdfname2); + status=System(cmd,0,true,"gs"); + +- if(legacygs) { +- std::ifstream in(psname2.c_str()); +- ps << in.rdbuf(); +- } else { +- for(unsigned int i=1; i <= n ; ++i) { +- ostringstream buf; +- buf << psname2 << i; +- const string& s=buf.str(); +- const char *name=s.c_str(); +- std::ifstream in(name,std::ios::binary); +- ps << in.rdbuf(); +- ps << "(>\n) print flush\n"; +- in.close(); +- if(!keep) unlink(name); +- } +- } ++ std::ifstream in(psname2.c_str()); ++ ps << in.rdbuf(); + ps.close(); + } + } else { +@@ -380,8 +361,7 @@ patharray2 *_texpath(stringarray *s, penarray *p) + unlink(auxname(prefix,"tui").c_str()); + } + } +- return xe ? readpath(psname,keep,!legacygs,0.1) : +- readpath(psname,keep,false,0.12,-1.0); ++ return xe ? readpath(psname,keep,0.1) : readpath(psname,keep,0.12,-1.0); + } + + patharray2 *textpath(stringarray *s, penarray *p) +@@ -426,7 +406,7 @@ patharray2 *textpath(stringarray *s, penarray *p) + cmd2.push_back("-dBATCH"); + cmd2.push_back("-P"); + if(safe) cmd2.push_back("-dSAFER"); +- cmd2.push_back("-sDEVICE="+getSetting<string>("epsdriver")); ++ cmd2.push_back("-sDEVICE="+getSetting<string>("psdriver")); + cmd2.push_back("-sOutputFile=-"); + cmd2.push_back("-"); + iopipestream gs(cmd2,"gs","Ghostscript"); +@@ -455,7 +435,7 @@ patharray2 *textpath(stringarray *s, penarray *p) + bool keep=getSetting<bool>("keep"); + if(!keep) // Delete temporary files. + unlink(textname.c_str()); +- return readpath(psname,keep,false,0.1); ++ return readpath(psname,keep,0.1); + } + + patharray *_strokepath(path g, pen p=CURRENTPEN) +diff --git a/settings.cc b/settings.cc +index 54f41109f..b5056a89b 100644 +--- a/settings.cc ++++ b/settings.cc +@@ -85,6 +85,7 @@ const bool havegl=false; + mode_t mask; + + string systemDir=ASYMPTOTE_SYSDIR; ++string defaultPSdriver="ps2write"; + string defaultEPSdriver="eps2write"; + string defaultAsyGL="https://vectorgraphics.github.io/asymptote/base/webgl/asygl-"+ + string(AsyGLVersion)+".js"; +@@ -1427,6 +1428,7 @@ void initSettings() { + addOption(new envSetting("gs", defaultGhostscript)); + addOption(new envSetting("libgs", defaultGhostscriptLibrary)); + addOption(new envSetting("epsdriver", defaultEPSdriver)); ++ addOption(new envSetting("psdriver", defaultPSdriver)); + addOption(new envSetting("asygl", defaultAsyGL)); + addOption(new envSetting("texpath", "")); + addOption(new envSetting("texcommand", "")); -- http://lists.linuxfromscratch.org/listinfo/patches FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
