[Git][NTPsec/ntpsec][master] Load waf's gnu_dirs module and use it for installation target directories

Matt Selsky gitlab at mg.gitlab.com
Tue Apr 25 03:34:25 UTC 2017


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
d3b84f36 by Matt Selsky at 2017-04-24T23:16:56-04:00
Load waf's gnu_dirs module and use it for installation target directories

Fixes GitLab issue #179

- - - - -


9 changed files:

- docs/wscript
- ntpd/wscript
- ntpfrob/wscript
- ntptime/wscript
- wafhelpers/asciidoc.py
- wafhelpers/configure.py
- wafhelpers/options.py
- wafhelpers/waf.py
- wscript


Changes:

=====================================
docs/wscript
=====================================
--- a/docs/wscript
+++ b/docs/wscript
@@ -35,11 +35,6 @@ def build(ctx):
     )
 
     # Install HTML
-    if ctx.env.HTMLDIR:
-        install_prefix = ctx.env.HTMLDIR
-    else:
-        install_prefix = "%s/share/ntpsec/docs/" % ctx.env.PREFIX
-
-    ctx.install_files(install_prefix, extra
+    ctx.install_files('${HTMLDIR}', extra
                       + [x.change_ext(".html").name for x in doc_source])
-    ctx.install_files(install_prefix, image_source, relative_trick=True)
+    ctx.install_files('${HTMLDIR}', image_source, relative_trick=True)


=====================================
ntpd/wscript
=====================================
--- a/ntpd/wscript
+++ b/ntpd/wscript
@@ -120,20 +120,13 @@ def build(ctx):
         ctx.bldnode.parent.find_node("host/ntpd/ntp_parser.tab.c")
     ]
 
-    if ctx.env.SBINDIR:
-        ntpd_install_path = ctx.env.SBINDIR
-    else:
-        ntpd_install_path = "${PREFIX}/sbin/"
-    if not ntpd_install_path.endswith("/"):
-        ntpd_install_path += "/"
-
     ctx(
         features="c rtems_trace cprogram bld_include src_include "
                  "libisc_include libisc_pthread_include",
         includes=["%s/host/ntpd/" % ctx.bldnode.parent.abspath(),
                   "%s/ntpd/" % srcnode,
                   ] + ctx.env.PLATFORM_INCLUDES,
-        install_path=ntpd_install_path,
+        install_path='${SBINDIR}',
         source=ntpd_source,
         target="ntpd",
         use="libntpd_obj isc ntp M parse RT CAP SECCOMP PTHREAD NTPD "


=====================================
ntpfrob/wscript
=====================================
--- a/ntpfrob/wscript
+++ b/ntpfrob/wscript
@@ -7,7 +7,7 @@ def build(ctx):
     ctx(
         features="c cprogram bld_include src_include libisc_include",
         includes=["%s/ntpfrob/" % bldnode],
-        install_path="${PREFIX}/bin/",
+        install_path='${BINDIR}',
         source=frob_sources,
         target="ntpfrob",
         use="M RT",


=====================================
ntptime/wscript
=====================================
--- a/ntptime/wscript
+++ b/ntptime/wscript
@@ -11,7 +11,7 @@ def build(ctx):
                       "%s/ntptime/" % srcnode,
                       ],
             use="ntp isc M RT",
-            install_path="${PREFIX}/bin/"
+            install_path='${BINDIR}',
         )
 
     ctx.manpage(8, "ntptime-man.txt")


=====================================
wafhelpers/asciidoc.py
=====================================
--- a/wafhelpers/asciidoc.py
+++ b/wafhelpers/asciidoc.py
@@ -70,4 +70,4 @@ def run_a2x(self, node):
     out = "%s.%s" % (n_file.replace("-man.txt.man-tmp", ""), self.section)
     out_n = self.bld.path.find_or_declare(out)
     self.create_task('a2x', node, out_n)
-    self.bld.install_files("${PREFIX}/man/man%s/" % self.section, out_n)
+    self.bld.install_files("${MANDIR}/man%s/" % self.section, out_n)


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -62,6 +62,7 @@ def cmd_configure(ctx, config):
     ctx.run_build_cls = 'check'
     ctx.load('waf', tooldir='wafhelpers/')
     ctx.load('waf_unit_test')
+    ctx.load('gnu_dirs')
 
     parse_version(config)
 
@@ -114,7 +115,7 @@ def cmd_configure(ctx, config):
     if ctx.options.enable_rtems_trace:
         ctx.find_program("rtems-tld", var="BIN_RTEMS_TLD",
                          path_list=[ctx.options.rtems_trace_path,
-                                    ctx.env.BINDIR])
+                                    '${BINDIR}'])
         ctx.env.RTEMS_TEST_ENABLE = True
         ctx.env.RTEMS_TEST_FLAGS = [
             "-C", "%s/devel/trace/ntpsec-trace.ini" % srcnode,
@@ -168,7 +169,6 @@ def cmd_configure(ctx, config):
         ctx.env.ASCIIDOC_FLAGS = ["-f", "%s/docs/asciidoc.conf"
                                   % ctx.srcnode.abspath()]
         ctx.env.ENABLE_DOC_USER = ctx.options.enable_doc
-        ctx.env.HTMLDIR = ctx.options.htmldir
 
     # XXX: conditionally build this with --disable-man?
     # Should it build without docs enabled?
@@ -182,9 +182,6 @@ def cmd_configure(ctx, config):
     if ctx.options.disable_manpage:
         ctx.env.DISABLE_MANPAGE = True
 
-    ctx.env.SBINDIR = ctx.options.sbindir
-    ctx.env.MANDIR = ctx.options.mandir
-
     from os.path import exists
     from waflib.Utils import subprocess
     if ((exists(".git")


=====================================
wafhelpers/options.py
=====================================
--- a/wafhelpers/options.py
+++ b/wafhelpers/options.py
@@ -2,6 +2,7 @@ def options_cmd(ctx, config):
     ctx.load("compiler_c")
     ctx.load("msvc")
     ctx.load('waf_unit_test')
+    ctx.load('gnu_dirs')
 
     def callback_flags(option, opt, value, parser):
         config["OPT_STORE"].setdefault(opt, []).append(value)
@@ -90,8 +91,6 @@ def options_cmd(ctx, config):
     grp.add_option('--undefine', type='string', action="callback",
                    callback=callback_flags,
                    help="Force undefinition of symbol.")
-    grp.add_option('--sbindir', type='string', action='store',
-                   default=None, help="Force ntpd installation directory.")
 
     grp = ctx.add_option_group("NTP documentation configure options")
     grp.add_option('--enable-doc', action='store_true',
@@ -101,7 +100,3 @@ def options_cmd(ctx, config):
                    help="Build NTP documentation with a2x XML lint")
     grp.add_option('--disable-manpage', action='store_true',
                    default=False, help="Disable Manpage building.")
-    grp.add_option('--htmldir', type='string', action='store',
-                   default=None, help="Force HTML installation directory.")
-    grp.add_option('--mandir', type='string', action='store',
-                   default=None, help="Force man page installation directory.")


=====================================
wafhelpers/waf.py
=====================================
--- a/wafhelpers/waf.py
+++ b/wafhelpers/waf.py
@@ -38,16 +38,7 @@ def manpage_subst_fun(task, text):
 @conf
 def manpage(ctx, section, source):
 
-        if ctx.env.MANDIR:
-                manprefix = ctx.env.MANDIR
-        elif os.path.isdir("/usr/man"):
-                manprefix = "/usr/man"
-        else:
-                manprefix = "/usr/share/man"
-        if not manprefix.endswith("/"):
-                manprefix += "/"
-
-        # ctx.install_files(manprefix + "man%s/" % section,
+        # ctx.install_files('${MANDIR}' + "/man%s/" % section,
         #                   source.replace("-man.txt", ".%s" % section))
 
         if not ctx.env.ENABLE_DOC or ctx.env.DISABLE_MANPAGE:


=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -197,7 +197,7 @@ def build(ctx):
         source=scripts,
         target=scripts,
         chmod=Utils.O755,
-        install_path="${PREFIX}/bin/"
+        install_path='${BINDIR}',
     )
 
     ctx.add_post_fun(afterparty)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/d3b84f3693d431aed5d712546b0a7132f29b7062

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/d3b84f3693d431aed5d712546b0a7132f29b7062
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170425/71a40fc2/attachment.html>


More information about the vc mailing list