%global pkgvers 0 %global scdate0 20241130 %global schash0 ce706d579de8d370994fb3d3eb1a469d98707866 %global branch0 master %global source0 https://github.com/verilog-to-routing/vtr-verilog-to-routing.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} Name: vtr Version: %(curl -s https://raw.githubusercontent.com/verilog-to-routing/vtr-verilog-to-routing/%{schash0}/CMakeLists.txt | grep -e "MAJOR " -e "MINOR " -e "PATCH " | sed 's/[^[:digit:].-]//g' | sed ':a;N;$!ba;s/\n/./g') Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: Verilog to Routing License: MIT URL: https://verilogtorouting.org BuildRequires: git cmake pkg-config wget tcl python3 BuildRequires: flex bison tbb-devel zlib-devel eigen3-devel tcl-devel libffi-devel BuildRequires: capnproto capnproto-devel pugixml-devel abc-devel readline-devel %global toolchain gcc %if "%{toolchain}" == "gcc" %if 0%{?rhel} == 8 BuildRequires: gcc-toolset-11-gcc-c++ %undefine _annotated_build %else BuildRequires: gcc-c++ %endif %else BuildRequires: clang %endif %global __cmake_in_source_build 1 %description The Verilog-to-Routing (VTR) project is a world-wide collaborative effort to provide a open-source framework for conducting FPGA architecture and CAD research and development. %package static Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} Requires: pkgconfig %description static This package contains the header files and libraries for %{name} %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} Requires: pkgconfig %description devel This package contains the header files and libraries for %{name} %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git submodule update --init --depth 1 libs/EXTERNAL/sockpp git submodule update --init --depth 1 libs/EXTERNAL/libcatch2 git log --format=fuller # external pugixml rm -rf libs/EXTERNAL/libpugixml sed -i '/pugixml/d' libs/EXTERNAL/CMakeLists.txt sed -i '/target_compile_options(libpugixml/d' CMakeLists.txt sed -i 's|libpugixml|pugixml|' vpr/CMakeLists.txt sed -i 's|libpugixml|pugixml|' parmys/CMakeLists.txt sed -i 's|libpugixml|pugixml|' utils/fasm/CMakeLists.txt sed -i 's|libpugixml|pugixml|' libs/libarchfpga/CMakeLists.txt sed -i 's|libpugixml|pugixml|' libs/libpugiutil/CMakeLists.txt # external capnproto rm -rf libs/EXTERNAL/capnproto sed -i '/ENABLE_CAPNP/,/^endif/d' libs/EXTERNAL/CMakeLists.txt sed -i '1i find_package(CapnProto REQUIRED)' libs/CMakeLists.txt # external abc rm -rf abc sed -i '/add_subdirectory(abc)/d' CMakeLists.txt sed -i '/TARGET libabc/d' CMakeLists.txt sed -i '/(abc/d' CMakeLists.txt sed -i '/(libabc/d' CMakeLists.txt # fix catch2 sed -i 's|-Werror||g' libs/EXTERNAL/libcatch2/CMake/CatchMiscFunctions.cmake sed -i 's|libabc|abc|' ace2/CMakeLists.txt sed -i 's|-D__STDC_FORMAT_MACROS|-D__STDC_FORMAT_MACROS -fpermissive|' ace2/CMakeLists.txt # statics sed -i 's|add_library(fasm|add_library(fasm STATIC|g' utils/fasm/CMakeLists.txt # builtin static thirdparty sed -i '1i set(BUILD_STATIC_LIBS ON)' libs/EXTERNAL/libezgl/CMakeLists.txt sed -i '1i set(BUILD_SHARED_LIBS OFF)' libs/EXTERNAL/libezgl/CMakeLists.txt # no clang sed -i 's|CONFIG := clang|CONFIG := gcc|' yosys/Makefile %build mkdir build pushd build %if 0%{?rhel} == 8 source scl_source enable gcc-toolset-11 %endif %global optflags %(echo "%{optflags} -I%{_includedir}/abc -fPIC -w -fpermissive") %cmake .. \ -DCMAKE_VERBOSE=OFF \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DEXTERNAL_CAPNP=ON \ -DCAPNP_INCLUDE_DIRECTORY=%{_includedir} \ -DCAPNP_EXECUTABLE=%{_bindir}/capnp \ -DCAPNP_CXX_EXECUTABLE=%{_bindir}/capnp++ \ -DWITH_PARMYS=OFF make V=0 %{?_smp_mflags} popd %install pushd build %cmake_install popd # clean spurious rm -rf %{buildroot}/%{_bindir}/*.a rm -rf %{buildroot}/%{_libdir}/libsockpp.a rm -rf %{buildroot}/%{_libdir}/cmake/sockpp rm -rf %{buildroot}/%{_includedir}/liblog rm -rf %{buildroot}/%{_includedir}/libpugiutil %files %doc doc %doc README.md %license LICENSE.md %{_bindir}/* %{_datadir}/* %files devel %{_includedir}/* %changelog * Sun Dec 05 2021 Cristian Balint - update github releases