Skip to content

Commit

Permalink
Update recipe with upstream source
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlyanon committed Jan 17, 2022
1 parent 510cfc4 commit c1bc69b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 149 deletions.
49 changes: 2 additions & 47 deletions recipes/btyacc/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,8 @@
cmake_minimum_required(VERSION 3.1)

project(btyacc C)
project(btyacc_wrapper C)

include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_basic_setup(TARGETS)

# ---- btyacc executable ----

set(src "${PROJECT_SOURCE_DIR}")
set(bin "${PROJECT_BINARY_DIR}")
add_custom_command(
OUTPUT skeleton.c
COMMAND "${CMAKE_COMMAND}"
"-Dinput=${src}/btyaccpa.ske"
"-Doutput=${bin}/skeleton.c.tmp"
"-P${src}/cmake/skel2c.cmake"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${bin}/skeleton.c.tmp"
"${bin}/skeleton.c"
COMMAND "${CMAKE_COMMAND}" -E remove "${bin}/skeleton.c.tmp"
MAIN_DEPENDENCY btyaccpa.ske
DEPENDS cmake/skel2c.cmake
COMMENT "skel2c [btyaccpa.ske -> skeleton.c]"
VERBATIM
)

add_executable(
btyacc
closure.c
dtor.c
error.c
lalr.c
lr0.c
main.c
mkpar.c
output.c
mstring.c
reader.c
readskel.c
skeleton.c
symtab.c
verbose.c
warshall.c
"${bin}/skeleton.c"
)

target_include_directories(btyacc PRIVATE "${src}")

# ---- Install rules ----

include(GNUInstallDirs)
install(TARGETS btyacc RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
add_subdirectory(source_subfolder)
71 changes: 0 additions & 71 deletions recipes/btyacc/all/cmake/skel2c.cmake

This file was deleted.

8 changes: 2 additions & 6 deletions recipes/btyacc/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
sources:
"3.0":
sha256: "cf6ed1f9d23c5b07aeff19344427f9b16e37ba7589ca5bd79415a2773f62e324"
url: https://github.com/ChrisDodd/btyacc/archive/359a83496874b2e8525a457705d8db11ba1cdb99.zip
patches:
"3.0":
- patch_file: patches/0001-include-io-h-on-windows.patch
base_path: ""
sha256: "1e3fcb45cda0d3b05c4b681f9e0f58267869ec4039f9d7496108b4ee7abbaa53"
url: https://github.com/ChrisDodd/btyacc/archive/0dd183492c212696db5970bb2742e4e9d6a8b595.zip
21 changes: 12 additions & 9 deletions recipes/btyacc/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class BtyaccConan(ConanFile):
"fPIC": True,
}
generators = ("cmake",)
# FIXME: remove these once https://github.com/ChrisDodd/btyacc/pull/27 is
# merged and enable no_copy_source
exports_sources = ("patches/*", "CMakeLists.txt", "cmake/*.cmake")
# no_copy_source = True
exports_sources = ("CMakeLists.txt",)
no_copy_source = True

@property
def _source_subfolder(self):
return "source_subfolder"

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -35,7 +37,9 @@ def configure(self):
del self.settings.compiler.cppstd

def source(self):
tools.get(**self.conan_data["sources"][self.version], strip_root=True)
root = self._source_subfolder
get_args = self.conan_data["sources"][self.version]
tools.get(**get_args, destination=root, strip_root=True)

@functools.lru_cache(1)
def _configure_cmake(self):
Expand All @@ -44,14 +48,13 @@ def _configure_cmake(self):
return cmake

def build(self):
for patch in self.conan_data["patches"][self.version]:
tools.patch(**patch)
self._configure_cmake().build()

def package(self):
self.copy("README", "licenses")
self.copy("README.BYACC", "licenses")
self.copy("README", "licenses", self._source_subfolder)
self.copy("README.BYACC", "licenses", self._source_subfolder)
self._configure_cmake().install()
tools.rmdir(os.path.join(self.package_folder, "share"))

def package_info(self):
bindir = os.path.join(self.package_folder, "bin")
Expand Down
16 changes: 0 additions & 16 deletions recipes/btyacc/all/patches/0001-include-io-h-on-windows.patch

This file was deleted.

0 comments on commit c1bc69b

Please sign in to comment.