From 1ce08c0fc7d5b59e50b51c01ef8731ce1880ffc8 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Tue, 2 Feb 2021 17:28:38 -0500 Subject: [ngspice] build codemodel extension libraries (#15882) * [ngspice] build codemodel extension libraries * tabs -> spaces * [ngspice] make codemodels a feature * [ngspice] Improve portfile.cmake * update version record Co-authored-by: JackBoosY --- ports/ngspice/CONTROL | 5 ++ ports/ngspice/portfile.cmake | 68 ++++++++++++++++++++-------- ports/ngspice/use-winbison-global.patch | 19 -------- ports/ngspice/use-winbison-sharedspice.patch | 19 ++++++++ ports/ngspice/use-winbison-vngspice.patch | 50 ++++++++++++++++++++ versions/baseline.json | 2 +- versions/n-/ngspice.json | 5 ++ 7 files changed, 128 insertions(+), 40 deletions(-) delete mode 100644 ports/ngspice/use-winbison-global.patch create mode 100644 ports/ngspice/use-winbison-sharedspice.patch create mode 100644 ports/ngspice/use-winbison-vngspice.patch diff --git a/ports/ngspice/CONTROL b/ports/ngspice/CONTROL index 52d04f3aa..c11036c4b 100644 --- a/ports/ngspice/CONTROL +++ b/ports/ngspice/CONTROL @@ -1,5 +1,10 @@ Source: ngspice Version: 33 +Port-Version: 1 Homepage: http://ngspice.sourceforge.net/ Description: Ngspice is a mixed-level/mixed-signal electronic circuit simulator. It is a successor of the latest stable release of Berkeley SPICE Supports: !(linux|osx|arm|uwp) +Default-Features: codemodels + +Feature: codemodels +Description: Adds optional code models for XSPICE, ADMS (verilog integration) and B-/E-/G- sources. diff --git a/ports/ngspice/portfile.cmake b/ports/ngspice/portfile.cmake index 538a02f5e..1c85e1133 100644 --- a/ports/ngspice/portfile.cmake +++ b/ports/ngspice/portfile.cmake @@ -12,7 +12,8 @@ vcpkg_from_sourceforge( FILENAME "ngspice-33.tar.gz" SHA512 895e39f7de185df18bf443a9fa5691cdb3bf0a5091d9860d20ccb02254ef396a4cca5a1c8bf4ba19a03783fc89bb86649218cee977b0fe4565d3c84548943c09 PATCHES - use-winbison-global.patch + use-winbison-sharedspice.patch + use-winbison-vngspice.patch ) vcpkg_find_acquire_program(BISON) @@ -20,33 +21,60 @@ vcpkg_find_acquire_program(BISON) get_filename_component(BISON_DIR "${BISON}" DIRECTORY) vcpkg_add_to_path(PREPEND "${BISON_DIR}") -# Ensure its windows -if (VCPKG_TARGET_IS_WINDOWS) - # Sadly, vcpkg globs .libs inside install_msbuild and whines that the 47 year old SPICE format isn't a MSVC lib ;) - # We need to kill them off first before the source tree is copied to a tmp location by install_msbuild +# Sadly, vcpkg globs .libs inside install_msbuild and whines that the 47 year old SPICE format isn't a MSVC lib ;) +# We need to kill them off first before the source tree is copied to a tmp location by install_msbuild - file(REMOVE_RECURSE ${SOURCE_PATH}/contrib) - file(REMOVE_RECURSE ${SOURCE_PATH}/examples) - file(REMOVE_RECURSE ${SOURCE_PATH}/man) - file(REMOVE_RECURSE ${SOURCE_PATH}/tests) +file(REMOVE_RECURSE ${SOURCE_PATH}/contrib) +file(REMOVE_RECURSE ${SOURCE_PATH}/examples) +file(REMOVE_RECURSE ${SOURCE_PATH}/man) +file(REMOVE_RECURSE ${SOURCE_PATH}/tests) - vcpkg_install_msbuild( - SOURCE_PATH ${SOURCE_PATH} +# this builds the main dll +vcpkg_install_msbuild( + SOURCE_PATH ${SOURCE_PATH} + INCLUDES_SUBPATH /src/include + LICENSE_SUBPATH COPYING + # install_msbuild swaps x86 for win32(bad) if we dont force our own setting + PLATFORM ${TRIPLET_SYSTEM_ARCH} + PROJECT_SUBPATH visualc/sharedspice.sln + TARGET Build +) + +if("codemodels" IN_LIST FEATURES) + # vngspice generates "codemodels" to enhance simulation capabilities + # we cannot use install_msbuild as they output with ".cm" extensions on purpose + set(BUILDTREE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}) + file(REMOVE_RECURSE ${BUILDTREE_PATH}) + file(COPY ${SOURCE_PATH}/ DESTINATION ${BUILDTREE_PATH}) + + vcpkg_build_msbuild( + PROJECT_PATH ${BUILDTREE_PATH}/visualc/vngspice.sln INCLUDES_SUBPATH /src/include LICENSE_SUBPATH COPYING - # install_msbuild swaps x86 for win32(bad) if we dont force our own setting + # build_msbuild swaps x86 for win32(bad) if we dont force our own setting PLATFORM ${TRIPLET_SYSTEM_ARCH} - PROJECT_SUBPATH visualc/sharedspice.sln TARGET Build ) -else() - message(FATAL_ERROR "Sorry but ngspice only can be built in Windows") + + #put the code models in the intended location + file(GLOB NGSPICE_CODEMODELS_DEBUG + ${BUILDTREE_PATH}/visualc/codemodels/${TRIPLET_SYSTEM_ARCH}/Debug/*.cm + ) + file(COPY ${NGSPICE_CODEMODELS_DEBUG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/ngspice) + + file(GLOB NGSPICE_CODEMODELS_RELEASE + ${BUILDTREE_PATH}/visualc/codemodels/${TRIPLET_SYSTEM_ARCH}/Release/*.cm + ) + file(COPY ${NGSPICE_CODEMODELS_RELEASE} DESTINATION ${CURRENT_PACKAGES_DIR}/lib/ngspice) + + + # copy over spinit (spice init) + file(RENAME ${BUILDTREE_PATH}/visualc/spinit_all ${BUILDTREE_PATH}/visualc/spinit) + file(COPY ${BUILDTREE_PATH}/visualc/spinit DESTINATION ${CURRENT_PACKAGES_DIR}/share/ngspice) endif() +vcpkg_copy_pdbs() + # Unforunately install_msbuild isn't able to dual include directories that effectively layer -file(GLOB NGSPICE_INCLUDES - ${SOURCE_PATH}/visualc/src/include/ngspice/* -) +file(GLOB NGSPICE_INCLUDES ${SOURCE_PATH}/visualc/src/include/ngspice/*) file(COPY ${NGSPICE_INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/ngspice) - -vcpkg_copy_pdbs() diff --git a/ports/ngspice/use-winbison-global.patch b/ports/ngspice/use-winbison-global.patch deleted file mode 100644 index c345e9839..000000000 --- a/ports/ngspice/use-winbison-global.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/visualc/sharedspice.vcxproj b/visualc/sharedspice.vcxproj -index 4ff0dfc..57b0c35 100644 ---- a/visualc/sharedspice.vcxproj -+++ b/visualc/sharedspice.vcxproj -@@ -2223,12 +2223,12 @@ - - - invoke win_bison.exe for %(Identity) -- ..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 -+ win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 - .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h - - - invoke win_bison.exe for %(Identity) -- ..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 -+ win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 - .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h - - diff --git a/ports/ngspice/use-winbison-sharedspice.patch b/ports/ngspice/use-winbison-sharedspice.patch new file mode 100644 index 000000000..c345e9839 --- /dev/null +++ b/ports/ngspice/use-winbison-sharedspice.patch @@ -0,0 +1,19 @@ +diff --git a/visualc/sharedspice.vcxproj b/visualc/sharedspice.vcxproj +index 4ff0dfc..57b0c35 100644 +--- a/visualc/sharedspice.vcxproj ++++ b/visualc/sharedspice.vcxproj +@@ -2223,12 +2223,12 @@ + + + invoke win_bison.exe for %(Identity) +- ..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 ++ win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 + .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h + + + invoke win_bison.exe for %(Identity) +- ..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 ++ win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 + .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h + + diff --git a/ports/ngspice/use-winbison-vngspice.patch b/ports/ngspice/use-winbison-vngspice.patch new file mode 100644 index 000000000..008bc686d --- /dev/null +++ b/ports/ngspice/use-winbison-vngspice.patch @@ -0,0 +1,50 @@ +diff --git a/visualc/vngspice.vcxproj b/visualc/vngspice.vcxproj +index 2d1aa81..cf0f0c7 100644 +--- a/visualc/vngspice.vcxproj ++++ b/visualc/vngspice.vcxproj +@@ -2681,12 +2681,12 @@ + + + invoke win_bison.exe for %(Identity) +- ..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 ++ win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 + .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h + + + invoke win_bison.exe for %(Identity) +- ..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 ++ win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 + .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h + + +diff --git a/visualc/xspice/cmpp/cmpp.vcxproj b/visualc/xspice/cmpp/cmpp.vcxproj +index 78607a3..7bcc1a4 100644 +--- a/visualc/xspice/cmpp/cmpp.vcxproj ++++ b/visualc/xspice/cmpp/cmpp.vcxproj +@@ -157,22 +157,22 @@ + + + invoke win_flex.exe for %(Identity) +- ..\..\..\..\flex-bison\win_flex.exe --outfile=.\tmp-bison\%(Filename).c --header-file=.\tmp-bison\%(Filename).h %(Identity) || exit 1 ++ win_flex.exe --outfile=.\tmp-bison\%(Filename).c --header-file=.\tmp-bison\%(Filename).h %(Identity) || exit 1 + .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h + + + invoke win_bison.exe for %(Identity) +- ..\..\..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 ++ win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 + .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h + + + invoke win_flex.exe for %(Identity) +- ..\..\..\..\flex-bison\win_flex.exe --outfile=.\tmp-bison\%(Filename).c --header-file=.\tmp-bison\%(Filename).h %(Identity) || exit 1 ++ win_flex.exe --outfile=.\tmp-bison\%(Filename).c --header-file=.\tmp-bison\%(Filename).h %(Identity) || exit 1 + .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h + + + invoke win_bison.exe for %(Identity) +- ..\..\..\..\flex-bison\win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 ++ win_bison.exe --output=.\tmp-bison\%(Filename).c --defines=.\tmp-bison\%(Filename).h %(Identity) || exit 1 + .\tmp-bison\%(Filename).c;.\tmp-bison\%(Filename).h + + diff --git a/versions/baseline.json b/versions/baseline.json index 3832e0b3a..5445b0e9a 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4022,7 +4022,7 @@ }, "ngspice": { "baseline": "33", - "port-version": 0 + "port-version": 1 }, "nifticlib": { "baseline": "2020-04-30", diff --git a/versions/n-/ngspice.json b/versions/n-/ngspice.json index b34cb7d92..6e2f4a819 100644 --- a/versions/n-/ngspice.json +++ b/versions/n-/ngspice.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "ff27e9605199ca4134c1ab3fa6bcb311096a0e10", + "version-string": "33", + "port-version": 1 + }, { "git-tree": "90c388f47ca769fd11449fde9d70402e9865a986", "version-string": "33", -- cgit v1.2.3