forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial implementation of gawk * Missing mpfr and grep dependencies Closes conan-io#16794
- Loading branch information
1 parent
26d618a
commit 661d8ae
Showing
4 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"5.2.1": | ||
url: "http://git.savannah.gnu.org/cgit/gawk.git/snapshot/gawk-5.2.1.tar.gz" | ||
sha256: "ee6faf7506746c2cc102211e03ca1fc5a79fec1a51076b6460bfdb984a97704d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.files import copy, get, collect_libs | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps | ||
import os | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
|
||
class GawkConan(ConanFile): | ||
name = "gawk" | ||
description = "A program that you can use to select particular records in a file and perform operations upon them. GNU implementation of awk" | ||
topics = ("file", "modification", "reformatting") | ||
homepage = "http://git.savannah.gnu.org/cgit/gawk.git" | ||
license = "GPL-3.0-only" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
package_type = "application" | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
@property | ||
def _settings_build(self): | ||
return getattr(self, "settings_build", self.settings) | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def package_id(self): | ||
del self.info.settings.compiler | ||
|
||
def compatibility(self): | ||
return [{"settings": [("build_type", "Release")]}] | ||
|
||
def validate(self): | ||
pass | ||
|
||
def requirements(self): | ||
#self.requires("mpfr/4.1.0") | ||
self.requires("gmp/6.2.1") | ||
|
||
if self.settings.os == "Macos": | ||
self.requires("readline/8.1.2") | ||
|
||
def build_requirements(self): | ||
if self._settings_build.os == "Windows": | ||
self.tool_requires("winflexbison/2.5.24") | ||
else: | ||
self.tool_requires("flex/2.6.4") | ||
self.tool_requires("bison/3.8.2") | ||
self.tool_requires("binutils/2.38") | ||
self.tool_requires("libtool/2.4.7") | ||
# self.tool_requires("grep/3.10") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
tc = AutotoolsToolchain(self) | ||
tc.configure_args.append(f"--with-gmp={self.dependencies['gmp'].package_folder}") | ||
#tc.configure_args.append(f"--with-mpc={self.dependencies['mpc'].package_folder}") | ||
#tc.configure_args.append(f"--with-mpfr={self.dependencies['mpfr'].package_folder}") | ||
|
||
if self.settings.os == "Macos": | ||
tc.configure_args.append(f"--with-readline={self.dependencies['readline'].package_folder}") | ||
|
||
tc.generate() | ||
|
||
deps = AutotoolsDeps(self) | ||
deps.generate() | ||
|
||
def build(self): | ||
autotools = Autotools(self) | ||
autotools.configure() | ||
autotools.make() | ||
|
||
def package(self): | ||
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) | ||
autotools = Autotools(self) | ||
autotools.install() | ||
|
||
def package_info(self): | ||
self.cpp_info.set_property("cmake_find_mode", "none") | ||
self.cpp_info.includedirs = ["include"] | ||
self.cpp_info.resdirs = ["share"] | ||
collect_libs(self) | ||
|
||
# TODO: to remove in conan v2 | ||
self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanException | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "VirtualBuildEnv" | ||
test_type = "explicit" | ||
|
||
def build_requirements(self): | ||
self.tool_requires(self.tested_reference_str) | ||
|
||
def test(self): | ||
self.output.info("Version:") | ||
self.run("awk --version", env="conanbuild") | ||
self.run("awk \'BEGIN {print ARGV[1]}\' \"Hello, World\"", env="conanbuild") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"5.2.1": | ||
folder: "all" |