<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[136715] trunk/dports/graphics/pstoedit</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/136715">136715</a></dd>
<dt>Author</dt> <dd>khindenburg@macports.org</dd>
<dt>Date</dt> <dd>2015-05-24 17:05:12 -0700 (Sun, 24 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>pstoedit: add patch from OpenSUSE to find all the plugins #47354</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportsgraphicspstoeditPortfile">trunk/dports/graphics/pstoedit/Portfile</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkdportsgraphicspstoeditfilespatchpkglibdirdiff">trunk/dports/graphics/pstoedit/files/patch-pkglibdir.diff</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportsgraphicspstoeditPortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/graphics/pstoedit/Portfile (136714 => 136715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/graphics/pstoedit/Portfile        2015-05-24 22:36:25 UTC (rev 136714)
+++ trunk/dports/graphics/pstoedit/Portfile        2015-05-25 00:05:12 UTC (rev 136715)
</span><span class="lines">@@ -5,6 +5,7 @@
</span><span class="cx"> 
</span><span class="cx"> name                pstoedit
</span><span class="cx"> version             3.70
</span><ins>+revision            1
</ins><span class="cx"> categories          graphics
</span><span class="cx"> platforms           darwin
</span><span class="cx"> maintainers         nomaintainer
</span><span class="lines">@@ -29,7 +30,8 @@
</span><span class="cx"> 
</span><span class="cx"> depends_run         port:ghostscript
</span><span class="cx"> 
</span><del>-patchfiles          patch-src-cppcomp.h.diff
</del><ins>+patchfiles          patch-src-cppcomp.h.diff \
+                    patch-pkglibdir.diff
</ins><span class="cx"> 
</span><span class="cx"> configure.args      --without-emf \
</span><span class="cx">                     --without-swf
</span></span></pre></div>
<a id="trunkdportsgraphicspstoeditfilespatchpkglibdirdiff"></a>
<div class="addfile"><h4>Added: trunk/dports/graphics/pstoedit/files/patch-pkglibdir.diff (0 => 136715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/graphics/pstoedit/files/patch-pkglibdir.diff                                (rev 0)
+++ trunk/dports/graphics/pstoedit/files/patch-pkglibdir.diff        2015-05-25 00:05:12 UTC (rev 136715)
</span><span class="lines">@@ -0,0 +1,180 @@
</span><ins>+Fix for pstoedit search for plugins.
+
+By default, pstoedit &quot;make install&quot; installs to PSTOEDITLIBDIR, so if
+nobody moves them to another location, then it is sufficient to search in
+PSTOEDITLIBDIR.
+
+
+But the way how pstoedit searches for plugins is broken:
+
+If pstoedit.reg does not exist or does not contain common/plugindir, then
+it tries $exepath/../lib/pstoedit, always sets pluginsloaded, and never
+tries PSTOEDITLIBDIR.
+
+If pstoedit.reg contains common/plugindir, then it tries that path,
+always sets pluginsloaded, and never tries PSTOEDITLIBDIR.
+
+=&gt; The default installation directory is never tried, if it is not equal
+to one of above.
+
+
+The implementation has just another problem:
+
+If pstoedit.reg contains common/plugindir, and the directory defined
+there is equal to $pkglibdir, but the string is not literally
+&quot;{expansion_of_bindir}/../lib/pstoedit&quot;, then plugins are loaded twice.
+So the check as it is makes only a little sense, because nobody would
+create ~/.pstoedit.reg containing:
+
+common/plugindir=/usr/bin/../lib/pstoedit
+
+
+The new implementation does things differently:
+
+If common/plugindir is defined, it checks only that directory.
+
+It swaps the check order: First checks whether PSTOEDITLIBDIR exists. If
+it exists, it skips blind attempts to find plugins.
+
+As PSTOEDITLIBDIR is always defined by makefile, the blind fallback will
+be attempted only in obscure environments.
+
+
+Index: pstoedit-3.70/src/pstoedit.cpp
+===================================================================
+--- src/pstoedit.cpp
++++ src/pstoedit.cpp
+@@ -30,6 +30,7 @@
+ #include I_string_h

+ #include &lt;assert.h&gt;
++#include &lt;sys/stat.h&gt;

+ #include &quot;pstoeditoptions.h&quot;

+@@ -261,33 +262,33 @@ static void loadpstoeditplugins(const ch
+                 loadPlugInDrivers(plugindir.c_str(), errstream, verbose);        // load the driver plugins
+                 pluginsloaded = true;
+         }
+-        // also look in the directory where the pstoedit .exe/dll was found
+-        char szExePath[1000];
+-        szExePath[0] = '\0';
+-        const unsigned long r = P_GetPathToMyself(progname, szExePath, sizeof(szExePath));
+-        if (verbose)  errstream &lt;&lt; &quot;pstoedit : path to myself:&quot; &lt;&lt; progname &lt;&lt; &quot; &quot; &lt;&lt; r &lt;&lt; &quot; &quot; &lt;&lt; szExePath&lt;&lt; endl;
+-        char *p = 0;
+-        if (r &amp;&amp; (p = strrchr(szExePath, directoryDelimiter)) != 0) {
+-                *p = '\0';
+-                if (!strequal(szExePath, plugindir.c_str())) {
+-                        loadPlugInDrivers(szExePath, errstream,verbose);
+-                        pluginsloaded = true;
+-                }
+-        }
+-        // now try also $exepath/../lib/pstoedit
+-        strcat_s(szExePath,1000,&quot;/../lib/pstoedit&quot;);
+-        if (!strequal(szExePath, plugindir.c_str())) {
+-            loadPlugInDrivers(szExePath, errstream,verbose);
+-                pluginsloaded = true;
+-        }
+-
+ #ifdef PSTOEDITLIBDIR
+-        if (!pluginsloaded) {
++        struct stat s;
++        if (!pluginsloaded &amp;&amp;
++            !stat(PSTOEDITLIBDIR, &amp;s) &amp;&amp;
++            S_ISDIR(s.st_mode)) {
+             // also try to load drivers from the PSTOEDITLIBDIR
+           loadPlugInDrivers(PSTOEDITLIBDIR, errstream,verbose);
+           pluginsloaded = true;
+         }
+ #endif
++        // If the above failed, also look in the directory where the pstoedit .exe/dll was found
++        if (!pluginsloaded) {
++          char szExePath[1000];
++          szExePath[0] = '\0';
++          const unsigned long r = P_GetPathToMyself(progname, szExePath, sizeof(szExePath));
++          if (verbose)  errstream &lt;&lt; &quot;pstoedit : path to myself:&quot; &lt;&lt; progname &lt;&lt; &quot; &quot; &lt;&lt; r &lt;&lt; &quot; &quot; &lt;&lt; szExePath&lt;&lt; endl;
++          char *p = 0;
++          if (r &amp;&amp; (p = strrchr(szExePath, directoryDelimiter)) != 0) {
++                *p = '\0';
++                loadPlugInDrivers(szExePath, errstream,verbose);
++          }
++          // now try also $exepath/../lib/pstoedit
++          strcat_s(szExePath,1000,&quot;/../lib/pstoedit&quot;);
++          if (!strequal(szExePath, plugindir.c_str())) {
++          loadPlugInDrivers(szExePath, errstream,verbose);
++          }
++        }

+         // delete[]plugindir;
+ }
+Index: pstoedit-3.70/doc/pstoedit.tex
+===================================================================
+--- doc/pstoedit.tex
++++ doc/pstoedit.tex
+@@ -352,7 +352,7 @@ If  the \Opt{-fontmap} option is not spe
+   \item MS Windows: The same directory where the \Prog{pstoedit} executable is located

+   \item Unix:\\
+-  $&lt;$\emph{The directory where the pstoedit executable is located}$&gt;$\verb+/../lib/+
++  The default installation directory. If it fails, then $&lt;$\emph{The directory where the pstoedit executable is located}$&gt;$\verb+/../lib/+

+ \end{itemize}

+Index: pstoedit-3.70/doc/pstoedit.1
+===================================================================
+--- pstoedit.1
++++ doc/pstoedit.1
+@@ -1,5 +1,5 @@
+ '\&quot; t
+-.\&quot; Manual page created with latex2man on Thu Jan  1 20:55:12 CET 2015
++.\&quot; Manual page created with latex2man on Fri Mar 13 20:58:53 CET 2015
+ .\&quot; NOTE: This file is generated, DO NOT EDIT.
+ .de Vb
+ .ft CW
+@@ -10,7 +10,7 @@

+ .fi
+ ..
+-.TH &quot;PSTOEDIT&quot; &quot;1&quot; &quot;01 January 2015&quot; &quot;Conversion Tools &quot; &quot;Conversion Tools &quot;
++.TH &quot;PSTOEDIT&quot; &quot;1&quot; &quot;13 March 2015&quot; &quot;Conversion Tools &quot; &quot;Conversion Tools &quot;
+ .SH NAME

+ pstoedit
+@@ -367,7 +367,7 @@ MS Windows: The same directory where the
+ .B *
+ Unix:
+ .br 
+-&lt;\fIThe directory where the pstoedit executable is located\fP&gt;
++The default installation directory. If it fails, then &lt;\fIThe directory where the pstoedit executable is located\fP&gt;
+ /../lib/ 
+ .RS
+ .PP
+Index: pstoedit-3.70/doc/pstoedit.htm
+===================================================================
+--- doc/pstoedit.htm
++++ doc/pstoedit.htm
+@@ -1,5 +1,5 @@
+ &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 3.2 Final//EN&quot;&gt;
+-&lt;!-- Manual page created with latex2man on Thu Jan  1 20:55:13 CET 2015
++&lt;!-- Manual page created with latex2man on Fri Mar 13 20:58:54 CET 2015
+ ** Author of latex2man: Juergen.Vollmer@informatik-vollmer.de
+ ** NOTE: This file is generated, DO NOT EDIT. --&gt;
+ &lt;html&gt;
+@@ -9,7 +9,7 @@
+ PSTOEDIT 
+ &lt;/h1&gt;
+ &lt;h4 align=center&gt;Dr. Wolfgang Glunz &lt;/h4&gt;
+-&lt;h4 align=center&gt;01 January 2015&lt;/h4&gt;
++&lt;h4 align=center&gt;13 March 2015&lt;/h4&gt;
+ &lt;h4 align=center&gt;Version 3.70 &lt;/h4&gt;
+ &lt;tt&gt;pstoedit&lt;/tt&gt;
+ - a tool converting PostScript and PDF files into various 
+@@ -561,7 +561,7 @@ in the installation directory and uses t
+ &lt;/li&gt;
+ &lt;li&gt;Unix:&lt;br&gt;
+  
+-&amp;lt;&lt;em&gt;The directory where the pstoedit executable is located&lt;/em&gt;&amp;gt;
++The default installation directory. If it fails, then &amp;lt;&lt;em&gt;The directory where the pstoedit executable is located&lt;/em&gt;&amp;gt;
+ &lt;tt&gt;/../lib/&lt;/tt&gt; 
+ &lt;p&gt;
+ &lt;/li&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>