Friday, August 03, 2018

Re: [NEW/WIP] Qflow porting // [2/7] Yosys

On 2018/08/03 13:57, Alessandro DE LAURENZIS wrote:
> Hi Stuart,
>
> On 08/03/18 13:21, Stuart Henderson wrote:
> > > std::string proc_self_dirname()
> > > {
> > > // No direct way to get the process executable base path
> > > char path[PATH_MAX];
> > > ssize_t buflen = sizeof(path);
> > > char *res = realpath(getenv("_"), path);
> > > if (!res) {
> > > log_error("getenv(\"_\") failed: %s\n",strerror(errno));
> > > }
> > > *(strrchr(path, '/')+1) = '\0';
> > > while (buflen > 0 && path[buflen-1] != '/')
> > > buflen--;
> > > return std::string(path, buflen);
> > > }
> > >
> > > If you think that's acceptable, I'll submit the patch upstream.
> > IMO hardcoding the path is the most sensible way for ports.
> >
>
> Do you mean something like this?
>
> std::string proc_self_dirname()
> {
> return "/usr/local/bin/";
> }
>
> How does it play with a different $LOCALBASE?
>
> --
> Alessandro DE LAURENZIS
> [mailto:just22@atlantide.t28.net]
> Web: http://www.atlantide.t28.net
> LinkedIn: http://it.linkedin.com/in/delaurenzis
>

Either patch to use ${PREFIX} and use ${SUBST_CMD} on the file
after patching, or use /usr/local and "sed -i s,/usr/local,${PREFIX},"

(PREFIX relates to "where this port installs", LOCALBASE relates to
"where other ports on the system are found").

No comments:

Post a Comment