www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2023/03/30/03:02:22

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7+dev
X-Exmh-Isig-CompType: repl
X-Exmh-Isig-Folder: inbox
From: "karl AT aspodata DOT se [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] lepton-sch2pcb: wrong ${prefix} for pcb
In-reply-to: <20230330032511.12329.qmail@stuge.se>
References: <20230330032511 DOT 12329 DOT qmail AT stuge DOT se>
Comments: In-reply-to "Peter Stuge (peter AT stuge DOT se) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
message dated "Thu, 30 Mar 2023 03:25:11 -0000."
Mime-Version: 1.0
Message-Id: <20230330064204.16FA585F72C3@turkos.aspodata.se>
Date: Thu, 30 Mar 2023 08:42:04 +0200 (CEST)
X-Virus-Scanned: ClamAV using ClamSMTP
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--==_Exmh_1680158467_3450--
This is a multipart MIME message.

--==_Exmh_1680158467_3450
Content-Type: text/plain

Peter Stuge:
> karl AT aspodata DOT se [via geda-user AT delorie DOT com] wrote:
> > What sch2pcb wants is to find common.m4 and the footprint files.
> > But how?
> > 
> > 1, the dirname trick:
> >  $(dirname $(dirname $(which pcb)))/share/pcb
> >  followed by m4, pcblib-newlib alt. newlib depending of what
> >  we are looking for
> 
> This isn't a good choice at all since it makes assumptions about how
> pcb was compiled - specifically that there is a fixed relationship
> between the pcb binary path and the library path.

 Well, there seems there is one, at least per default:

$ cd <git>/pcb
$ grep -B1 BINDIR_TO_PCBLIBDIR config.h
/* Relative path from bindir to pcblibdir */
#define BINDIR_TO_PCBLIBDIR "../share/pcb"
$

 which can be changed with
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]

 ./configure --datarootdir=/opt
 gives:
/* Relative path from bindir to pcblibdir */
#define BINDIR_TO_PCBLIBDIR "../../../opt/pcb"

> > 2, convince pcb devs. to add some cmdline option like
> >  $ pcb --libpath
> >  /usr/local/share/pcb
> 
> This is by far the best!

 Attached patch gives me (on stdout, without X required):
$ pcb --show-libdir
/home/local/bin/../share/pcb
$

> karl AT aspodata DOT se [via geda-user AT delorie DOT com] wrote:
> > pcb already have:
> >   boxA:
> > $ pcb --show-defaults 2>&1 | grep lib-command-dir
> > lib-command-dir "/home/local/bin/../share/pcb"
> > 
> >   boxB:
> > $ pcb --show-defaults 2>&1 | grep lib-command-dir
> > lib-command-dir "/usr/bin/../share/pcb"
> 
> Perfect! Great find.
> 
> karl AT aspodata DOT se [via geda-user AT delorie DOT com] wrote:
> > >  But unfortunately, pcb depends on X beeing available:
> > > $ pcb --show-defaults
> > > Error: Can't open display: 
> > 
> > "pcb -x ps --show-defaults" solves that.
> 
> Okay - attached is a C snippet to grab the string.

 The problem is that -x ps might be disabled with
./configure --with-exporters= --with-printer=
 so we cannot rely on any exporter to be available at all
 and we have to accept that X has to be up and running to
 probe the value for unpatched pcb.

Regards,
/Karl Hammar


--==_Exmh_1680158467_3450
Content-Type: text/plain; charset="utf-8" ; name="patch"
Content-Description: patch
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="patch"

diff --git a/src/main.c b/src/main.c
index a4646a39..38644d93 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1685,6 +1685,13 @@ print_version ()
   exit (0);
 }
 =

+static void
+print_libdir ()
+{
+  printf ("%s\n", pcblibdir);
+  exit (0);
+}
+
 /* ---------------------------------------------------------------------=
-
  * Figure out the canonical name of the executed program
  * and fix up the defaults for various paths
@@ -2035,6 +2042,8 @@ main (int argc, char *argv[])
     usage ();
   if (argc > 1 && strcmp (argv[1], "-V") =3D=3D 0)
     print_version ();
+  if (argc > 1 && strcmp (argv[1], "--show-libdir") =3D=3D 0)
+    print_libdir ();
   /* Export pcb from command line if requested.  */
   if (argc > 1 && strcmp (argv[1], "-p") =3D=3D 0)
     {



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019