GitHub
12/04/2021, 9:59 AMgrep -zl 'sky130.lib.spice' $$file || ${SED} -z 's|format="tcleval( @value )"\nvalue="|format="tcleval( @value )"\nvalue="\n.lib \\\\\\\\$$\:\:SKYWATER_MODELS\\\\\\\\/sky130.lib.spice tt |' -i $$file ; \
grep -zl 'format="tcleval( @value )".*value="' $$file || printf 'C {devices/code.sym} -170 0 0 0 {name=TT_MODELS\nonly_toplevel=true\nformat="tcleval( @value )"\nvalue="\n.lib \\\\\\\\$$\:\:SKYWATER_MODELS\\\\\\\\/sky130.lib.spice tt\n"}' >> $$file ; \
Add the lines
if [[ "$(shell uname)" == "Darwin" ]]; then \
ggrep -zl 'sky130.lib.spice' $$file || ${SED} -z 's|format="tcleval( @value )"\nvalue="|format="tcleval( @value )"\nvalue="\n.lib \\\\\\\\$$\:\:SKYWATER_MODELS\\\\\\\\/sky130.lib.spice tt |' -i $$file ; \
ggrep -zl 'format="tcleval( @value )".*value="' $$file || printf 'C {devices/code.sym} -170 0 0 0 {name=TT_MODELS\nonly_toplevel=true\nformat="tcleval( @value )"\nvalue="\n.lib \\\\\\\\$$\:\:SKYWATER_MODELS\\\\\\\\/sky130.lib.spice tt\n"}' >> $$file ; \
else \
and after them just add "fi."
Sorry I'm not conversant enough in the ways of Git to submit this as a formal pull request.
I tried to do the OS check using $OSTYPE but within this particular script that returned null for some reason, so I found the uname solution.
Fortunately the configure scripts seem to already detect if a Mac user has the special GNU version of SED, gsed, installed and selects it, but the grep needs to be switched explicitly. (There's probably a more elegant solution).
I put together this video documenting my progress working through it:
RTimothyEdwards/open_pdks