Friday, August 03, 2018

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

Hi Stuart,

On 08/03/18 13:21, Stuart Henderson wrote:

> On 2018/08/03 12:23, Alessandro DE LAURENZIS wrote:
>> I think we need the line:
>>
>> FAKE_FLAGS = PREFIX="${LOCALBASE}"
>>
>> since PREFIX is explicitly set to /usr/local in upstream Makefile when
>> undefined.
>
> That should probably be PREFIX="${TRUEPREFIX}"

Fixed


>> Finally, portcheck gives the following message:
>>
>> Python module without compiled version, consider using ${MODPY_BIN}
>> ${MODPY_LIBDIR}/compileall.py: share/yosys/python3/smtio.py
>> cad/yosys
>>
>> I don't know if it's acceptable (and, if not, how to remove it...)
>
> Python normally creates pyc files for imported modules if the directory
> is writable. We pre-create these so that if e.g. someone runs the program
> as root, we don't get stray pyc files left behind after uninstall.
> You can remove it by using ${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py
> to create the pyc file.

Added it in post-install target:

post-install:
${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
${PREFIX}/share/yosys/python3


>> - compiler name forced to eg++;
>
> Don't hardcode this, use MAKE_FLAGS= CXX="${CXX}" etc.

Fixed


>> Different story for kernel/yosys.cc:
>> - we need to include sys/wait.h;
>> - code requires the process executable base path; Linux has /proc/self/exe
>> and I see that there are solutions for APPLE and WIN32 too; OpenBSD doesn't
>> have a ready-to-use function; this is the closest thing that comes to my
>> mind:
>>
>> 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.

As discussed (thanks for your explanation), I patched to use ${PREFIX}
and then added:

pre-build:
${SUBST_CMD} ${WRKSRC}/kernel/yosys.cc


>> pdflatex is used to compile manual, application notes and presentations
>> during build; it's part of print/texlive_base, which is a large port; should
>> we stay with it or do you have alternatives to suggest?
>
> That's not really a problem. If it needs pdflatex, list the dependency.
> >> pdflatex is used to compile manual, application notes and presentations
>> during build; it's part of print/texlive_base, which is a large port; should
>> we stay with it or do you have alternatives to suggest?
>
> That's not really a problem. If it needs pdflatex, list the dependency.

Actually I noticed that the corresponding target isn't run by default.
Should I force it? I mean, is the extra documentation normally installed
in other ports?

New tarball attached.

--
Alessandro DE LAURENZIS
[mailto:just22@atlantide.t28.net]
Web: http://www.atlantide.t28.net
LinkedIn: http://it.linkedin.com/in/delaurenzis

No comments:

Post a Comment