[LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

Daniel Kahn Gillmor-7
* doc/Makefile.am (yat2m): use standard compiler flags when not
cross-building.
--

We ship yat2m when not cross-building.  This means that yat2m ought to
be built with the same flags that other native tools are built with.

Signed-off-by: Daniel Kahn Gillmor <[hidden email]>
---
 doc/Makefile.am | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/Makefile.am b/doc/Makefile.am
index d052283..b82d7bf 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -35,8 +35,13 @@ myman_pages   = gpg-error-config.1
 man_MANS = $(myman_pages)
 
 yat2m: yat2m.c
+if CROSS_COMPILING
  $(CC_FOR_BUILD) -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" \
                 -o $@ $(srcdir)/yat2m.c
+else
+ $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" \
+                -o $@ $(srcdir)/yat2m.c
+endif
 
 
 yat2m-stamp: $(myman_sources)
--
2.15.1


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

Re: [LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

Werner Koch
On Tue,  6 Feb 2018 03:53, [hidden email] said:

> We ship yat2m when not cross-building.  This means that yat2m ought to
> be built with the same flags that other native tools are built with.

>  yat2m: yat2m.c
> +if CROSS_COMPILING
>   $(CC_FOR_BUILD) -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" \
>                  -o $@ $(srcdir)/yat2m.c
> +else
> + $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" \
> +                -o $@ $(srcdir)/yat2m.c
> +endif

The last line should be

  $(COMPILE) -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\""  \
             -o $@ $(srcdir)/yat2m.c

so that all flags (in particular AM_CFLAGS) as used as usually.  More
elegant would be to insert

--8<---------------cut here---------------start------------->8---
if CROSS_COMPILING
COMPILE_NATIVE_OR_CROSS = $(CC_FOR_BUILD)
else
COMPILE_NATIVE_OR_CROSS = $(COMPILE)
endif
--8<---------------cut here---------------end--------------->8---

at the top and use

--8<---------------cut here---------------start------------->8---
yat2m: yat2m.c
  $(COMPILE_NATIVE_OR_CROSS) -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" \
                                   -o $@ $(srcdir)/yat2m.c
--8<---------------cut here---------------end--------------->8---



Shalom-Salam,

   Werner


--
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

attachment0 (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

Daniel Kahn Gillmor-7
On Tue 2018-02-06 18:14:28 +0100, Werner Koch wrote:
> so that all flags (in particular AM_CFLAGS) as used as usually.  More
> elegant would be […]

Any of these work for me.  Feel free to commit the version that you
think is the most elegant :)

thanks,

      --dkg

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (847 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

Daniel Kahn Gillmor-7
On Tue 2018-02-06 12:36:57 -0500, Daniel Kahn Gillmor wrote:
> On Tue 2018-02-06 18:14:28 +0100, Werner Koch wrote:
>> so that all flags (in particular AM_CFLAGS) as used as usually.  More
>> elegant would be […]
>
> Any of these work for me.  Feel free to commit the version that you
> think is the most elegant :)

i tried to get the proposed elegant way to work, but my autotools-fu is
too weak to do that effectively (i ended up with COMPILE_NATIVE_OR_CROSS
being empty somehow) so i'm sticking with the earlier proposed form for
the debian packaging.  I'd really appreciate having some flavor of this
merged upstream, though.  if you're ok with the inelegant form, i'm
happy to push the commit.  if you want the other form, i'm also happy to
follow your lead.

let me know what you think are the right next steps!

       --dkg

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

NIIBE Yutaka
Daniel Kahn Gillmor <[hidden email]> wrote:
> i tried to get the proposed elegant way to work, but my autotools-fu is
> too weak to do that effectively (i ended up with COMPILE_NATIVE_OR_CROSS
> being empty somehow) so i'm sticking with the earlier proposed form for
> the debian packaging.

I don't think the elegant way works.  Since there is nothing for
PROGRAMS, doc/Makefile.in won't have the COMPILE variable.

Why not simpler solution?

Now (1.28) yat2m is installed by libgpg-error, but it's strange for me
that it's for native build only.

I think that we should add:

        bin_PROGRAMS = yat2m

so that it will be built and installed (even for cross compiling).

And then, configure should detect yat2m on the build system, which will
convert .texi files to man.

It is possible to support cross compiling with no yat2m installed on the
build system yet, but I don't think we should support this situation.
Perhaps, it would be better to support this situation, though.
--

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

Re: [LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

NIIBE Yutaka
In reply to this post by Daniel Kahn Gillmor-7
I meant a change like this:

==========================
diff --git a/configure.ac b/configure.ac
index 1e648d1..3918e74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,8 @@ AM_PROG_CC_C_O
 AC_PROG_CPP
 AC_PROG_AWK
 AC_CHECK_TOOL(AR, ar, :)
+AC_PATH_PROG(YAT2M, "yat2m", "./yat2m" )
+AC_ARG_VAR(YAT2M, [tool to convert texi to man pages])
 AC_GNU_SOURCE
 
 # Set some variables depending on the platform for later use.
diff --git a/doc/Makefile.am b/doc/Makefile.am
index d052283..328089a 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -17,11 +17,14 @@
 # License along with this program; if not, see <https://www.gnu.org/licenses/>.
 
 
-EXTRA_DIST = HACKING errorref.txt \
-     yat2m.c
+EXTRA_DIST = HACKING errorref.txt
+
+bin_PROGRAMS = yat2m
+yat2m_SOURCES = yat2m.c
+yat2m_CFLAGS= -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\""
 
 DISTCLEANFILES = gpgrt.cps yat2m-stamp.tmp yat2m-stamp $(myman_pages)
-CLEANFILES = yat2m errorref.txt.x
+CLEANFILES = errorref.txt.x
 
 info_TEXINFOS = gpgrt.texi
 gpgrt_TEXINFOS = lgpl.texi gpl.texi
@@ -34,20 +37,15 @@ myman_pages   = gpg-error-config.1
 
 man_MANS = $(myman_pages)
 
-yat2m: yat2m.c
- $(CC_FOR_BUILD) -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" \
-                -o $@ $(srcdir)/yat2m.c
-
-
 yat2m-stamp: $(myman_sources)
  @rm -f yat2m-stamp.tmp
  @touch yat2m-stamp.tmp
  for file in $(myman_sources) ; do \
-              ./yat2m $(YAT2M_OPTIONS) --store \
+              $(YAT2M) $(YAT2M_OPTIONS) --store \
           `test -f '$$file' || echo '$(srcdir)/'`$$file ; done
  @mv -f yat2m-stamp.tmp $@
 
-yat2m-stamp: yat2m
+yat2m-stamp: $(YAT2M)
 
 $(myman_pages) : yat2m-stamp
  @if test -f $@; then :; else \
@@ -72,22 +70,9 @@ errorref.txt.x : errorref.txt
  sed '/^##/ d' $< >$@
  echo "# Installed by $(PACKAGE_NAME) $(PACKAGE_VERSION)" >>$@
 
-install-exec-hook:
-if CROSS_COMPILING
- @echo "not install yat2m while cross-compiling"
-else
- @echo "installing yat2m on the build system"; \
-         $(MKDIR_P) "$(DESTDIR)$(bindir)"; \
- $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \
-         yat2m "$(DESTDIR)$(bindir)/yat2m"
-endif
-
 install-data-local: errorref.txt.x
  $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
  $(INSTALL_DATA) errorref.txt.x $(DESTDIR)$(pkgdatadir)/errorref.txt
 
 uninstall-local:
  -@rm $(DESTDIR)$(pkgdatadir)/errorref.txt
-if !CROSS_COMPILING
- -@rm $(DESTDIR)$(bindir)/yat2m
-endif
--

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

Re: [LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

Werner Koch
In reply to this post by NIIBE Yutaka
On Tue, 20 Mar 2018 06:58, [hidden email] said:

> Now (1.28) yat2m is installed by libgpg-error, but it's strange for me
> that it's for native build only.

Well, I don't see a reason to build it for the target (host) platform
when cross-compiling.  yat2m is a tool which is used to build software
so when you are cross-compiling it should have been installed.

> It is possible to support cross compiling with no yat2m installed on the
> build system yet, but I don't think we should support this situation.

We already have or will soon have other developments tools in
libgpg-error as well.  For example the gitlog-to-changelog which will
eventually be moved from gnupg to libgpg-error.

Is there a real need to cross-build development tools?
 

Shalom-Salam,

   Werner


--
#  Please read:  Daniel Ellsberg - The Doomsday Machine  #
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

attachment0 (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

NIIBE Yutaka
In reply to this post by Daniel Kahn Gillmor-7
Here is updated version.

* For cross compile, configure requires yat2m on the build machine.

* For cross compile, yat2m is built and installed.

* For native compile, we support the situation yat2m is not yet
  installed.  In this case, we use yat2m now being built.

==========================
diff --git a/configure.ac b/configure.ac
index 1e648d1..2c23734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,7 @@ AM_PROG_CC_C_O
 AC_PROG_CPP
 AC_PROG_AWK
 AC_CHECK_TOOL(AR, ar, :)
+AC_ARG_VAR(YAT2M, [tool to convert texi to man pages])
 AC_GNU_SOURCE
 
 # Set some variables depending on the platform for later use.
@@ -138,6 +139,14 @@ fi
 AC_MSG_RESULT($CC_FOR_BUILD)
 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
 
+AC_PATH_PROG(YAT2M, yat2m, ./yat2m)
+if test "$cross_compiling" = "yes" -a ac_cv_path_YAT2M = "./yat2m"; then
+   AC_MSG_ERROR([[
+***
+*** yat2m is not installed on this build system.  Please install.
+***]])
+fi
+
 
 AH_BOTTOM([
 /* Force using of NLS for W32 even if no libintl has been found.  This is
diff --git a/doc/Makefile.am b/doc/Makefile.am
index d052283..328089a 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -17,11 +17,14 @@
 # License along with this program; if not, see <https://www.gnu.org/licenses/>.
 
 
-EXTRA_DIST = HACKING errorref.txt \
-     yat2m.c
+EXTRA_DIST = HACKING errorref.txt
+
+bin_PROGRAMS = yat2m
+yat2m_SOURCES = yat2m.c
+yat2m_CFLAGS= -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\""
 
 DISTCLEANFILES = gpgrt.cps yat2m-stamp.tmp yat2m-stamp $(myman_pages)
-CLEANFILES = yat2m errorref.txt.x
+CLEANFILES = errorref.txt.x
 
 info_TEXINFOS = gpgrt.texi
 gpgrt_TEXINFOS = lgpl.texi gpl.texi
@@ -34,20 +37,15 @@ myman_pages   = gpg-error-config.1
 
 man_MANS = $(myman_pages)
 
-yat2m: yat2m.c
- $(CC_FOR_BUILD) -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" \
-                -o $@ $(srcdir)/yat2m.c
-
-
 yat2m-stamp: $(myman_sources)
  @rm -f yat2m-stamp.tmp
  @touch yat2m-stamp.tmp
  for file in $(myman_sources) ; do \
-              ./yat2m $(YAT2M_OPTIONS) --store \
+              $(YAT2M) $(YAT2M_OPTIONS) --store \
           `test -f '$$file' || echo '$(srcdir)/'`$$file ; done
  @mv -f yat2m-stamp.tmp $@
 
-yat2m-stamp: yat2m
+yat2m-stamp: $(YAT2M)
 
 $(myman_pages) : yat2m-stamp
  @if test -f $@; then :; else \
@@ -72,22 +70,9 @@ errorref.txt.x : errorref.txt
  sed '/^##/ d' $< >$@
  echo "# Installed by $(PACKAGE_NAME) $(PACKAGE_VERSION)" >>$@
 
-install-exec-hook:
-if CROSS_COMPILING
- @echo "not install yat2m while cross-compiling"
-else
- @echo "installing yat2m on the build system"; \
-         $(MKDIR_P) "$(DESTDIR)$(bindir)"; \
- $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \
-         yat2m "$(DESTDIR)$(bindir)/yat2m"
-endif
-
 install-data-local: errorref.txt.x
  $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
  $(INSTALL_DATA) errorref.txt.x $(DESTDIR)$(pkgdatadir)/errorref.txt
 
 uninstall-local:
  -@rm $(DESTDIR)$(pkgdatadir)/errorref.txt
-if !CROSS_COMPILING
- -@rm $(DESTDIR)$(bindir)/yat2m
-endif
--

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

Re: [LIBGPG-ERROR PATCH] doc: use compiler flags for yat2m when not cross-built.

Daniel Kahn Gillmor-7
In reply to this post by Werner Koch
On Tue 2018-03-20 08:25:56 +0100, Werner Koch wrote:

> On Tue, 20 Mar 2018 06:58, [hidden email] said:
>
>> Now (1.28) yat2m is installed by libgpg-error, but it's strange for me
>> that it's for native build only.
>
> Well, I don't see a reason to build it for the target (host) platform
> when cross-compiling.  yat2m is a tool which is used to build software
> so when you are cross-compiling it should have been installed.
>
>> It is possible to support cross compiling with no yat2m installed on the
>> build system yet, but I don't think we should support this situation.
>
> We already have or will soon have other developments tools in
> libgpg-error as well.  For example the gitlog-to-changelog which will
> eventually be moved from gnupg to libgpg-error.
>
> Is there a real need to cross-build development tools?

if you're trying to bootstrap a new platform, cross-building *some*
development tools can be pretty useful.

in this case, though, i don't think yat2m qualifies.  The bootstrap
itself doesn't need documentation -- once you've bootstrapped, you can
re-build natively and the native re-build can include the documentation
development tools.

            --dkg


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel