git: Add localedef(1), a locale definition generator tool

John Marino marino at
Tue Jul 28 10:58:45 PDT 2015

commit cd1c60858dc5ce0eb760fdf2eb6eed57cb251abd
Author: John Marino <draco at>
Date:   Tue Jul 28 18:31:53 2015 +0200

    Add localedef(1), a locale definition generator tool
    The localedef tool can read entire (and unmodified) CLDR posix definition
    files, and generate all 6 LC categories: LC_COLLATE, LC_CTYPE, LC_TIME,
    The last 4 of those aren't needed.  We already have a tool that generates
    msgdef, timedef, moneydef and numericdef.  In the immediate future,
    localedef will only be used generate LC_COLLATE files in a new format.
    This will render colldef files unreadable, thus colldef will be removed
    when this happens.
    In the future, localedef will be tasked to generate LC_CTYPE files as
    well.  When that happens, the mklocale tool will be retired.
    While localedef *can* read pristine POSIX files (which causes 6 files
    to be generated), it will given files with only the LC_COLLATE part,
    which will also have all the white space removed as well.  Remove just
    the spaces can save megabytes.
    This tool has a long history with Solaris [1].  The Nexenta developers
    modified it to read CLDR files and created the much richer collation
    formats.  The libc collation functions have to be modified to read the
    new format (called "DragonFly-4.4") and to handle the new data structures.
    The result will be that locale-sensitive tools and functions will now
    properly sort multibyte and unicode strings.  Our "BSD" sort is not locale
    sensitive, so it will probably have to be replaced with GNU sort in order
    to leverage our new collation capabilities.
    This can't be hooked into the build yet.  It needs the new header for
    collate.c to define the data structures.  Until that happens, this is
    actually unbuildable.
    [1] Linux also has a tool called localdef, but I do know know if it shares
        a common history or if it uses CLDR POSIX files.  It seems to have the
        same purpose though.

Summary of changes:
 usr.bin/localedef/Makefile    |   24 +
 usr.bin/localedef/avl.c       |  997 ++++++++++++++++++++++++++++++++
 usr.bin/localedef/avl.h       |  323 +++++++++++
 usr.bin/localedef/avl_impl.h  |  164 ++++++
 usr.bin/localedef/charmap.c   |  346 +++++++++++
 usr.bin/localedef/collate.c   | 1283 +++++++++++++++++++++++++++++++++++++++++
 usr.bin/localedef/ctype.c     |  448 ++++++++++++++
 usr.bin/localedef/localedef.1 |  238 ++++++++
 usr.bin/localedef/localedef.c |  331 +++++++++++
 usr.bin/localedef/localedef.h |  157 +++++
 usr.bin/localedef/messages.c  |  105 ++++
 usr.bin/localedef/monetary.c  |  200 +++++++
 usr.bin/localedef/numeric.c   |  108 ++++
 usr.bin/localedef/parser.y    |  693 ++++++++++++++++++++++
 usr.bin/localedef/scanner.c   |  851 +++++++++++++++++++++++++++
 usr.bin/localedef/time.c      |  264 +++++++++
 usr.bin/localedef/wide.c      |  652 +++++++++++++++++++++
 17 files changed, 7184 insertions(+)
 create mode 100644 usr.bin/localedef/Makefile
 create mode 100644 usr.bin/localedef/avl.c
 create mode 100644 usr.bin/localedef/avl.h
 create mode 100644 usr.bin/localedef/avl_impl.h
 create mode 100644 usr.bin/localedef/charmap.c
 create mode 100644 usr.bin/localedef/collate.c
 create mode 100644 usr.bin/localedef/ctype.c
 create mode 100644 usr.bin/localedef/localedef.1
 create mode 100644 usr.bin/localedef/localedef.c
 create mode 100644 usr.bin/localedef/localedef.h
 create mode 100644 usr.bin/localedef/messages.c
 create mode 100644 usr.bin/localedef/monetary.c
 create mode 100644 usr.bin/localedef/numeric.c
 create mode 100644 usr.bin/localedef/parser.y
 create mode 100644 usr.bin/localedef/scanner.c
 create mode 100644 usr.bin/localedef/time.c
 create mode 100644 usr.bin/localedef/wide.c

DragonFly BSD source repository

More information about the Commits mailing list