-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
98 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: | ||
"1.11.12": | ||
url: "https://git.sr.ht/~sircmpwn/scdoc/archive/1.11.2.tar.gz" | ||
sha256: "e9ff9981b5854301789a6778ee64ef1f6d1e5f4829a9dd3e58a9a63eacc2e6f0" |
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,72 @@ | ||
from conans import ConanFile, AutoToolsBuildEnvironment, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import os | ||
|
||
required_conan_version = ">=1.33.0" | ||
|
||
|
||
class ScdocInstallerConan(ConanFile): | ||
name = "scdoc" | ||
description = "scdoc is a simple man page generator for POSIX systems written in C99." | ||
topics = ("manpage", "documentation", "posix") | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://git.sr.ht/~sircmpwn/scdoc" | ||
license = "MIT" | ||
settings = "os", "arch", "compiler", "build_type" | ||
_autotools = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
def build_requirements(self): | ||
self.build_requires("make/4.3") | ||
|
||
def configure(self): | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
|
||
def package_id(self): | ||
del self.info.settings.compiler | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], strip_root=True, | ||
destination=self._source_subfolder) | ||
|
||
@staticmethod | ||
def _chmod_plus_x(filename): | ||
if os.name == "posix": | ||
os.chmod(filename, os.stat(filename).st_mode | 0o111) | ||
|
||
def _configure_autotools(self): | ||
if self._autotools: | ||
return self._autotools | ||
self._autotools = AutoToolsBuildEnvironment(self) | ||
return self._autotools | ||
|
||
def build(self): | ||
autotools = self._configure_autotools() | ||
with tools.chdir(self._source_subfolder): | ||
autotools.make() | ||
|
||
def package(self): | ||
autotools = self._configure_autotools() | ||
with tools.chdir(self._source_subfolder): | ||
autotools.install(args=[f"PREFIX={self.package_folder}"]) | ||
self.copy(pattern="COPYING", dst="licenses", | ||
src=self._source_subfolder) | ||
tools.rmdir(os.path.join(self.package_folder, "share")) | ||
|
||
def package_info(self): | ||
self.cpp_info.libdirs = [] | ||
|
||
scdoc_root = os.path.join(self.package_folder, "bin") | ||
self.output.info( | ||
"Appending PATH environment variable: {}".format(scdoc_root)) | ||
self.env_info.PATH.append(scdoc_root) | ||
self._chmod_plus_x(os.path.join(scdoc_root, "scdoc")) | ||
|
||
def validate(self): | ||
if self.settings.os in ["Macos", "Windows"]: | ||
raise ConanInvalidConfiguration( | ||
f"Builds aren't supported on {self.settings.os}") |
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,10 @@ | ||
from conans import ConanFile, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
self.run( | ||
f"scdoc < {os.path.join(self.source_folder,'test_package.1.scd')}", run_environment=True) |
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,9 @@ | ||
test_package(1) | ||
|
||
# NAME | ||
|
||
test_package - This is a test package for scdoc | ||
|
||
# DESCRIPTION | ||
|
||
This is a simple scd file for test_package. |
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: | ||
"1.11.12": | ||
folder: all |