Bug 244695 - devel/apr1: post-patch breaks tomcat-native build with gmake
Summary: devel/apr1: post-patch breaks tomcat-native build with gmake
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-apache (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-09 13:29 UTC by Michael Osipov
Modified: 2020-03-15 14:38 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (apache)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Osipov 2020-03-09 13:29:20 UTC
Tomcat committer here, just discovered this while working on upstream patches for tomcat-native on FreeBSD.

This happens when building from tomcat-native.git as well as source tarball 1.2.23. This does not happen with www/tomcat-native (explanation follows).

After performing ./buildconf and ./configure, gmake says:
> osipovmi@deblndw011x:~/var/Projekte/tomcat-native/native (master %=)
> $ LC_ALL=C gmake
> gmake: *** No rule to make target '.MAKE', needed by 'all-recursive'.  Stop.

But there is no such target in tcnative.
> osipovmi@deblndw011x:~/var/Projekte/tomcat-native/native (master %=)
> $ grep -r \\.MAKE .
> ./build/rules.mk:all-recursive depend-recursive: .MAKE
> ./build/rules.mk:clean-recursive distclean-recursive extraclean-recursive: .MAKE

./build/rules.mk is copied during ./configure from
> cp /usr/local/share/apr/build-1/apr_rules.mk /net/home/osipovmi/var/Projekte/tomcat-native/native/build/rules.mk

which is
> osipovmi@deblndw011x:~/var/Projekte/tomcat-native/native (master %=)
> $ grep -r \\.MAKE /usr/local/share/apr/build-1/apr_rules.mk
> all-recursive depend-recursive: .MAKE
> clean-recursive distclean-recursive extraclean-recursive: .MAKE

I have then compiled apr-1.7.x straight from the Subversion repo from ASF and see:
> osipovmi@deblndw011x:/tmp/apr-1.7.x
> $ grep -r \\.MAKE build-1/

So this exists in the port only. It turns out that the port Makefile does this
> root@deblndw011x:/usr/ports/devel/apr1
> # svn diff
> Index: Makefile
> ===================================================================
> --- Makefile    (revision 528101)
> +++ Makefile    (working copy)
> @@ -128,8 +128,6 @@
>  post-patch:
>         @${REINPLACE_CMD} -e 's/OSVERSION/${OSVERSION}/g' \
>                 ${APR_WRKDIR}/configure
> -       @${REINPLACE_CMD} -e '/recursive:/s/$$/ .MAKE/' \
> -               ${APR_WRKDIR}/build/apr_rules.mk.in

coming from
> root@deblndw011x:/usr/ports/devel/apr1
> # svn log -c322367  Makefile
> ------------------------------------------------------------------------
> r322367 | ohauer | 2013-07-06 10:43:48 +0200 (Sat, 06 Jul 2013) | 16 lines

https://lists.freebsd.org/pipermail/freebsd-apache/2013-June/003177.html reveals:
* Mark recursive targets with .MAKE to fix parallel builds with bmake.

Whether this is still required today and why BSD make ignores .MAKE, I don't know. gmake chokes on it with tomcat-native.

The reason why www/tomcat-native never failed is that patch-Makefile.in removes gmake recipes and makes it bmake compliant. If you force gmake, it will instantly fail.
If this post-patch is still required, it shall be removed with pre-install, but no later than in STAGEDIR. This will make this Makefile work with bmake AND gmake.
Comment 1 Jochen Neumeister freebsd_committer 2020-03-13 09:56:36 UTC
Hello and thanks for the PR.
I'm still working on NGINX right now, but I hope to take care of your PR next week.
Comment 2 Michael Osipov 2020-03-13 09:57:51 UTC
(In reply to Jochen Neumeister from comment #1)

Thank you, looking for your review.
Comment 3 Jochen Neumeister freebsd_committer 2020-03-14 21:00:09 UTC
If I understand this correctly, will deleting these two lines solve your problem?

> -       @${REINPLACE_CMD} -e '/recursive:/s/$$/ .MAKE/' \
> -               ${APR_WRKDIR}/build/apr_rules.mk.in
Comment 4 Michael Osipov 2020-03-14 22:53:41 UTC
(In reply to Jochen Neumeister from comment #3)

Correct, apr_rules.mk.in should not be installed in an altered fashion.
Comment 5 commit-hook freebsd_committer 2020-03-15 13:27:14 UTC
A commit references this bug:

Author: brnrd
Date: Sun Mar 15 13:26:22 UTC 2020
New revision: 528485
URL: https://svnweb.freebsd.org/changeset/ports/528485

Log:
  devel/apr1: Fix tomcat-native build

   * Remove modification to build/apr_rules.mk introduced
     in r322367. No further documentation on change found.

  With hat:	apache
  PR:		244695
  Submitted by:	Michael Osipov <michael osipov siemens com>

Changes:
  head/devel/apr1/Makefile
Comment 6 Michael Osipov 2020-03-15 14:35:13 UTC
Works as expected now for me.