bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Use UTF-8 active code page for Windows host.


From: Eli Zaretskii
Subject: Re: [PATCH] Use UTF-8 active code page for Windows host.
Date: Sat, 25 Mar 2023 15:09:55 +0300

> From: Costas Argyris <costas.argyris@gmail.com>
> Date: Tue, 21 Mar 2023 15:08:52 +0000
> Cc: bug-make@gnu.org, Paul Smith <psmith@gnu.org>
> 
> > You can submit diffs against the last released version here as well.
> 
> In that case, I am simply re-attaching the patch I originally sent in
> this thread, because that was already developed and built on 4.4.1
> tarball which is still the latest AFAICT.
> 
> Just reminding that these changes are in Makefile.am and configure.ac
> so you would have to build using that approach to actually get a
> UTF-8 Make on Windows host.
> 
> The other two files of the patch, utf8.manifest and utf8.rc will be
> useful for the build_w32.bat approach as well because they will
> be reused by it (I don't see a reason why not).

OK.

Paul, I'd appreciate your review as well, as I'm less familiar with
the Posix configury of Make, and could easily miss some subtle issue.

Looking at the patch now, I have a few minor comments:

> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -46,6 +46,8 @@ w32_SRCS =  src/w32/pathstuff.c src/w32/w32os.c 
> src/w32/compat/dirent.c \
>               src/w32/subproc/misc.c src/w32/subproc/proc.h \
>               src/w32/subproc/sub_proc.c src/w32/subproc/w32err.c
>  
> +w32_utf8_SRCS = src/w32/utf8.rc src/w32/utf8.manifest
> +
>  vms_SRCS =   src/vms_exit.c src/vms_export_symbol.c src/vms_progname.c \
>               src/vmsdir.h src/vmsfunctions.c src/vmsify.c
>  
> @@ -90,6 +92,14 @@ else
>    make_SOURCES += src/posixos.c
>  endif
>  
> +if HAVE_WINDRES
> +  UTF8OBJ     = src/w32/utf8.$(OBJEXT)
> +  make_LDADD += $(UTF8OBJ)
> +endif
> +
> +$(UTF8OBJ) : $(w32_utf8_SRCS)
> +     $(WINDRES) $< -o $@
> +
>  if USE_CUSTOMS
>    make_SOURCES += src/remote-cstms.c
>  else
> diff --git a/configure.ac b/configure.ac
> index cd78575..8cbf986 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -444,6 +444,7 @@ AC_SUBST([MAKE_HOST])
>  
>  w32_target_env=no
>  AM_CONDITIONAL([WINDOWSENV], [false])
> +AM_CONDITIONAL([HAVE_WINDRES], [false])
>  
>  AS_CASE([$host],
>    [*-*-mingw32],
> @@ -451,6 +452,10 @@ AS_CASE([$host],
>      w32_target_env=yes
>      AC_DEFINE([WINDOWS32], [1], [Build for the WINDOWS32 API.])
>      AC_DEFINE([HAVE_DOS_PATHS], [1], [Support DOS-style pathnames.])
> +    # Windows host tools.
> +    # If windres is available, make will use UTF-8.
> +    AC_CHECK_TOOL([WINDRES], [windres], [:])
> +    AM_CONDITIONAL([HAVE_WINDRES], [test "$WINDRES" != ':'])
>    ])
>  
>  AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],

I think instead of using "if HAVE_WINDRES" it would be better to have
UTF8OBJ to be computed by configure, leaving it empty on builds that
don't target Windows.  That's because AC_CHECK_TOOL test for 'windres'
might not be the bets future proof text: users could have that
installed for reasons unrelated to the build target.

If my suggestion is accepted, the make_LDADD addition will not be
needed; instead make_LDADD will always mention $(UTF8OBJ), and the
value will be empty when not building for Windows.

Also, I'd name the files slightly differently, something like
w32-utf8.*, to make their relation to Windows more evident.

Finally, would we want to install the manifest file together with the
executable, and if so, should its installation name be
make.exe.manifest?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]