[Git][NTPsec/ntpsec][master] Address GitLab Issue #73: Build script: Allow to change sbindir and mandir

Eric S. Raymond gitlab at mg.gitlab.com
Fri Oct 7 12:58:36 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
b8191796 by Eric S. Raymond at 2016-10-07T08:57:37-04:00
Address GitLab Issue #73: Build script: Allow to change sbindir and mandir

- - - - -


3 changed files:

- ntpd/wscript
- wafhelpers/options.py
- wafhelpers/waf.py


Changes:

=====================================
ntpd/wscript
=====================================
--- a/ntpd/wscript
+++ b/ntpd/wscript
@@ -119,6 +119,13 @@ def build(ctx):
 	if ctx.env.REFCLOCK_ENABLE:
 		refclock_define = ["REFCLOCK=1"]
 
+	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(
 		target		= "ntpd",
 		features	= "c rtems_trace cprogram bld_include src_include libisc_include libisc_pthread_include ntp_version",
@@ -130,7 +137,7 @@ def build(ctx):
 						"%s/ntpd/" % srcnode,
                         "%s/libsodium/include" % srcnode
 		],
-		install_path= "${PREFIX}/sbin/",
+		install_path	= ntpd_install_path,
 	)
 
 	ctx.manpage(8, "ntpd-man.txt")


=====================================
wafhelpers/options.py
=====================================
--- a/wafhelpers/options.py
+++ b/wafhelpers/options.py
@@ -47,6 +47,7 @@ def options_cmd(ctx, config):
 	grp.add_option('--rtems-trace-path', type='string', default="", help="Path to rtems-tld.")
 	grp.add_option('--define', type='string', action="callback", callback=callback_flags, help="Force definition of symbol, wants value of form SYM=VAL.")
 	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', default=False, help="Build NTP documentation")
@@ -54,6 +55,7 @@ def options_cmd(ctx, config):
 	grp.add_option('--enable-a2x-xmllint', action='store_true', default=False, 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.")
 
 	grp = ctx.add_option_group("Not for general use")
 	grp.add_option('--build-snapshot', action='store_true', default=False, help="Generate source snapshot.")


=====================================
wafhelpers/waf.py
=====================================
--- a/wafhelpers/waf.py
+++ b/wafhelpers/waf.py
@@ -1,7 +1,7 @@
 from waflib.Configure import conf
 from waflib.TaskGen import feature, before, after, extension, after_method, before_method
 from waflib.Task import Task
-
+import os
 
 @before_method('apply_incpaths')
 @feature('bld_include')
@@ -57,8 +57,17 @@ 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 += "/"
+
 	if ctx.env.NTPSEC_RELEASE:
-		ctx.install_files("${PREFIX}/man/man%s/" % section, source.replace("-man.txt", ".%s" % section))
+		ctx.install_files(manprefix + "man%s/" % section, source.replace("-man.txt", ".%s" % section))
 		return
 
 	if not ctx.env.ENABLE_DOC or ctx.env.DISABLE_MANPAGE:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b81917963b42047a88769309acc141c6af6cabf6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161007/c33ec93a/attachment.html>


More information about the vc mailing list