[PATCH] use eglibc configuration file

View: New views
8 Messages — Rating Filter:   Alert me  

[PATCH] use eglibc configuration file

by Arnaud Vrac-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Here is a patch to crosstool-ng to add support for a user provided
eglibc configuration file. This allows to configure option groups, and
nsswitch functions and config files if wanted.

Regards,

--
Arnaud Vrac

diff -r 8d386988dcb1 config/libc/eglibc.in
--- a/config/libc/eglibc.in Sun Oct 04 12:53:12 2009 +0200
+++ b/config/libc/eglibc.in Tue Oct 06 18:26:51 2009 +0200
@@ -90,3 +90,39 @@
       
       Note that crosstool-NG will *not* update your working copy, you will
       have to do that yourself.
+
+config EGLIBC_USE_CUSTOM_CONFIG
+    bool
+    prompt "use user provided configuration file"
+    default n
+    help
+      Use a custom configuration file to disable some features in the eglibc
+      library. For more info read the EGLIBC.option-groups file in the eglibc
+      source directory.
+
+if EGLIBC_USE_CUSTOM_CONFIG
+    config EGLIBC_OPTION_GROUPS_FILE
+        string
+        prompt "Option groups configuration file"
+        default ""
+        help
+          Path to the file to configure eglibc option groups.
+
+    config EGLIBC_NSS_CONFIG_FILE
+        string
+        prompt "NSS config file"
+        default ""
+        help
+          Path to the nsswitch configuration file when the
+          OPTION_EGLIBC_NSSWITCH feature is disabled in the option groups
+          configuration file.
+
+    config EGLIBC_NSS_FUNCTIONS_FILE
+        string
+        prompt "NSS functions file"
+        default ""
+        help
+          Path to the nsswitch functions file when the
+          OPTION_EGLIBC_NSSWITCH feature is disabled in the option groups
+          configuration file.
+endif
diff -r 8d386988dcb1 scripts/build/libc/eglibc.sh
--- a/scripts/build/libc/eglibc.sh Sun Oct 04 12:53:12 2009 +0200
+++ b/scripts/build/libc/eglibc.sh Tue Oct 06 18:26:51 2009 +0200
@@ -124,7 +124,29 @@
 
 # There is nothing to do for eglibc check config
 do_libc_check_config() {
-    :
+    if [ "${CT_EGLIBC_USE_CUSTOM_CONFIG}" != "y" ]; then
+        return 0
+    fi
+
+    CT_DoStep INFO "Checking C library configuration"
+
+    CT_TestOrAbort "You did not provide an eglibc config file!" -f "${CT_EGLIBC_OPTION_GROUPS_FILE}"
+
+    cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config"
+
+    if [ -f "${CT_EGLIBC_NSS_CONFIG_FILE}" ]; then
+        cp "${CT_EGLIBC_NSS_CONFIG_FILE}" "${CT_CONFIG_DIR}/nsswitch.config"
+        echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG = ${CT_CONFIG_DIR}/nsswitch.config" \
+            >> "${CT_CONFIG_DIR}/eglibc.config"
+    fi
+
+    if [ -f "${CT_EGLIBC_NSS_FUNCTIONS_FILE}" ]; then
+        cp "${CT_EGLIBC_NSS_FUNCTIONS_FILE}" "${CT_CONFIG_DIR}/nsswitch.functions"
+        echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \
+            >> "${CT_CONFIG_DIR}/eglibc.config"
+    fi
+
+    CT_EndStep
 }
 
 # This function installs the eglibc headers needed to build the core compiler
@@ -143,6 +165,8 @@
 
     CT_DoLog EXTRA "Configuring C library"
 
+    cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
+
     cross_cc=$(CT_Which "${CT_TARGET}-gcc")
     cross_cxx=$(CT_Which "${CT_TARGET}-g++")
     cross_ar=$(CT_Which "${CT_TARGET}-ar")
@@ -210,6 +234,8 @@
 
     CT_DoLog EXTRA "Configuring C library"
 
+    cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
+
     # Add some default glibc config options if not given by user.
     # We don't need to be conditional on wether the user did set different
     # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config


--
For unsubscribe information see http://sourceware.org/lists.html#faq

Re: [PATCH] use eglibc configuration file

by Yann E. MORIN :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Arnaud!
All,

On Thursday 08 October 2009 18:48:41 Arnaud Vrac wrote:
> Here is a patch to crosstool-ng to add support for a user provided
> eglibc configuration file. This allows to configure option groups, and
> nsswitch functions and config files if wanted.

Very nice! I'm glad someone take care to look into that!

> diff -r 8d386988dcb1 config/libc/eglibc.in
> --- a/config/libc/eglibc.in     Sun Oct 04 12:53:12 2009 +0200
> +++ b/config/libc/eglibc.in     Tue Oct 06 18:26:51 2009 +0200

Next time, could you provide a patch that is ready to import into
Mercurial? That has many advantages:
- for me:
  - I can easily import the patch
  - it keeps ancestry of the patch
- for you:
  - it is easy to send the patch
  - it keeps your "username" for the changeset (Or I'd have to do it
    by hand, and am enclined to forget doing so)

You can look in the README, there is a section titled "CONTRIBUTING".

> @@ -90,3 +90,39 @@
>
>        Note that crosstool-NG will *not* update your working copy, you will
>        have to do that yourself.
> +
> +config EGLIBC_USE_CUSTOM_CONFIG
> +    bool
> +    prompt "use user provided configuration file"
> +    default n
> +    help
> +      Use a custom configuration file to disable some features in the eglibc
> +      library. For more info read the EGLIBC.option-groups file in the eglibc
> +      source directory.
> +
> +if EGLIBC_USE_CUSTOM_CONFIG
> +    config EGLIBC_OPTION_GROUPS_FILE
> +        string
> +        prompt "Option groups configuration file"
> +        default ""
> +        help
> +          Path to the file to configure eglibc option groups.

If I understand correctly, this file contains the options to enable/disable.

> +    config EGLIBC_NSS_CONFIG_FILE
> +        string
> +        prompt "NSS config file"
> +        default ""
> +        help
> +          Path to the nsswitch configuration file when the
> +          OPTION_EGLIBC_NSSWITCH feature is disabled in the option groups
> +          configuration file.

So what is this file for? I don't know why I should have an NSS config file
if I specifically _disabled_ NSS. The help entry is confusing.

> +    config EGLIBC_NSS_FUNCTIONS_FILE
> +        string
> +        prompt "NSS functions file"
> +        default ""
> +        help
> +          Path to the nsswitch functions file when the
> +          OPTION_EGLIBC_NSSWITCH feature is disabled in the option groups
> +          configuration file.
> +endif

What are those NSS functions file, and where is one supposed to find it?

> diff -r 8d386988dcb1 scripts/build/libc/eglibc.sh
> --- a/scripts/build/libc/eglibc.sh      Sun Oct 04 12:53:12 2009 +0200
> +++ b/scripts/build/libc/eglibc.sh      Tue Oct 06 18:26:51 2009 +0200

This hunk is OK.

Regards,
Yann E. MORIN.

--
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'



--
For unsubscribe information see http://sourceware.org/lists.html#faq


Re: [PATCH] use eglibc configuration file

by Arnaud Vrac-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yann E. MORIN wrote:
> Hello Arnaud!
>
> Next time, could you provide a patch that is ready to import into
> Mercurial?

Sorry about that, I'll do it properly next time !

>
>> @@ -90,3 +90,39 @@
>>
>>        Note that crosstool-NG will *not* update your working copy, you will
>>        have to do that yourself.
>> +
>> +config EGLIBC_USE_CUSTOM_CONFIG
>> +    bool
>> +    prompt "use user provided configuration file"
>> +    default n
>> +    help
>> +      Use a custom configuration file to disable some features in the eglibc
>> +      library. For more info read the EGLIBC.option-groups file in the eglibc
>> +      source directory.
>> +
>> +if EGLIBC_USE_CUSTOM_CONFIG
>> +    config EGLIBC_OPTION_GROUPS_FILE
>> +        string
>> +        prompt "Option groups configuration file"
>> +        default ""
>> +        help
>> +          Path to the file to configure eglibc option groups.
>
> If I understand correctly, this file contains the options to enable/disable.

Yes, like in the uclibc config file. Some options are dependent on
others so you have to read the help file carefully to get a working
configuration. The help is located in the option-groups.def file in the
eglibc sources.

>
>> +    config EGLIBC_NSS_CONFIG_FILE
>> +        string
>> +        prompt "NSS config file"
>> +        default ""
>> +        help
>> +          Path to the nsswitch configuration file when the
>> +          OPTION_EGLIBC_NSSWITCH feature is disabled in the option groups
>> +          configuration file.
>
> So what is this file for? I don't know why I should have an NSS config file
> if I specifically _disabled_ NSS. The help entry is confusing.
>

I guess the help text is not very explicit. In fact, setting
OPTION_EGLIBC_NSSWITCH to n in the option groups file does not disable
it, it only makes the nss code and configuration static in the libc
instead of loading the nss libraries at runtime using the
/etc/nsswitch.conf file.

For more information, you can read the help on the
OPTION_EGLIBC_NSSWITCH option here:

http://www.eglibc.org/cgi-bin/viewcvs.cgi/trunk/libc/option-groups.def?view=auto

For my tests I used the example files that are provided in the eglibc
sources, nss/fixed-nsswitch.conf and nss/fixed-nsswitch.functions. There
files define the minimal info needed for nss to work correctly.

Thanks,

--
Arnaud Vrac

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Re: [PATCH] use eglibc configuration file

by Yann E. MORIN :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Arnaud,
All,

On Thursday 08 October 2009 20:52:33 Arnaud Vrac wrote:
> Yann E. MORIN wrote:
> > Next time, could you provide a patch that is ready to import into
> > Mercurial?
> Sorry about that, I'll do it properly next time !

No problem!

> >> +    config EGLIBC_NSS_CONFIG_FILE
> >> +        string
> >> +        prompt "NSS config file"
> > So what is this file for? I don't know why I should have an NSS config file
> > if I specifically _disabled_ NSS. The help entry is confusing.
> I guess the help text is not very explicit. In fact, setting
> OPTION_EGLIBC_NSSWITCH to n in the option groups file does not disable
> it, it only makes the nss code and configuration static in the libc
> instead of loading the nss libraries at runtime using the
> /etc/nsswitch.conf file.
> For more information, you can read the help on the
> OPTION_EGLIBC_NSSWITCH option here:
> http://www.eglibc.org/cgi-bin/viewcvs.cgi/trunk/libc/option-groups.def?view=auto

OK. Makes sense. Thanks for the clarification.

> For my tests I used the example files that are provided in the eglibc
> sources, nss/fixed-nsswitch.conf and nss/fixed-nsswitch.functions. There
> files define the minimal info needed for nss to work correctly.

OK. From what I understand, there already is a set of "NSS config file"
and "NSS functions file" bundled with eglibc, and that they are enough
for a non-esoteric system. May be ask the user if he/she wants to use
those files, or if he/she wants to use his/her own set. Something like:

[*] Use an option-groups configuration file
()    Path to the option-groups configuration file
[ ]   Use bundled NSS config/functions files
()      Path to the NSS config file
()      Path to the NSS functions file

That is, hide the paths to the NSS config/functions files.
Also, adapt the help entries accordingly.

What do you think?

Regards,
Yann E. MORIN.

--
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'



--
For unsubscribe information see http://sourceware.org/lists.html#faq


Re: [PATCH] use eglibc configuration file

by Arnaud Vrac-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yann E. MORIN wrote:

> OK. From what I understand, there already is a set of "NSS config file"
> and "NSS functions file" bundled with eglibc, and that they are enough
> for a non-esoteric system. May be ask the user if he/she wants to use
> those files, or if he/she wants to use his/her own set. Something like:
>
> [*] Use an option-groups configuration file
> ()    Path to the option-groups configuration file
> [ ]   Use bundled NSS config/functions files
> ()      Path to the NSS config file
> ()      Path to the NSS functions file
>
> That is, hide the paths to the NSS config/functions files.
> Also, adapt the help entries accordingly.
>
> What do you think?
Alright, I reworked the patch to do exactly that, and also actually made
it work... The check_config function now checks if the nsswitch option
group is disabled, and then copies the nss config/functions file in the
ct-ng config directory.

Regards,

--
Arnaud Vrac

# HG changeset patch
# User Arnaud Vrac <avrac@...>
# Date 1255089469 -7200
# Node ID 9c7d49b78b50b8e633b9500dcd2d7bf2df0e3006
# Parent  8d386988dcb19ac9ab1facd450da319b03ffd02d
eglibc: add support for user provided option groups

Signed-off-by: Arnaud Vrac <avrac@...>

diff -r 8d386988dcb1 -r 9c7d49b78b50 config/libc/eglibc.in
--- a/config/libc/eglibc.in Sun Oct 04 12:53:12 2009 +0200
+++ b/config/libc/eglibc.in Fri Oct 09 13:57:49 2009 +0200
@@ -90,3 +90,55 @@
       
       Note that crosstool-NG will *not* update your working copy, you will
       have to do that yourself.
+
+config EGLIBC_CUSTOM_CONFIG
+    bool
+    prompt "Use custom configuration file"
+    default n
+    help
+      Use a custom configuration file to disable some features in the eglibc
+      library. The configuration file options are described in detail in the
+      option-groups.def file in the eglibc source directory.
+
+if EGLIBC_CUSTOM_CONFIG
+    config EGLIBC_OPTION_GROUPS_FILE
+        string
+        prompt "Path to the option-groups configuration file"
+        default ""
+        help
+          Path to the option groups configuration file.
+
+    config EGLIBC_BUNDLED_NSS_CONFIG
+        bool
+        prompt "Use bundled NSS config file"
+        default y
+        help
+          Use minimal nsswitch configuration file bundled in eglibc.
+          This option is only meaningful when runtime nss configuration
+          is disabled in the option groups file.
+
+    config EGLIBC_NSS_CONFIG_FILE
+        string
+        prompt "Path to the NSS config file"
+        default ""
+        depends on !EGLIBC_BUNDLED_NSS_CONFIG
+        help
+          Path to the nsswitch configuration file
+
+    config EGLIBC_BUNDLED_NSS_FUNCTIONS
+        bool
+        prompt "Use bundled NSS functions file"
+        default y
+        help
+          Use minimal nsswitch functions file bundled in eglibc.
+          This option is only meaningful when runtime nss configuration
+          is disabled in the option groups file.
+
+    config EGLIBC_NSS_FUNCTIONS_FILE
+        string
+        prompt "Path to the NSS functions file"
+        default ""
+        depends on !EGLIBC_BUNDLED_NSS_FUNCTIONS
+        help
+          Path to the nsswitch functions file
+endif
diff -r 8d386988dcb1 -r 9c7d49b78b50 scripts/build/libc/eglibc.sh
--- a/scripts/build/libc/eglibc.sh Sun Oct 04 12:53:12 2009 +0200
+++ b/scripts/build/libc/eglibc.sh Fri Oct 09 13:57:49 2009 +0200
@@ -122,9 +122,52 @@
     return 0
 }
 
-# There is nothing to do for eglibc check config
+# Copy user provided eglibc configuration file if provided
 do_libc_check_config() {
-    :
+    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then
+        return 0
+    fi
+
+    CT_DoStep INFO "Checking C library configuration"
+
+    CT_TestOrAbort "You did not provide an eglibc config file!" \
+        -n "${CT_EGLIBC_OPTION_GROUPS_FILE}" -a \
+        -f "${CT_EGLIBC_OPTION_GROUPS_FILE}"
+
+    CT_DoExecLog ALL cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config"
+
+    # NSS configuration
+    if grep -E '^OPTION_EGLIBC_NSSWITCH[\t ]*=[\t ]*n' "${CT_EGLIBC_OPTION_GROUPS_FILE}" >/dev/null 2>&1; then
+        nss_config="${CT_CONFIG_DIR}/nsswitch.config"
+        nss_functions="${CT_CONFIG_DIR}/nsswitch.functions"
+
+        if [ "${CT_EGLIBC_BUNDLED_NSS_CONFIG}" = "y" ]; then
+            nss_config="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.conf"
+        else
+            nss_config="${CT_EGLIBC_NSS_CONFIG}"
+        fi
+
+        if [ "${CT_EGLIBC_BUNDLED_NSS_FUNCTIONS}" = "y" ]; then
+            nss_functions="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.functions"
+        else
+            nss_functions="${CT_EGLIBC_NSS_FUNCTIONS}"
+        fi
+
+        CT_TestOrAbort "NSS config file not found!" -n "${nss_config}" -a -f "${nss_config}"
+        CT_DoExecLog ALL cp "${nss_config}" "${CT_CONFIG_DIR}/nsswitch.config"
+
+        CT_TestOrAbort "NSS functions file not found!" -n "${nss_functions}" -a -f "${nss_functions}"
+        CT_DoExecLog ALL cp "${nss_functions}" "${CT_CONFIG_DIR}/nsswitch.functions"
+
+        echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG = ${CT_CONFIG_DIR}/nsswitch.config" \
+            >> "${CT_CONFIG_DIR}/eglibc.config"
+        echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \
+            >> "${CT_CONFIG_DIR}/eglibc.config"
+    else
+        CT_DoLog DEBUG "Not using nsswitch fixed configuration"
+    fi
+
+    CT_EndStep
 }
 
 # This function installs the eglibc headers needed to build the core compiler
@@ -143,6 +186,10 @@
 
     CT_DoLog EXTRA "Configuring C library"
 
+    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
+        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
+    fi
+
     cross_cc=$(CT_Which "${CT_TARGET}-gcc")
     cross_cxx=$(CT_Which "${CT_TARGET}-g++")
     cross_ar=$(CT_Which "${CT_TARGET}-ar")
@@ -210,6 +257,10 @@
 
     CT_DoLog EXTRA "Configuring C library"
 
+    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
+        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
+    fi
+
     # Add some default glibc config options if not given by user.
     # We don't need to be conditional on wether the user did set different
     # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config


--
For unsubscribe information see http://sourceware.org/lists.html#faq

Re: [PATCH] use eglibc configuration file

by Yann E. MORIN :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 09 October 2009 14:01:47 Arnaud Vrac wrote:
> Alright, I reworked the patch to do exactly that, and also actually made
> it work...

> # HG changeset patch
> # User Arnaud Vrac <avrac@...>
> # Date 1255089469 -7200
> # Node ID 9c7d49b78b50b8e633b9500dcd2d7bf2df0e3006
> # Parent  8d386988dcb19ac9ab1facd450da319b03ffd02d
> eglibc: add support for user provided option groups
>
> Signed-off-by: Arnaud Vrac <avrac@...>
>
[--SNIP--]

> diff -r 8d386988dcb1 -r 9c7d49b78b50 scripts/build/libc/eglibc.sh
> --- a/scripts/build/libc/eglibc.sh      Sun Oct 04 12:53:12 2009 +0200
> +++ b/scripts/build/libc/eglibc.sh      Fri Oct 09 13:57:49 2009 +0200
> @@ -122,9 +122,52 @@
>      return 0
>  }
>
> -# There is nothing to do for eglibc check config
> +# Copy user provided eglibc configuration file if provided
>  do_libc_check_config() {
> -    :
> +    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then
> +        return 0
> +    fi
> +
> +    CT_DoStep INFO "Checking C library configuration"
> +
> +    CT_TestOrAbort "You did not provide an eglibc config file!" \
> +        -n "${CT_EGLIBC_OPTION_GROUPS_FILE}" -a \
> +        -f "${CT_EGLIBC_OPTION_GROUPS_FILE}"
> +
> +    CT_DoExecLog ALL cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config"
> +
> +    # NSS configuration
> +    if grep -E '^OPTION_EGLIBC_NSSWITCH[\t ]*=[\t ]*n' "${CT_EGLIBC_OPTION_GROUPS_FILE}" >/dev/null 2>&1; then

Use [[:space:]] instead of [\t ]

CT_DoLog DEBUG "Using fixed-configuration nsswitch facility"
(as opposed to "full-blown", in the else part, below).

> +        nss_config="${CT_CONFIG_DIR}/nsswitch.config"
> +        nss_functions="${CT_CONFIG_DIR}/nsswitch.functions"

These two assignements are overriden in the following lines.

> +        if [ "${CT_EGLIBC_BUNDLED_NSS_CONFIG}" = "y" ]; then
> +            nss_config="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.conf
> +        else
> +            nss_config="${CT_EGLIBC_NSS_CONFIG}"
> +        fi
> +
> +        if [ "${CT_EGLIBC_BUNDLED_NSS_FUNCTIONS}" = "y" ]; then
> +            nss_functions="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.functions"
> +        else
> +            nss_functions="${CT_EGLIBC_NSS_FUNCTIONS}"
> +        fi
> +
> +        CT_TestOrAbort "NSS config file not found!" -n "${nss_config}" -a -f "${nss_config}"
> +        CT_DoExecLog ALL cp "${nss_config}" "${CT_CONFIG_DIR}/nsswitch.config"

Move the check up a few lines, so it is next to the nss_config assignement
(no need for a new line between the assignement and the check).

> +        CT_TestOrAbort "NSS functions file not found!" -n "${nss_functions}" -a -f "${nss_functions}"
> +        CT_DoExecLog ALL cp "${nss_functions}" "${CT_CONFIG_DIR}/nsswitch.functions"
> +
> +        echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG => ${CT_CONFIG_DIR}/nsswitch.config" \
> +            >> "${CT_CONFIG_DIR}/eglibc.config"
> +        echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \
> +            >> "${CT_CONFIG_DIR}/eglibc.config"
> +    else
> +        CT_DoLog DEBUG "Not using nsswitch fixed configuration"

"Using full-blown nsswitch facility" ?

> +    fi
> +
> +    CT_EndStep
>  }
>
>  # This function installs the eglibc headers needed to build the core
> compiler @@ -143,6 +186,10 @@
>
>      CT_DoLog EXTRA "Configuring C library"
>
> +    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
> +        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
> +    fi
> +
>      cross_cc=$(CT_Which "${CT_TARGET}-gcc")
>      cross_cxx=$(CT_Which "${CT_TARGET}-g++")
>      cross_ar=$(CT_Which "${CT_TARGET}-ar")
> @@ -210,6 +257,10 @@
>
>      CT_DoLog EXTRA "Configuring C library"
>
> +    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
> +        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
> +    fi
> +
>      # Add some default glibc config options if not given by user.
>      # We don't need to be conditional on wether the user did set different
>      # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config


--
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'



--
For unsubscribe information see http://sourceware.org/lists.html#faq


Re: [PATCH] use eglibc configuration file

by Arnaud Vrac-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Arnaud Vrac wrote:

> Yann E. MORIN wrote:
>> OK. From what I understand, there already is a set of "NSS config
>> file" and "NSS functions file" bundled with eglibc, and that they are
>> enough
>> for a non-esoteric system. May be ask the user if he/she wants to use
>> those files, or if he/she wants to use his/her own set. Something like:
>>
>> [*] Use an option-groups configuration file
>> ()    Path to the option-groups configuration file
>> [ ]   Use bundled NSS config/functions files
>> ()      Path to the NSS config file
>> ()      Path to the NSS functions file
>>
>> That is, hide the paths to the NSS config/functions files.
>> Also, adapt the help entries accordingly.
>>
>> What do you think?
>
> Alright, I reworked the patch to do exactly that, and also actually made
> it work... The check_config function now checks if the nsswitch option
> group is disabled, and then copies the nss config/functions file in the
> ct-ng config directory.
>
Updated patch to follow your recommendations.

Regards,

--
Arnaud Vrac

# HG changeset patch
# User Arnaud Vrac <avrac@...>
# Date 1255098129 -7200
# Node ID 503237de146a58b98c96a86c15cd4254ae85eb6d
# Parent  8d386988dcb19ac9ab1facd450da319b03ffd02d
eglibc: add support for user provided option groups

Signed-off-by: Arnaud Vrac <avrac@...>

diff -r 8d386988dcb1 -r 503237de146a config/libc/eglibc.in
--- a/config/libc/eglibc.in Sun Oct 04 12:53:12 2009 +0200
+++ b/config/libc/eglibc.in Fri Oct 09 16:22:09 2009 +0200
@@ -90,3 +90,55 @@
       
       Note that crosstool-NG will *not* update your working copy, you will
       have to do that yourself.
+
+config EGLIBC_CUSTOM_CONFIG
+    bool
+    prompt "Use custom configuration file"
+    default n
+    help
+      Use a custom configuration file to disable some features in the eglibc
+      library. The configuration file options are described in detail in the
+      option-groups.def file in the eglibc source directory.
+
+if EGLIBC_CUSTOM_CONFIG
+    config EGLIBC_OPTION_GROUPS_FILE
+        string
+        prompt "Path to the option-groups configuration file"
+        default ""
+        help
+          Path to the option groups configuration file.
+
+    config EGLIBC_BUNDLED_NSS_CONFIG
+        bool
+        prompt "Use bundled NSS config file"
+        default y
+        help
+          Use minimal nsswitch configuration file bundled in eglibc.
+          This option is only meaningful when runtime nss configuration
+          is disabled in the option groups file.
+
+    config EGLIBC_NSS_CONFIG_FILE
+        string
+        prompt "Path to the NSS config file"
+        default ""
+        depends on !EGLIBC_BUNDLED_NSS_CONFIG
+        help
+          Path to the nsswitch configuration file
+
+    config EGLIBC_BUNDLED_NSS_FUNCTIONS
+        bool
+        prompt "Use bundled NSS functions file"
+        default y
+        help
+          Use minimal nsswitch functions file bundled in eglibc.
+          This option is only meaningful when runtime nss configuration
+          is disabled in the option groups file.
+
+    config EGLIBC_NSS_FUNCTIONS_FILE
+        string
+        prompt "Path to the NSS functions file"
+        default ""
+        depends on !EGLIBC_BUNDLED_NSS_FUNCTIONS
+        help
+          Path to the nsswitch functions file
+endif
diff -r 8d386988dcb1 -r 503237de146a scripts/build/libc/eglibc.sh
--- a/scripts/build/libc/eglibc.sh Sun Oct 04 12:53:12 2009 +0200
+++ b/scripts/build/libc/eglibc.sh Fri Oct 09 16:22:09 2009 +0200
@@ -122,9 +122,50 @@
     return 0
 }
 
-# There is nothing to do for eglibc check config
+# Copy user provided eglibc configuration file if provided
 do_libc_check_config() {
-    :
+    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then
+        return 0
+    fi
+
+    CT_DoStep INFO "Checking C library configuration"
+
+    CT_TestOrAbort "You did not provide an eglibc config file!" \
+        -n "${CT_EGLIBC_OPTION_GROUPS_FILE}" -a \
+        -f "${CT_EGLIBC_OPTION_GROUPS_FILE}"
+
+    CT_DoExecLog ALL cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config"
+
+    # NSS configuration
+    if grep -E '^OPTION_EGLIBC_NSSWITCH[[:space:]]*=[[:space:]]*n' "${CT_EGLIBC_OPTION_GROUPS_FILE}" >/dev/null 2>&1; then
+        CT_DoLog DEBUG "Using fixed-configuration nsswitch facility"
+
+        if [ "${CT_EGLIBC_BUNDLED_NSS_CONFIG}" = "y" ]; then
+            nss_config="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.conf"
+        else
+            nss_config="${CT_EGLIBC_NSS_CONFIG_FILE}"
+        fi
+        CT_TestOrAbort "NSS config file not found!" -n "${nss_config}" -a -f "${nss_config}"
+
+        CT_DoExecLog ALL cp "${nss_config}" "${CT_CONFIG_DIR}/nsswitch.config"
+        echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG = ${CT_CONFIG_DIR}/nsswitch.config" \
+            >> "${CT_CONFIG_DIR}/eglibc.config"
+
+        if [ "${CT_EGLIBC_BUNDLED_NSS_FUNCTIONS}" = "y" ]; then
+            nss_functions="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.functions"
+        else
+            nss_functions="${CT_EGLIBC_NSS_FUNCTIONS_FILE}"
+        fi
+        CT_TestOrAbort "NSS functions file not found!" -n "${nss_functions}" -a -f "${nss_functions}"
+
+        CT_DoExecLog ALL cp "${nss_functions}" "${CT_CONFIG_DIR}/nsswitch.functions"
+        echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \
+            >> "${CT_CONFIG_DIR}/eglibc.config"
+    else
+        CT_DoLog DEBUG "Using full-blown nsswitch facility"
+    fi
+
+    CT_EndStep
 }
 
 # This function installs the eglibc headers needed to build the core compiler
@@ -143,6 +184,10 @@
 
     CT_DoLog EXTRA "Configuring C library"
 
+    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
+        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
+    fi
+
     cross_cc=$(CT_Which "${CT_TARGET}-gcc")
     cross_cxx=$(CT_Which "${CT_TARGET}-g++")
     cross_ar=$(CT_Which "${CT_TARGET}-ar")
@@ -210,6 +255,10 @@
 
     CT_DoLog EXTRA "Configuring C library"
 
+    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
+        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
+    fi
+
     # Add some default glibc config options if not given by user.
     # We don't need to be conditional on wether the user did set different
     # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config


--
For unsubscribe information see http://sourceware.org/lists.html#faq

Re: [PATCH] use eglibc configuration file

by Yann E. MORIN :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Arnaud,
All,

On Friday 09 October 2009 16:37:56 Arnaud Vrac wrote:
> Updated patch to follow your recommendations.

Applied! Thank you for staying onboard through the iterations!

Regards,
Yann E. MORIN.

--
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'



--
For unsubscribe information see http://sourceware.org/lists.html#faq