Re: cad/yosys: enabling "show" feature

2019-04-29 Thread Alessandro DE LAURENZIS

Ping!

On 25/04/2019 16:59, Alessandro DE LAURENZIS wrote:

Dear ports@ readers,

now that graphics/xdot is in the tree, we can enable the "show" function 
in cad/yosys.


It works flawlessly, provided that:
- graphics/xdot is added to the RUN_DEPENDS list;
- the file passes/cmds/show.cc is patched, since BSD fuser(1) works 
differently than the GNU counterpart.


While there, I slightly modified the "do-configure" target, passing 
$MAKE_ENV to the ${MAKE_PROGRAM} environment to avoid two annoying 
(although harmless) "bash: tclsh: command not found" errors.


Diff attached.




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



cad/yosys: enabling "show" feature

2019-04-25 Thread Alessandro DE LAURENZIS

Dear ports@ readers,

now that graphics/xdot is in the tree, we can enable the "show" function 
in cad/yosys.


It works flawlessly, provided that:
- graphics/xdot is added to the RUN_DEPENDS list;
- the file passes/cmds/show.cc is patched, since BSD fuser(1) works 
differently than the GNU counterpart.


While there, I slightly modified the "do-configure" target, passing 
$MAKE_ENV to the ${MAKE_PROGRAM} environment to avoid two annoying 
(although harmless) "bash: tclsh: command not found" errors.


Diff attached.

--
Alessandro DE LAURENZIS
[mailto:jus...@atlantide.t28.net]
Web: http://www.atlantide.t28.net
LinkedIn: https://www.linkedin.com/in/delaurenzis/
Index: Makefile
===
RCS file: /cvs/ports/cad/yosys/Makefile,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 Makefile
--- Makefile	9 Jan 2019 04:27:09 -	1.3
+++ Makefile	25 Apr 2019 14:42:44 -
@@ -6,6 +6,7 @@ GH_ACCOUNT =	YosysHQ
 GH_PROJECT =	yosys
 GH_TAGNAME =	yosys-0.8
 DISTNAME =	${GH_TAGNAME}
+REVISION =	0
 
 CATEGORIES =	cad
 
@@ -30,6 +31,7 @@ BUILD_DEPENDS =	devel/bison \
 
 RUN_DEPENDS =	cad/abc \
 		math/graphviz \
+		graphics/xdot \
 		shells/bash
 
 LIB_DEPENDS =	${MODTCL_LIB_DEPENDS} \
@@ -58,7 +60,7 @@ FAKE_FLAGS =	PREFIX="${TRUEPREFIX}"
 
 do-configure:
 	@${SUBST_CMD} ${WRKSRC}/kernel/yosys.cc
-	@cd ${WRKBUILD} && exec ${MAKE_PROGRAM} config-gcc
+	@cd ${WRKBUILD} && exec env -i ${MAKE_ENV} ${MAKE_PROGRAM} config-gcc
 
 post-install:
 	${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
Index: patches/patch-passes_cmds_show_cc
===
RCS file: patches/patch-passes_cmds_show_cc
diff -N patches/patch-passes_cmds_show_cc
--- /dev/null	1 Jan 1970 00:00:00 -
+++ patches/patch-passes_cmds_show_cc	25 Apr 2019 14:42:44 -
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: passes/cmds/show.cc
+--- passes/cmds/show.cc.orig
 passes/cmds/show.cc
+@@ -847,7 +847,7 @@ struct ShowPass : public Pass {
+ log_cmd_error("Shell command failed!\n");
+ 		} else
+ 		if (format.empty()) {
+-			std::string cmd = stringf("{ test -f '%s.pid' && fuser -s '%s.pid'; } || ( echo $$ >&3; exec xdot '%s'; ) 3> '%s.pid' &", dot_file.c_str(), dot_file.c_str(), dot_file.c_str(), dot_file.c_str());
++			std::string cmd = stringf("test -f '%s.pid' -a -n \"`fuser '%s.pid' 2>/dev/null`\" || ( echo $$ >&3; exec xdot '%s'; ) 3> '%s.pid' &", dot_file.c_str(), dot_file.c_str(), dot_file.c_str(), dot_file.c_str());
+ 			log("Exec: %s\n", cmd.c_str());
+ 			if (run_command(cmd) != 0)
+ log_cmd_error("Shell command failed!\n");