Skip to content

Commit 6e3507f

Browse files
committed
add scdoc documentation tool
1 parent d593af5 commit 6e3507f

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-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: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
from conans import ConanFile, AutoToolsBuildEnvironment, tools
2+
import os
3+
4+
required_conan_version = ">=1.43.0"
5+
6+
7+
class ScdocInstallerConan(ConanFile):
8+
name = "scdoc"
9+
description = "scdoc is a simple man page generator for POSIX systems written in C99."
10+
topics = ("scdoc", "documentation")
11+
url = "https://github.com/conan-io/conan-center-index"
12+
homepage = "https://git.sr.ht/~sircmpwn/scdoc"
13+
license = "Unknown"
14+
settings = "os", "arch", "compiler", "build_type"
15+
_autotools = None
16+
no_copy_source = True
17+
18+
@property
19+
def _source_subfolder(self):
20+
return "source_subfolder"
21+
22+
def build_requirements(self):
23+
self.tool_requires("make/[>=4.3.0]")
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(os.path.join(self.source_folder, self._source_subfolder)):
50+
autotools.make()
51+
autotools.make(target="check")
52+
53+
def package(self):
54+
autotools = self._configure_autotools()
55+
with tools.chdir(os.path.join(self.source_folder, self._source_subfolder)):
56+
autotools.install(args=[f"PREFIX={self.package_folder}"])
57+
self.copy(pattern="COPYING", dst="licenses",
58+
src=self._source_subfolder)
59+
tools.rmdir(os.path.join(self.package_folder, "share"))
60+
61+
def package_info(self):
62+
self.cpp_info.libdirs = []
63+
64+
scdoc_root = os.path.join(self.package_folder, "bin")
65+
self.output.info(
66+
"Appending PATH environment variable: {}".format(scdoc_root))
67+
self.env_info.PATH.append(scdoc_root)
68+
self._chmod_plus_x(os.path.join(scdoc_root, "scdoc"))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from conans import ConanFile, Meson, tools
2+
import os
3+
4+
5+
class TestPackageConan(ConanFile):
6+
7+
def test(self):
8+
self.run(
9+
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)