diff options
author | Xiretza | 2022-06-11 18:37:47 +0200 |
---|---|---|
committer | Xiretza | 2022-06-11 18:38:04 +0200 |
commit | 197aa6e6fde782fe34e2acf587baa531c1c6a238 (patch) | |
tree | f1bad9edf909845d3084ae52fa4fc51f731501fd | |
parent | c38320f53cb1fec23056ac1b97a02efb41fab058 (diff) | |
download | aur-197aa6e6fde782fe34e2acf587baa531c1c6a238.tar.gz |
Update patches
-rw-r--r-- | .SRCINFO | 34 | ||||
-rw-r--r-- | 0001-cmake-install-parse_fasm.so.patch | 40 | ||||
-rw-r--r-- | 0002-cmake-install-tags.py-properly.patch (renamed from 0007-cmake-install-tags.py-properly.patch) | 13 | ||||
-rw-r--r-- | 0003-cmake-use-native-antlr.patch | 27 | ||||
-rw-r--r-- | 0003-fix-setup.py-compute-install-directory-before-outsid.patch | 58 | ||||
-rw-r--r-- | 0004-cmake-install-parse_fasm.so.patch | 24 | ||||
-rw-r--r-- | 0004-setup.py-don-t-build-everything-twice.patch | 38 | ||||
-rw-r--r-- | 0005-cmake-allow-overriding-ANTLR_EXECUTABLE.patch | 26 | ||||
-rw-r--r-- | 0006-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch | 266 | ||||
-rw-r--r-- | 0006-cmake-explicitly-link-test-with-gtest.patch (renamed from 0005-fix-cmake-fix-missing-gtest-linker-argument.patch) | 14 | ||||
-rw-r--r-- | 0007-ANTLR4-4.10-compatibility.patch (renamed from 0001-ANTLR4-4.10-compatibility.patch) | 4 | ||||
-rw-r--r-- | 0008-cmake-use-native-gtest.patch (renamed from 0002-cmake-use-native-gtest.patch) | 6 | ||||
-rw-r--r-- | 0009-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch | 32 | ||||
-rw-r--r-- | PKGBUILD | 34 |
14 files changed, 253 insertions, 363 deletions
@@ -1,7 +1,7 @@ pkgbase = python-fasm-git pkgdesc = FPGA Assembly (FASM) Parser and Generation library pkgver = 0.0.2.r98.g9a73d70 - pkgrel = 2 + pkgrel = 3 url = https://github.com/SymbiFlow/fasm arch = x86_64 license = ISC @@ -20,21 +20,25 @@ pkgbase = python-fasm-git conflicts = python-fasm source = git+https://github.com/SymbiFlow/fasm.git source = FindANTLR.cmake - source = 0001-ANTLR4-4.10-compatibility.patch - source = 0002-cmake-use-native-gtest.patch - source = 0003-cmake-use-native-antlr.patch - source = 0004-cmake-install-parse_fasm.so.patch - source = 0005-fix-cmake-fix-missing-gtest-linker-argument.patch - source = 0006-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch - source = 0007-cmake-install-tags.py-properly.patch + source = 0001-cmake-install-parse_fasm.so.patch + source = 0002-cmake-install-tags.py-properly.patch + source = 0003-fix-setup.py-compute-install-directory-before-outsid.patch + source = 0004-setup.py-don-t-build-everything-twice.patch + source = 0005-cmake-allow-overriding-ANTLR_EXECUTABLE.patch + source = 0006-cmake-explicitly-link-test-with-gtest.patch + source = 0007-ANTLR4-4.10-compatibility.patch + source = 0008-cmake-use-native-gtest.patch + source = 0009-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch sha256sums = SKIP sha256sums = ff8bb6b28f8e4724aeac01526ea7fa193f4bfa979de24ac99dbae92ee7116488 - sha256sums = d70b631453501e731e63cfa21d24c12386a2e3343631b5e4e7edbba2f4dc7ace - sha256sums = 66404ae75ab1e761bcf22de598e76882cc52cad57a95368e751b8a078ecca9ce - sha256sums = 8c973830b1309fa636e101ce520d7d617adf09364ca86b5c8a5111b1597fb57f - sha256sums = aff2f899aa8bc8b9b93d48430c63d97012c1d53b41106b2f4294e8dbcacb0110 - sha256sums = 6be3cebb42c8f40359c7b0d5bbbaba0434920ba21276ee78dc362e7084739d03 - sha256sums = 24b86a0575317b2349ec4ae488592f949995d5e9cabbf0bc41b2d133a91c6591 - sha256sums = 8f4b57b2bbbfa601b53003489a786ee889db00b92f67a34356e7efcaa7b83683 + sha256sums = e9ce35a0a8d36fbc1f136bd80a4a2b1b590bd8020a03ce39fba9101c7ae3511b + sha256sums = b202854f6063fac816f8108ee898fa77b177a065ec73977e23be3088c2c1e40e + sha256sums = 19d6200bd03522381d50c5092058bfb875d20e86a30f1e1740ebad266d883c2d + sha256sums = 8d17a72da87b324fc3b9cb5b3fff107bfe65320189739bc83a1de3891647ba30 + sha256sums = 6ce39a0f2d3897985f14c96ea99e0fe549bb70b7b49249b7cccccc8eedd99166 + sha256sums = 2d467f16e09af1af873d1d2605e8bbf382df9ae437c04f195c7e756bd309e3e3 + sha256sums = a21e0f26da7d481399b009e1d29d37c8969fbc73c80eebe20ec3f2f6696b9752 + sha256sums = 07d774fe24431ad1f3b3bedd596a7f37611fa8a5204aab7c690a7f90f97bd760 + sha256sums = 58c880e4074c0307f9d2837fdf9de2fbd68c39c472729190f95f28016e2463dc pkgname = python-fasm-git diff --git a/0001-cmake-install-parse_fasm.so.patch b/0001-cmake-install-parse_fasm.so.patch new file mode 100644 index 000000000000..baa44d3d462f --- /dev/null +++ b/0001-cmake-install-parse_fasm.so.patch @@ -0,0 +1,40 @@ +From fe1738eb6e1c58b4994ffb72c4742864be87fbc0 Mon Sep 17 00:00:00 2001 +From: Xiretza <xiretza@xiretza.xyz> +Date: Sat, 4 Jun 2022 11:32:59 +0200 +Subject: [PATCH 1/9] cmake: install parse_fasm.so + +Signed-off-by: Xiretza <xiretza@xiretza.xyz> +--- + setup.py | 3 +-- + src/CMakeLists.txt | 1 + + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/setup.py b/setup.py +index cfbaa55..0a1b5a3 100644 +--- a/setup.py ++++ b/setup.py +@@ -168,8 +168,7 @@ class AntlrCMakeBuild(build_ext): + os.path.dirname(self.get_ext_fullpath(ext.name))), + ext.prefix) + cmake_args = [ +- '-DCMAKE_INSTALL_PREFIX=' + extdir, +- '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, ++ '-DCMAKE_INSTALL_PREFIX=' + extdir, '-DCMAKE_INSTALL_LIBDIR=.', + '-DPYTHON_EXECUTABLE=' + sys.executable, + '-DANTLR_RUNTIME_TYPE=' + shared_options.antlr_runtime + ] +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 94783a6..2fdc164 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -97,6 +97,7 @@ add_library(parse_fasm SHARED ParseFasm.cpp + ${ANTLR_FasmLexer_CXX_OUTPUTS} + ${ANTLR_FasmParser_CXX_OUTPUTS}) + target_link_libraries(parse_fasm ${ANTLR4_RUNTIME}) ++install(TARGETS parse_fasm) + #target_compile_options(parse_fasm PRIVATE -Wno-attributes) # Disable warning from antlr4-runtime + + add_executable(parse_fasm_tests +-- +2.36.1 + diff --git a/0007-cmake-install-tags.py-properly.patch b/0002-cmake-install-tags.py-properly.patch index 9c7ea1f35861..a19cbafd4eb1 100644 --- a/0007-cmake-install-tags.py-properly.patch +++ b/0002-cmake-install-tags.py-properly.patch @@ -1,17 +1,18 @@ -From 30c905970e06caf9bb4b8211d759d6107f863ca0 Mon Sep 17 00:00:00 2001 +From 9522bc49bedac337d79866bdf5dc0828da0d972c Mon Sep 17 00:00:00 2001 From: Xiretza <xiretza@xiretza.xyz> Date: Sat, 4 Jun 2022 19:35:34 +0200 -Subject: [PATCH 7/7] cmake: install tags.py properly +Subject: [PATCH 2/9] cmake: install tags.py properly +Signed-off-by: Xiretza <xiretza@xiretza.xyz> --- src/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 63502e5..8d3564f 100644 +index 2fdc164..596949d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -76,13 +76,15 @@ antlr_target(FasmParser antlr/FasmParser.g4 PARSER VISITOR +@@ -80,13 +80,15 @@ antlr_target(FasmParser antlr/FasmParser.g4 PARSER VISITOR # line 1: Skip lines starting in #define # 2: Extract TAGS(...) from dependencies # 3: Convert from TAGS('c', long_name) -> long_name = b'c, write to file @@ -25,11 +26,11 @@ index 63502e5..8d3564f 100644 VERBATIM ) +add_custom_target(tags_py ALL DEPENDS tags.py) -+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tags.py DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tags.py TYPE LIB) # Include generated files in project environment include_directories(${ANTLR_FasmLexer_OUTPUT_DIR}) -@@ -120,5 +122,3 @@ include(CTest) +@@ -123,5 +125,3 @@ include(CTest) add_test(NAME parse_fasm_tests COMMAND parse_fasm_tests) enable_testing() diff --git a/0003-cmake-use-native-antlr.patch b/0003-cmake-use-native-antlr.patch deleted file mode 100644 index 5c9c1ecd3967..000000000000 --- a/0003-cmake-use-native-antlr.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 501df447d4d3c7f4e22f4fec43b4915b8de2013c Mon Sep 17 00:00:00 2001 -From: Xiretza <xiretza@xiretza.xyz> -Date: Sat, 4 Jun 2022 11:32:32 +0200 -Subject: [PATCH 3/7] cmake: use native antlr - ---- - src/CMakeLists.txt | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index caf428a..f4b5b1f 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -55,10 +55,6 @@ endif() - # add antrl4cpp artifacts to project environment - include_directories(${ANTLR4_INCLUDE_DIRS}) - --# set variable pointing to the antlr tool that supports C++ --# this is not required if the jar file can be found under PATH environment --set(ANTLR_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/antlr4_lib/antlr-4.9.3-complete.jar) -- - # add macros to generate ANTLR Cpp code from grammar - find_package(ANTLR REQUIRED) - --- -2.36.1 - diff --git a/0003-fix-setup.py-compute-install-directory-before-outsid.patch b/0003-fix-setup.py-compute-install-directory-before-outsid.patch new file mode 100644 index 000000000000..5bbf3a5fb747 --- /dev/null +++ b/0003-fix-setup.py-compute-install-directory-before-outsid.patch @@ -0,0 +1,58 @@ +From db3b3fc2241005329e02a549ada1a0f099bf070a Mon Sep 17 00:00:00 2001 +From: Xiretza <xiretza@xiretza.xyz> +Date: Sat, 11 Jun 2022 17:50:59 +0200 +Subject: [PATCH 3/9] fix(setup.py): compute install directory before outside + build_extension + +This fixes builds with `setup.py develop`/`pip install -e`. + +build_ext.run() unsets build_ext.inplace before running +build_extension(), and only restores it before calling +copy_extensions_to_source(). Because the cmake extension has to know the +real install directory in build_extension(), we need to compute it +before calling build_ext.run() and then retrieve it in build_extension(). + +Signed-off-by: Xiretza <xiretza@xiretza.xyz> +--- + setup.py | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/setup.py b/setup.py +index 0a1b5a3..3c783ae 100644 +--- a/setup.py ++++ b/setup.py +@@ -108,6 +108,19 @@ class AntlrCMakeBuild(build_ext): + def run(self): + shared_options.load(self) + try: ++ # We need to compute the install directory here, because ++ # build_ext.run() unsets build_ext.inplace while running ++ # build_extension(). This means that files would be installed ++ # to the wrong location (to the temporary build directory) ++ # for `setup.py develop`/`pip install -e` builds. ++ self.install_dirs = {} ++ for ext in self.extensions: ++ if isinstance(ext, CMakeExtension): ++ self.install_dirs[ext] = os.path.join( ++ os.path.abspath( ++ os.path.dirname(self.get_ext_fullpath(ext.name))), ++ ext.prefix) ++ + super().run() + + try: +@@ -163,10 +176,7 @@ class AntlrCMakeBuild(build_ext): + + def build_extension(self, ext): + if isinstance(ext, CMakeExtension): +- extdir = os.path.join( +- os.path.abspath( +- os.path.dirname(self.get_ext_fullpath(ext.name))), +- ext.prefix) ++ extdir = self.install_dirs[ext] + cmake_args = [ + '-DCMAKE_INSTALL_PREFIX=' + extdir, '-DCMAKE_INSTALL_LIBDIR=.', + '-DPYTHON_EXECUTABLE=' + sys.executable, +-- +2.36.1 + diff --git a/0004-cmake-install-parse_fasm.so.patch b/0004-cmake-install-parse_fasm.so.patch deleted file mode 100644 index bf1181458736..000000000000 --- a/0004-cmake-install-parse_fasm.so.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 36b8c46b10a4f823754e4adfb388fcd2907098e7 Mon Sep 17 00:00:00 2001 -From: Xiretza <xiretza@xiretza.xyz> -Date: Sat, 4 Jun 2022 11:32:59 +0200 -Subject: [PATCH 4/7] cmake: install parse_fasm.so - ---- - src/CMakeLists.txt | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index f4b5b1f..b95872e 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -93,6 +93,7 @@ add_library(parse_fasm SHARED ParseFasm.cpp - ${ANTLR_FasmLexer_CXX_OUTPUTS} - ${ANTLR_FasmParser_CXX_OUTPUTS}) - target_link_libraries(parse_fasm ${ANTLR4_RUNTIME}) -+install(TARGETS parse_fasm) - #target_compile_options(parse_fasm PRIVATE -Wno-attributes) # Disable warning from antlr4-runtime - - add_executable(parse_fasm_tests --- -2.36.1 - diff --git a/0004-setup.py-don-t-build-everything-twice.patch b/0004-setup.py-don-t-build-everything-twice.patch new file mode 100644 index 000000000000..83d2201524d5 --- /dev/null +++ b/0004-setup.py-don-t-build-everything-twice.patch @@ -0,0 +1,38 @@ +From 7465af260ab4b09f95372e239120a8d664ff1c9c Mon Sep 17 00:00:00 2001 +From: Xiretza <xiretza@xiretza.xyz> +Date: Sat, 4 Jun 2022 20:42:09 +0200 +Subject: [PATCH 4/9] setup.py: don't build everything twice + +super().run() already builds all the extensions + +Signed-off-by: Xiretza <xiretza@xiretza.xyz> +--- + setup.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/setup.py b/setup.py +index 3c783ae..51b6dbb 100644 +--- a/setup.py ++++ b/setup.py +@@ -121,8 +121,6 @@ class AntlrCMakeBuild(build_ext): + os.path.dirname(self.get_ext_fullpath(ext.name))), + ext.prefix) + +- super().run() +- + try: + out = subprocess.check_output(['cmake', '--version']) + except OSError: +@@ -136,8 +134,7 @@ class AntlrCMakeBuild(build_ext): + if cmake_version < '3.7.0': + raise RuntimeError("CMake >= 3.7.0 is required.") + +- for ext in self.extensions: +- self.build_extension(ext) ++ super().run() + + except BaseException as e: + print( +-- +2.36.1 + diff --git a/0005-cmake-allow-overriding-ANTLR_EXECUTABLE.patch b/0005-cmake-allow-overriding-ANTLR_EXECUTABLE.patch new file mode 100644 index 000000000000..5cd974668e64 --- /dev/null +++ b/0005-cmake-allow-overriding-ANTLR_EXECUTABLE.patch @@ -0,0 +1,26 @@ +From 73d1d20595fc8a6915edcee77adb000790f345ec Mon Sep 17 00:00:00 2001 +From: Xiretza <xiretza@xiretza.xyz> +Date: Sat, 4 Jun 2022 20:46:44 +0200 +Subject: [PATCH 5/9] cmake: allow overriding ANTLR_EXECUTABLE + +Signed-off-by: Xiretza <xiretza@xiretza.xyz> +--- + src/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 596949d..92d7938 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -57,7 +57,7 @@ include_directories(${ANTLR4_INCLUDE_DIRS}) + + # set variable pointing to the antlr tool that supports C++ + # this is not required if the jar file can be found under PATH environment +-set(ANTLR_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/antlr4_lib/antlr-4.9.3-complete.jar) ++set(ANTLR_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/antlr4_lib/antlr-4.9.3-complete.jar CACHE PATH "antlr4 generator JAR file") + + # add macros to generate ANTLR Cpp code from grammar + find_package(ANTLR REQUIRED) +-- +2.36.1 + diff --git a/0006-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch b/0006-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch deleted file mode 100644 index c8e2b3432838..000000000000 --- a/0006-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch +++ /dev/null @@ -1,266 +0,0 @@ -From 52b71d6edc8ea90d29a5844191d7b386fed67c46 Mon Sep 17 00:00:00 2001 -From: Xiretza <xiretza@xiretza.xyz> -Date: Sat, 4 Jun 2022 11:33:46 +0200 -Subject: [PATCH 6/7] Use cmake directly instead of letting setup.py try to - handle it - ---- - setup.py | 226 +------------------------------------------------------ - 1 file changed, 1 insertion(+), 225 deletions(-) - -diff --git a/setup.py b/setup.py -index cfbaa55..8c0b3ee 100644 ---- a/setup.py -+++ b/setup.py -@@ -18,20 +18,10 @@ - # SPDX-License-Identifier: Apache-2.0 - - import os --import re - import setuptools --import shutil - import subprocess --import sys --import traceback - - from Cython.Build import cythonize --from distutils.command.build import build --from distutils.version import LooseVersion --from setuptools import Extension --from setuptools.command.build_ext import build_ext --from setuptools.command.develop import develop --from setuptools.command.install import install - - __dir__ = os.path.dirname(os.path.abspath(__file__)) - -@@ -56,212 +46,6 @@ assert version_value[0] == '"', version_value - assert version_value[-1] == '"', version_value - version = version_value[1:-1] - -- --# Based on: https://www.benjack.io/2018/02/02/python-cpp-revisited.html --# GitHub: https://github.com/benjaminjack/python_cpp_example --class CMakeExtension(Extension): -- def __init__(self, name, sourcedir='', prefix=''): -- Extension.__init__(self, name, sources=[]) -- self.sourcedir = os.path.abspath(sourcedir) -- self.prefix = prefix -- -- --# Used to share options between two classes. --class SharedOptions(): -- ANTLR_RUNTIMES = ['static', 'shared'] -- options = [ -- ( -- 'antlr-runtime=', None, -- "Whether to use a 'static' or 'shared' ANTLR runtime.") -- ] -- -- def __init__(self): -- self.antlr_runtime = 'static' -- -- def initialize(self, other): -- other.antlr_runtime = None -- -- def load(self, other): -- if other.antlr_runtime is not None: -- self.antlr_runtime = other.antlr_runtime -- assert self.antlr_runtime in SharedOptions.ANTLR_RUNTIMES, \ -- 'Invalid antlr_runtime {}, expected one of {}'.format( -- self.antlr_runtime, SharedOptions.ANTLR_RUNTIMES) -- -- --# Global to allow sharing options. --shared_options = SharedOptions() -- -- --class AntlrCMakeBuild(build_ext): -- user_options = SharedOptions.options -- -- def copy_extensions_to_source(self): -- original_extensions = list(self.extensions) -- self.extensions = [ -- ext for ext in self.extensions -- if not isinstance(ext, CMakeExtension) -- ] -- super().copy_extensions_to_source() -- self.extensions = original_extensions -- -- def run(self): -- shared_options.load(self) -- try: -- super().run() -- -- try: -- out = subprocess.check_output(['cmake', '--version']) -- except OSError: -- raise RuntimeError( -- "CMake must be installed to build " -- "the following extensions: " + ", ".join( -- e.name for e in self.extensions)) -- -- cmake_version = LooseVersion( -- re.search(r'version\s*([\d.]+)', out.decode()).group(1)) -- if cmake_version < '3.7.0': -- raise RuntimeError("CMake >= 3.7.0 is required.") -- -- for ext in self.extensions: -- self.build_extension(ext) -- -- except BaseException as e: -- print( -- "Failed to build ANTLR parser, " -- "falling back on slower textX parser. Error:\n", e) -- traceback.print_exc() -- -- # FIXME: Remove this function -- # see: https://github.com/chipsalliance/fasm/issues/50 -- def add_flags(self): -- if sys.platform.startswith('win'): -- return -- -- for flag in ["CFLAGS", "CXXFLAGS"]: -- flags = [os.environ.get(flag, "")] -- if not flags[0]: -- flags.pop(0) -- -- if shared_options.antlr_runtime == 'static': -- # When linking the ANTLR runtime statically, -fPIC is -- # still necessary because libparse_fasm will be a -- # shared library. -- flags.append("-fPIC") -- -- # FIXME: These should be in the cmake config file? -- # Disable excessive warnings currently in ANTLR runtime. -- # warning: type attributes ignored after type is already defined -- # `class ANTLR4CPP_PUBLIC ATN;` -- flags.append('-Wno-attributes') -- -- # Lots of implicit fallthroughs. -- # flags.append('-Wimplicit-fallthrough=0') -- -- if flags: -- os.environ[flag] = " ".join(flags) -- -- def build_extension(self, ext): -- if isinstance(ext, CMakeExtension): -- extdir = os.path.join( -- os.path.abspath( -- os.path.dirname(self.get_ext_fullpath(ext.name))), -- ext.prefix) -- cmake_args = [ -- '-DCMAKE_INSTALL_PREFIX=' + extdir, -- '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, -- '-DPYTHON_EXECUTABLE=' + sys.executable, -- '-DANTLR_RUNTIME_TYPE=' + shared_options.antlr_runtime -- ] -- -- cfg = 'Debug' if self.debug else 'Release' -- build_args = ['--config', cfg] -- cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] -- if not sys.platform.startswith('win') and ( -- os.environ.get("CMAKE_BUILD_PARALLEL_LEVEL") is None): -- build_args += ['--', '-j'] -- -- env = os.environ.copy() -- env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format( -- env.get('CXXFLAGS', ''), self.distribution.get_version()) -- -- # Remove the existing build_temp directory if it already exists. -- if os.path.exists(self.build_temp): -- shutil.rmtree(self.build_temp, ignore_errors=True) -- os.makedirs(self.build_temp, exist_ok=True) -- -- self.add_flags() -- -- subprocess.check_call( -- ['cmake', ext.sourcedir] + cmake_args, -- cwd=self.build_temp, -- env=env) -- subprocess.check_call( -- ['cmake', '--build', '.'] + build_args, cwd=self.build_temp) -- subprocess.check_call( -- ['cmake', '--install', '.'], cwd=self.build_temp) -- subprocess.check_call(['ctest'], cwd=self.build_temp) -- print() # Add an empty line for cleaner output -- else: -- super().build_extension(ext) -- -- def initialize_options(self): -- super().initialize_options() -- shared_options.initialize(self) -- -- def finalize_options(self): -- super().finalize_options() -- shared_options.load(self) -- -- --class BuildCommand(build): -- user_options = build.user_options + SharedOptions.options -- -- def initialize_options(self): -- super().initialize_options() -- shared_options.initialize(self) -- -- def finalize_options(self): -- super().finalize_options() -- shared_options.load(self) -- -- def run(self): -- shared_options.load(self) -- super().run() -- -- --class InstallCommand(install): -- user_options = install.user_options + SharedOptions.options -- -- def initialize_options(self): -- super().initialize_options() -- shared_options.initialize(self) -- -- def finalize_options(self): -- super().finalize_options() -- shared_options.load(self) -- -- def run(self): -- shared_options.load(self) -- super().run() -- -- --class DevelopCommand(develop): -- user_options = develop.user_options + SharedOptions.options -- -- def initialize_options(self): -- super().initialize_options() -- shared_options.initialize(self) -- -- def finalize_options(self): -- super().finalize_options() -- shared_options.load(self) -- -- def run(self): -- shared_options.load(self) -- super().run() -- -- - setuptools.setup( - name="fasm", - version=version, -@@ -282,13 +66,5 @@ setuptools.setup( - entry_points={ - 'console_scripts': ['fasm=fasm.tool:main'], - }, -- ext_modules=[ -- CMakeExtension('parse_fasm', sourcedir='src', prefix='fasm/parser') -- ] + cythonize("fasm/parser/antlr_to_tuple.pyx"), -- cmdclass={ -- 'build_ext': AntlrCMakeBuild, -- 'build': BuildCommand, -- 'develop': DevelopCommand, -- 'install': InstallCommand, -- }, -+ ext_modules=cythonize("fasm/parser/antlr_to_tuple.pyx"), - ) --- -2.36.1 - diff --git a/0005-fix-cmake-fix-missing-gtest-linker-argument.patch b/0006-cmake-explicitly-link-test-with-gtest.patch index 9bd22e6b4017..c8c5bf6ba744 100644 --- a/0005-fix-cmake-fix-missing-gtest-linker-argument.patch +++ b/0006-cmake-explicitly-link-test-with-gtest.patch @@ -1,17 +1,21 @@ -From 8f0cf99eba23b575616e45c43266145eaac77dd7 Mon Sep 17 00:00:00 2001 +From 9ebb73009ab9438d670fde2f441dcbff1047af1c Mon Sep 17 00:00:00 2001 From: Xiretza <xiretza@xiretza.xyz> -Date: Sat, 4 Jun 2022 11:33:13 +0200 -Subject: [PATCH 5/7] fix(cmake): fix missing gtest linker argument +Date: Sat, 4 Jun 2022 20:48:31 +0200 +Subject: [PATCH 6/9] cmake: explicitly link test with gtest +With external (distro) gtest, this avoids an error along the lines of +"DSO missing from command line". + +Signed-off-by: Xiretza <xiretza@xiretza.xyz> --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index b95872e..63502e5 100644 +index 92d7938..f407785 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -102,6 +102,7 @@ add_executable(parse_fasm_tests +@@ -108,6 +108,7 @@ add_executable(parse_fasm_tests ${ANTLR_FasmParser_CXX_OUTPUTS}) target_link_libraries(parse_fasm_tests ${ANTLR4_RUNTIME}) target_link_libraries(parse_fasm_tests gtest_main) diff --git a/0001-ANTLR4-4.10-compatibility.patch b/0007-ANTLR4-4.10-compatibility.patch index de89c5d9e39f..c2790d1763fb 100644 --- a/0001-ANTLR4-4.10-compatibility.patch +++ b/0007-ANTLR4-4.10-compatibility.patch @@ -1,7 +1,7 @@ -From 752ae3a73c5c5c17feacf896d269752956700c11 Mon Sep 17 00:00:00 2001 +From d760aa7784c28cb914e51f7f771652d2bbbd1d32 Mon Sep 17 00:00:00 2001 From: Xiretza <xiretza@xiretza.xyz> Date: Sat, 4 Jun 2022 10:47:32 +0200 -Subject: [PATCH 1/7] ANTLR4 4.10 compatibility +Subject: [PATCH 7/9] ANTLR4 4.10 compatibility Commit 70b2edcf98[0] removed antlrcpp::Any in favor of std::any. diff --git a/0002-cmake-use-native-gtest.patch b/0008-cmake-use-native-gtest.patch index a4e5901e4fa6..616a21a46ae3 100644 --- a/0002-cmake-use-native-gtest.patch +++ b/0008-cmake-use-native-gtest.patch @@ -1,14 +1,14 @@ -From e9d7442de4f0f52ce19629ccfe7ef036030f9669 Mon Sep 17 00:00:00 2001 +From c19b84ec3710584f56f670375971077de48573d6 Mon Sep 17 00:00:00 2001 From: Xiretza <xiretza@xiretza.xyz> Date: Sat, 4 Jun 2022 11:22:15 +0200 -Subject: [PATCH 2/7] cmake: use native gtest +Subject: [PATCH 8/9] cmake: use native gtest --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 94783a6..caf428a 100644 +index f407785..788864b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -63,7 +63,7 @@ set(ANTLR_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/antlr4_lib/antlr diff --git a/0009-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch b/0009-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch new file mode 100644 index 000000000000..48e27af24a7d --- /dev/null +++ b/0009-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch @@ -0,0 +1,32 @@ +From 707a34851772b3dbf71e5dd112b9757bb90ab21e Mon Sep 17 00:00:00 2001 +From: Xiretza <xiretza@xiretza.xyz> +Date: Sat, 4 Jun 2022 11:33:46 +0200 +Subject: [PATCH 9/9] Use cmake directly instead of letting setup.py try to + handle it + +--- + setup.py | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/setup.py b/setup.py +index 51b6dbb..d499a80 100644 +--- a/setup.py ++++ b/setup.py +@@ -288,13 +288,5 @@ setuptools.setup( + entry_points={ + 'console_scripts': ['fasm=fasm.tool:main'], + }, +- ext_modules=[ +- CMakeExtension('parse_fasm', sourcedir='src', prefix='fasm/parser') +- ] + cythonize("fasm/parser/antlr_to_tuple.pyx"), +- cmdclass={ +- 'build_ext': AntlrCMakeBuild, +- 'build': BuildCommand, +- 'develop': DevelopCommand, +- 'install': InstallCommand, +- }, ++ ext_modules=cythonize("fasm/parser/antlr_to_tuple.pyx"), + ) +-- +2.36.1 + @@ -3,7 +3,7 @@ _pkgname=fasm pkgname="python-$_pkgname-git" pkgver=0.0.2.r98.g9a73d70 -pkgrel=2 +pkgrel=3 pkgdesc="FPGA Assembly (FASM) Parser and Generation library" arch=(x86_64) url="https://github.com/SymbiFlow/fasm" @@ -16,23 +16,27 @@ conflicts=(fasm "${pkgname%%-git}") source=( "git+$url.git" "FindANTLR.cmake" - "0001-ANTLR4-4.10-compatibility.patch" - "0002-cmake-use-native-gtest.patch" - "0003-cmake-use-native-antlr.patch" - "0004-cmake-install-parse_fasm.so.patch" - "0005-fix-cmake-fix-missing-gtest-linker-argument.patch" - "0006-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch" - "0007-cmake-install-tags.py-properly.patch" + "0001-cmake-install-parse_fasm.so.patch" + "0002-cmake-install-tags.py-properly.patch" + "0003-fix-setup.py-compute-install-directory-before-outsid.patch" + "0004-setup.py-don-t-build-everything-twice.patch" + "0005-cmake-allow-overriding-ANTLR_EXECUTABLE.patch" + "0006-cmake-explicitly-link-test-with-gtest.patch" + "0007-ANTLR4-4.10-compatibility.patch" + "0008-cmake-use-native-gtest.patch" + "0009-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch" ) sha256sums=('SKIP' 'ff8bb6b28f8e4724aeac01526ea7fa193f4bfa979de24ac99dbae92ee7116488' - 'd70b631453501e731e63cfa21d24c12386a2e3343631b5e4e7edbba2f4dc7ace' - '66404ae75ab1e761bcf22de598e76882cc52cad57a95368e751b8a078ecca9ce' - '8c973830b1309fa636e101ce520d7d617adf09364ca86b5c8a5111b1597fb57f' - 'aff2f899aa8bc8b9b93d48430c63d97012c1d53b41106b2f4294e8dbcacb0110' - '6be3cebb42c8f40359c7b0d5bbbaba0434920ba21276ee78dc362e7084739d03' - '24b86a0575317b2349ec4ae488592f949995d5e9cabbf0bc41b2d133a91c6591' - '8f4b57b2bbbfa601b53003489a786ee889db00b92f67a34356e7efcaa7b83683') + 'e9ce35a0a8d36fbc1f136bd80a4a2b1b590bd8020a03ce39fba9101c7ae3511b' + 'b202854f6063fac816f8108ee898fa77b177a065ec73977e23be3088c2c1e40e' + '19d6200bd03522381d50c5092058bfb875d20e86a30f1e1740ebad266d883c2d' + '8d17a72da87b324fc3b9cb5b3fff107bfe65320189739bc83a1de3891647ba30' + '6ce39a0f2d3897985f14c96ea99e0fe549bb70b7b49249b7cccccc8eedd99166' + '2d467f16e09af1af873d1d2605e8bbf382df9ae437c04f195c7e756bd309e3e3' + 'a21e0f26da7d481399b009e1d29d37c8969fbc73c80eebe20ec3f2f6696b9752' + '07d774fe24431ad1f3b3bedd596a7f37611fa8a5204aab7c690a7f90f97bd760' + '58c880e4074c0307f9d2837fdf9de2fbd68c39c472729190f95f28016e2463dc') pkgver() { cd "$_pkgname" |