Skip to content

Commit b6c08b9

Browse files
aacebedomiklelappo
authored andcommitted
(conan-io#8598) add scdoc documentation tool
1 parent 9cbfaee commit b6c08b9

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

recipes/scdoc/all/conandata.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sources:
2+
"1.11.12":
3+
url: "https://git.sr.ht/~sircmpwn/scdoc/archive/1.11.2.tar.gz"
4+
sha256: "e9ff9981b5854301789a6778ee64ef1f6d1e5f4829a9dd3e58a9a63eacc2e6f0"

recipes/scdoc/all/conanfile.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
from conans import ConanFile, AutoToolsBuildEnvironment, tools
2+
from conans.errors import ConanInvalidConfiguration
3+
import os
4+
5+
required_conan_version = ">=1.33.0"
6+
7+
8+
class ScdocInstallerConan(ConanFile):
9+
name = "scdoc"
10+
description = "scdoc is a simple man page generator for POSIX systems written in C99."
11+
topics = ("manpage", "documentation", "posix")
12+
url = "https://github.com/conan-io/conan-center-index"
13+
homepage = "https://git.sr.ht/~sircmpwn/scdoc"
14+
license = "MIT"
15+
settings = "os", "arch", "compiler", "build_type"
16+
_autotools = None
17+
18+
@property
19+
def _source_subfolder(self):
20+
return "source_subfolder"
21+
22+
def build_requirements(self):
23+
self.build_requires("make/4.3")
24+
25+
def configure(self):
26+
del self.settings.compiler.libcxx
27+
del self.settings.compiler.cppstd
28+
29+
def package_id(self):
30+
del self.info.settings.compiler
31+
32+
def source(self):
33+
tools.get(**self.conan_data["sources"][self.version], strip_root=True,
34+
destination=self._source_subfolder)
35+
36+
@staticmethod
37+
def _chmod_plus_x(filename):
38+
if os.name == "posix":
39+
os.chmod(filename, os.stat(filename).st_mode | 0o111)
40+
41+
def _configure_autotools(self):
42+
if self._autotools:
43+
return self._autotools
44+
self._autotools = AutoToolsBuildEnvironment(self)
45+
return self._autotools
46+
47+
def build(self):
48+
autotools = self._configure_autotools()
49+
with tools.chdir(self._source_subfolder):
50+
autotools.make()
51+
52+
def package(self):
53+
autotools = self._configure_autotools()
54+
with tools.chdir(self._source_subfolder):
55+
autotools.install(args=[f"PREFIX={self.package_folder}"])
56+
self.copy(pattern="COPYING", dst="licenses",
57+
src=self._source_subfolder)
58+
tools.rmdir(os.path.join(self.package_folder, "share"))
59+
60+
def package_info(self):
61+
self.cpp_info.libdirs = []
62+
63+
scdoc_root = os.path.join(self.package_folder, "bin")
64+
self.output.info(
65+
"Appending PATH environment variable: {}".format(scdoc_root))
66+
self.env_info.PATH.append(scdoc_root)
67+
self._chmod_plus_x(os.path.join(scdoc_root, "scdoc"))
68+
pkgconfig_variables = {
69+
'exec_prefix': '${prefix}/bin',
70+
'scdoc': '${exec_prefix}/scdoc',
71+
}
72+
self.cpp_info.set_property(
73+
"pkg_config_custom_content",
74+
"\n".join("%s=%s" % (key, value) for key,value in pkgconfig_variables.items()))
75+
76+
def validate(self):
77+
if self.settings.os in ["Macos", "Windows"]:
78+
raise ConanInvalidConfiguration(
79+
f"Builds aren't supported on {self.settings.os}")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from conans import ConanFile, tools
2+
import os
3+
4+
5+
class TestPackageConan(ConanFile):
6+
7+
def test(self):
8+
if not tools.cross_building(self):
9+
self.run(
10+
f"scdoc < {os.path.join(self.source_folder,'test_package.1.scd')}", run_environment=True)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
test_package(1)
2+
3+
# NAME
4+
5+
test_package - This is a test package for scdoc
6+
7+
# DESCRIPTION
8+
9+
This is a simple scd file for test_package.

recipes/scdoc/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
versions:
2+
"1.11.12":
3+
folder: all

0 commit comments

Comments
 (0)