support: Expose sbindir as support_sbindir_prefix

Message ID 87woilgh1x.fsf@oldenburg2.str.redhat.com
State New
Headers show
Series
  • support: Expose sbindir as support_sbindir_prefix
Related show

Commit Message

Florian Weimer May 20, 2019, 5:40 p.m.
2019-05-20  Florian Weimer  <fweimer@redhat.com>

	* support/support.h (support_sbindir_prefix): Declare.
	* support/Makefile (CFLAGS-support_paths.c): Define SBINDIR_PATH.
	* support/support_paths.c (support_sbindir_prefix): Define.

Comments

Adhemerval Zanella May 20, 2019, 6:11 p.m. | #1
On 20/05/2019 14:40, Florian Weimer wrote:
> 2019-05-20  Florian Weimer  <fweimer@redhat.com>

> 

> 	* support/support.h (support_sbindir_prefix): Declare.

> 	* support/Makefile (CFLAGS-support_paths.c): Define SBINDIR_PATH.

> 	* support/support_paths.c (support_sbindir_prefix): Define.

> 

> diff --git a/support/Makefile b/support/Makefile

> index 18d39f5a50..56c1ed43bb 100644

> --- a/support/Makefile

> +++ b/support/Makefile

> @@ -181,6 +181,7 @@ CFLAGS-support_paths.c = \

>  		-DINSTDIR_PATH=\"$(prefix)\" \

>  		-DLIBDIR_PATH=\"$(libdir)\" \

>  		-DBINDIR_PATH=\"$(bindir)\" \

> +		-DSBINDIR_PATH=\"$(sbindir)\" \

>  		-DROOTSBINDIR_PATH=\"$(rootsbindir)\"

>  

>  ifeq (,$(CXX))

> diff --git a/support/support.h b/support/support.h

> index 13076b75ba..53271cedf1 100644

> --- a/support/support.h

> +++ b/support/support.h

> @@ -108,6 +108,8 @@ extern const char support_libdir_prefix[];

>  /* Corresponds to the install's bin/ directory.  */

>  extern const char support_bindir_prefix[];

>  /* Corresponds to the install's sbin/ directory.  */

> +extern const char support_sbindir_prefix[];

> +/* Corresponds to the install's sbin/ directory.  */

>  extern const char support_install_rootsbindir[];


Which is the different between rootsbindir and sbindir? Because we can
either use them interchangeable or adjust the rootsbindir comment.

>  

>  extern ssize_t support_copy_file_range (int, off64_t *, int, off64_t *,

> diff --git a/support/support_paths.c b/support/support_paths.c

> index 1fe32835b1..ff1df2bf20 100644

> --- a/support/support_paths.c

> +++ b/support/support_paths.c

> @@ -65,6 +65,13 @@ const char support_bindir_prefix[] = BINDIR_PATH;

>  # error please -DBINDIR_PATH=something in the Makefile

>  #endif

>  

> +#ifdef SBINDIR_PATH

> +/* Corresponds to the install's bin/ directory.  */

> +const char support_sbindir_prefix[] = SBINDIR_PATH;

> +#else

> +# error please -DSBINDIR_PATH=something in the Makefile

> +#endif

> +

>  #ifdef ROOTSBINDIR_PATH

>  /* Corresponds to the install's sbin/ directory.  */

>  const char support_install_rootsbindir[] = ROOTSBINDIR_PATH;

>
Florian Weimer May 20, 2019, 6:34 p.m. | #2
* Adhemerval Zanella:

> On 20/05/2019 14:40, Florian Weimer wrote:

>> 2019-05-20  Florian Weimer  <fweimer@redhat.com>

>> 

>> 	* support/support.h (support_sbindir_prefix): Declare.

>> 	* support/Makefile (CFLAGS-support_paths.c): Define SBINDIR_PATH.

>> 	* support/support_paths.c (support_sbindir_prefix): Define.

>> 

>> diff --git a/support/Makefile b/support/Makefile

>> index 18d39f5a50..56c1ed43bb 100644

>> --- a/support/Makefile

>> +++ b/support/Makefile

>> @@ -181,6 +181,7 @@ CFLAGS-support_paths.c = \

>>  		-DINSTDIR_PATH=\"$(prefix)\" \

>>  		-DLIBDIR_PATH=\"$(libdir)\" \

>>  		-DBINDIR_PATH=\"$(bindir)\" \

>> +		-DSBINDIR_PATH=\"$(sbindir)\" \

>>  		-DROOTSBINDIR_PATH=\"$(rootsbindir)\"

>>  

>>  ifeq (,$(CXX))

>> diff --git a/support/support.h b/support/support.h

>> index 13076b75ba..53271cedf1 100644

>> --- a/support/support.h

>> +++ b/support/support.h

>> @@ -108,6 +108,8 @@ extern const char support_libdir_prefix[];

>>  /* Corresponds to the install's bin/ directory.  */

>>  extern const char support_bindir_prefix[];

>>  /* Corresponds to the install's sbin/ directory.  */

>> +extern const char support_sbindir_prefix[];

>> +/* Corresponds to the install's sbin/ directory.  */

>>  extern const char support_install_rootsbindir[];

>

> Which is the different between rootsbindir and sbindir? Because we can

> either use them interchangeable or adjust the rootsbindir comment.


It's the difference between /usr/sbin/iconvconfig (with prefix) and
/sbin/ldconfig (without).

Not sure what's the proper comment fix is.  The other comments do not
mention the prefix either, but the variable name does.  Maybe:

 +/* Corresponds to the install's sbin/ directory (without prefix).  */
  extern const char support_install_rootsbindir[];

Thanks,
Florian
Adhemerval Zanella May 20, 2019, 6:56 p.m. | #3
On 20/05/2019 15:34, Florian Weimer wrote:
> * Adhemerval Zanella:

> 

>> On 20/05/2019 14:40, Florian Weimer wrote:

>>> 2019-05-20  Florian Weimer  <fweimer@redhat.com>

>>>

>>> 	* support/support.h (support_sbindir_prefix): Declare.

>>> 	* support/Makefile (CFLAGS-support_paths.c): Define SBINDIR_PATH.

>>> 	* support/support_paths.c (support_sbindir_prefix): Define.

>>>

>>> diff --git a/support/Makefile b/support/Makefile

>>> index 18d39f5a50..56c1ed43bb 100644

>>> --- a/support/Makefile

>>> +++ b/support/Makefile

>>> @@ -181,6 +181,7 @@ CFLAGS-support_paths.c = \

>>>  		-DINSTDIR_PATH=\"$(prefix)\" \

>>>  		-DLIBDIR_PATH=\"$(libdir)\" \

>>>  		-DBINDIR_PATH=\"$(bindir)\" \

>>> +		-DSBINDIR_PATH=\"$(sbindir)\" \

>>>  		-DROOTSBINDIR_PATH=\"$(rootsbindir)\"

>>>  

>>>  ifeq (,$(CXX))

>>> diff --git a/support/support.h b/support/support.h

>>> index 13076b75ba..53271cedf1 100644

>>> --- a/support/support.h

>>> +++ b/support/support.h

>>> @@ -108,6 +108,8 @@ extern const char support_libdir_prefix[];

>>>  /* Corresponds to the install's bin/ directory.  */

>>>  extern const char support_bindir_prefix[];

>>>  /* Corresponds to the install's sbin/ directory.  */

>>> +extern const char support_sbindir_prefix[];

>>> +/* Corresponds to the install's sbin/ directory.  */

>>>  extern const char support_install_rootsbindir[];

>>

>> Which is the different between rootsbindir and sbindir? Because we can

>> either use them interchangeable or adjust the rootsbindir comment.

> 

> It's the difference between /usr/sbin/iconvconfig (with prefix) and

> /sbin/ldconfig (without).

> 

> Not sure what's the proper comment fix is.  The other comments do not

> mention the prefix either, but the variable name does.  Maybe:

> 

>  +/* Corresponds to the install's sbin/ directory (without prefix).  */

>   extern const char support_install_rootsbindir[];


Ok, LGTM.

> 

> Thanks,

> Florian

>

Patch

diff --git a/support/Makefile b/support/Makefile
index 18d39f5a50..56c1ed43bb 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -181,6 +181,7 @@  CFLAGS-support_paths.c = \
 		-DINSTDIR_PATH=\"$(prefix)\" \
 		-DLIBDIR_PATH=\"$(libdir)\" \
 		-DBINDIR_PATH=\"$(bindir)\" \
+		-DSBINDIR_PATH=\"$(sbindir)\" \
 		-DROOTSBINDIR_PATH=\"$(rootsbindir)\"
 
 ifeq (,$(CXX))
diff --git a/support/support.h b/support/support.h
index 13076b75ba..53271cedf1 100644
--- a/support/support.h
+++ b/support/support.h
@@ -108,6 +108,8 @@  extern const char support_libdir_prefix[];
 /* Corresponds to the install's bin/ directory.  */
 extern const char support_bindir_prefix[];
 /* Corresponds to the install's sbin/ directory.  */
+extern const char support_sbindir_prefix[];
+/* Corresponds to the install's sbin/ directory.  */
 extern const char support_install_rootsbindir[];
 
 extern ssize_t support_copy_file_range (int, off64_t *, int, off64_t *,
diff --git a/support/support_paths.c b/support/support_paths.c
index 1fe32835b1..ff1df2bf20 100644
--- a/support/support_paths.c
+++ b/support/support_paths.c
@@ -65,6 +65,13 @@  const char support_bindir_prefix[] = BINDIR_PATH;
 # error please -DBINDIR_PATH=something in the Makefile
 #endif
 
+#ifdef SBINDIR_PATH
+/* Corresponds to the install's bin/ directory.  */
+const char support_sbindir_prefix[] = SBINDIR_PATH;
+#else
+# error please -DSBINDIR_PATH=something in the Makefile
+#endif
+
 #ifdef ROOTSBINDIR_PATH
 /* Corresponds to the install's sbin/ directory.  */
 const char support_install_rootsbindir[] = ROOTSBINDIR_PATH;