X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Message-ID: <20230331011920.15319.qmail@stuge.se> Date: Fri, 31 Mar 2023 01:19:20 +0000 From: "Peter Stuge (peter AT stuge DOT se) [via geda-user AT delorie DOT com]" To: geda-user AT delorie DOT com Subject: Re: [geda-user] lepton-sch2pcb: wrong ${prefix} for pcb References: <20230330032511 DOT 12329 DOT qmail AT stuge DOT se> <20230330064204 DOT 16FA585F72C3 AT turkos DOT aspodata DOT se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230330064204.16FA585F72C3@turkos.aspodata.se> 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 Precedence: bulk karl AT aspodata DOT se [via geda-user AT delorie DOT com] wrote: > > > 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 /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" Exactly; because it can be changed by pcb configure it's unfortunately not possible to assume anything. > > > 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 > $ It's a short and sweet patch but I guess we don't want to wait for it to be included and then a release before using this functionality so for now we can make do with what unpatched pcb offers. > > 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. This is a good substitute for the explicit option added by your patch. > > 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. It's even possible to configure --with-gui= and have no hid at all. How about we first try pcb -p --show-defaults, then pcb -x ps, then with default hid, then fail? If there's no X then gschem/lepton might anyway not start (interactively) - right? //Peter