1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import os
from devtools.yamaker.modules import GLOBAL, Library
from devtools.yamaker.project import GNUMakeNixProject
def post_install(self):
# remove unnecessary test and cleanup its sources
test = self.yamakes.pop(".")
for src in test.SRCS:
os.remove(f"{self.dstdir}/{src}")
# remove files from src/ subfolder (without recursion)
for header in os.listdir(f"{self.dstdir}/src"):
if os.path.isfile(f"{self.dstdir}/src/{header}"):
os.remove(f"{self.dstdir}/src/{header}")
# generate LIBRARY modules
self.yamakes["."] = self.module(
Library,
ADDINCL=[GLOBAL(f"{self.arcdir}/src")],
)
# Though sparsehash is a header-only library.
# yet we need to generate config.h during norman autoconf routine.
# Hence we can not use NixSourceProject for it.
sparsehash = GNUMakeNixProject(
owners=["g:cpp-contrib"],
arcdir="contrib/libs/sparsehash",
nixattr="sparsehash",
ignore_commands=[
"bash",
"gawk",
],
# FIXME:
# There is no need to install anything, yet yamaker does not handle,
# but we need to bring in the config.h generated during build.
#
# This target will be removed during post_install().
install_targets=["hashtable_test"],
put={"hashtable_test": "."},
copy_sources=[
"src/sparsehash/**",
],
post_install=post_install,
)
|