%global pkgvers 0 %global scdate0 20230531 %global schash0 de3240d7529a6970437ac3344820aaae7839f215 %global branch0 main %global source0 https://github.com/google/gf180mcu-pdk.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} Name: open-pdk-globalfoundries Version: 0.0.0 Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: Open PDK for GlobaFloundries 180nm node License: Apache 2.0 BuildArch: noarch URL: https://github.com/google/gf180mcu-pdk BuildRequires: make git python3-devel python3-setuptools %if 0%{?fedora} BuildRequires: python3-sphinx ImageMagick inkscape BuildRequires: config(latexmk) tex(cmap.sty) tex(tex) tex(latex) tex(fncychap.sty) BuildRequires: tex(wrapfig.sty) tex(capt-of.sty) tex(framed.sty) tex(tgtermes.sty) BuildRequires: tex(upquote.sty) tex(needspace.sty) tex(tabulary.sty) %endif %define build_targets %(curl https://raw.githubusercontent.com/google/gf180mcu-pdk/main/.gitmodules | grep submodule | awk '{print $2}' | cut -d'/' -f2 | uniq | grep gf) %description Open source process design kit for usage with Global Foundry's 180nm node. %{lua: for target in string.gmatch(rpm.expand("%{build_targets}"), "[%w_-]+") do print("%package "..target.."\n") print("Summary: PDK library for "..target.."\n") print("Requires: open-pdk-globalfoundries\n\n") print("%description "..target.."\n") print("PDK library for "..target.." parts.\n") print("\n") end } %prep %setup -T -c -n %{name} rm -rf %{_builddir}/%{name}/* git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git log --format=fuller %build # fetch PDK git submodule sync list=$(cat .gitmodules | grep submodule | awk -F'\"' '{print $2}' | grep libraries) for lib in $(echo "$list" | cut -d'/' -f2 | uniq) do submodule=$(echo "$list" | grep -v latest | grep "\/$lib\/" | sort -r -n | head -n 1) git submodule init $submodule done # clone submodules git submodule update --depth 1 %if 0%{?fedora} # sphinx missing plugins sed -i '/sphinx_symbiflow_theme/d' docs/conf.py sed -i 's|sphinxcontrib.rsvgconverter|sphinx.ext.imgconverter|g' docs/conf.py # build docs sphinx-build -M latexpdf docs pdf sphinx-build -M html docs html %endif %install mkdir -p %{buildroot}/%{_datadir}/%{name}/libraries find libraries -empty -type d -delete mv -f libraries %{buildroot}/%{_datadir}/%{name}/ find macros -empty -type d -delete mv -f macros %{buildroot}/%{_datadir}/%{name}/ # alias with latest symlink for d in $(find %{buildroot}/%{_datadir}/%{name}/*/*/ -mindepth 1 -maxdepth 1 -type d) do if [ "$(basename $d)" != "latest" ]; then pushd $(dirname $d) ln -sf $(basename $d) latest popd fi done %files %doc README.* %if 0%{?fedora} %doc html/html %doc pdf/latex/*.pdf %else %doc docs %endif %license LICENSE %{lua: for target in string.gmatch(rpm.expand("%{build_targets}"), "[%w_-]+") do print("%files "..target.."\n") print(rpm.expand("%{_datadir}/%{name}/*/")..target.."/*\n\n") end } %changelog * Wed Oct 05 2022 Cristian Balint - github update releases