Skip to content

Commit 975a716

Browse files
committed
add scdoc documentation tool
1 parent d593af5 commit 975a716

File tree

5 files changed

+99
-0
lines changed

5 files changed

+99
-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: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
from conans import ConanFile, AutoToolsBuildEnvironment, tools
2+
from conans.errors import ConanInvalidConfiguration
3+
import os
4+
5+
required_conan_version = ">=1.43.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 = ("scdoc", "documentation")
12+
url = "https://github.com/conan-io/conan-center-index"
13+
homepage = "https://git.sr.ht/~sircmpwn/scdoc"
14+
license = "Unknown"
15+
settings = "os", "arch", "compiler", "build_type"
16+
_autotools = None
17+
no_copy_source = True
18+
19+
@property
20+
def _source_subfolder(self):
21+
return "source_subfolder"
22+
23+
def build_requirements(self):
24+
self.build_requires("make/[>=4.3.0]")
25+
26+
def configure(self):
27+
del self.settings.compiler.libcxx
28+
del self.settings.compiler.cppstd
29+
30+
def package_id(self):
31+
del self.info.settings.compiler
32+
33+
def source(self):
34+
tools.get(**self.conan_data["sources"][self.version], strip_root=True,
35+
destination=self._source_subfolder)
36+
37+
@staticmethod
38+
def _chmod_plus_x(filename):
39+
if os.name == "posix":
40+
os.chmod(filename, os.stat(filename).st_mode | 0o111)
41+
42+
def _configure_autotools(self):
43+
if self._autotools:
44+
return self._autotools
45+
self._autotools = AutoToolsBuildEnvironment(self)
46+
return self._autotools
47+
48+
def build(self):
49+
autotools = self._configure_autotools()
50+
with tools.chdir(os.path.join(self.source_folder, self._source_subfolder)):
51+
autotools.make()
52+
autotools.make(target="check")
53+
54+
def package(self):
55+
autotools = self._configure_autotools()
56+
with tools.chdir(os.path.join(self.source_folder, self._source_subfolder)):
57+
autotools.install(args=[f"PREFIX={self.package_folder}"])
58+
self.copy(pattern="COPYING", dst="licenses",
59+
src=self._source_subfolder)
60+
tools.rmdir(os.path.join(self.package_folder, "share"))
61+
62+
def package_info(self):
63+
self.cpp_info.libdirs = []
64+
65+
scdoc_root = os.path.join(self.package_folder, "bin")
66+
self.output.info(
67+
"Appending PATH environment variable: {}".format(scdoc_root))
68+
self.env_info.PATH.append(scdoc_root)
69+
self._chmod_plus_x(os.path.join(scdoc_root, "scdoc"))
70+
71+
def validate(self):
72+
if self.settings.os == "Macos" and not self.options.shared:
73+
raise ConanInvalidConfiguration(
74+
"Static builds aren't supported on Macos")
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)