Mail Archives: geda-user/2023/03/30/21:40:14
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 <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"
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
- Raw text -