Bug 197234

Summary: [UPDATE] lang/execline: update to 2.0.2.0 and take maintainership
Product: Ports & Packages Reporter: Colin Booth <colin-ports>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Only Me CC: jbeich
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 197233    
Bug Blocks: 197235    
Attachments:
Description Flags
unified diff to bump lang/execline to current
none
Updated Makefile with advice from Jan Beich
none
Updated patch none

Description Colin Booth 2015-02-01 06:11:57 UTC
Created attachment 152430 [details]
unified diff to bump lang/execline to current

I'm using s6 for supervision and the execline and skalibs in ports is very out of date. This updates the execline in ports to use 2.0.0.0.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2015-02-03 20:34:53 UTC
Comment on attachment 152430 [details]
unified diff to bump lang/execline to current

> +LDFLAGS?=	-s
> +STRIPFLAGS?=	-x

Better use ${STRIP} or depend on ! ${PORT_OPTIONS:MDEBUG} and maybe use vendor `strip` make target e.g.,

  # STRIP can only be `-s` or empty
  ALL_TARGET=	all ${STRIP:S/-s/strip/}

> +CC?=		cc

CC is always defined by sys.mk (fmake, bmake) or embedded (gmake).

> +WRKSRC=		${WRKDIR}/${DISTNAME}

No need to redefine the default value.

> +USES=		${GMAKE}

This works only by accident because the path to GNU make isn't an absolute one.

> +	cd ${WRKSRC} && CC=${CC} ./configure \
> +	--prefix=${LOCALBASE} \
> +	--with-default-path=${LOCALBASE}/bin:/usr/bin:/bin \
> +	--with-include=${LOCALBASE}/include \
> +	--with-lib=${LOCALBASE}/lib/skalibs \
> +	--enable-shared

Define HAS_CONFIGURE and populate CONFIGURE_ARGS. This would also fix a case where CC contains spaces e.g.,

  CC = distcc ccache gcc

>  do-build:
> +	cd ${WRKSRC} && ${GMAKE}

Drop custom do-build and maybe define empty ALL_TARGET if `all` doesn't work.

>  do-install:
> +	cd ${WRKSRC} && DESTDIR=${STAGEDIR} ${GMAKE} install

Why not use default do-install and move the following lines under post-install?

> 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
> +	cd ${WRKSRC} && ${INSTALL_MAN} ${DOCS} ${STAGEDIR}${DOCSDIR}

INSTALL_MAN is for manpages only. Other docs should use INSTALL_DATA.

> +lib/libexecline.so
> +lib/libexecline.so.2

This requires USE_LDCONFIG in Makefile.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2015-02-03 21:04:40 UTC
Comment on attachment 152430 [details]
unified diff to bump lang/execline to current

> +	--prefix=${LOCALBASE} \

This would break install if PREFIX != LOCALBASE i.e., poudriere testport -P. You may need to pass --with-sysdeps as well to unbreak it.
Comment 3 Jan Beich freebsd_committer freebsd_triage 2015-02-03 21:33:52 UTC
(In reply to Jan Beich from comment #1)
>> 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
>> +	cd ${WRKSRC} && ${INSTALL_MAN} ${DOCS} ${STAGEDIR}${DOCSDIR}
>
> INSTALL_MAN is for manpages only. Other docs should use INSTALL_DATA.

Nevermind, Porter's Handbook disagrees with me. I was confused by bsd.own.mk using MANMODE for something else and INSTALL_DATA now uses 0644 mode since ports r367307.
Comment 4 Colin Booth 2015-02-05 06:52:57 UTC
(In reply to Jan Beich from comment #1)

>> +LDFLAGS?=	-s
>> +STRIPFLAGS?=	-x

>Better use ${STRIP} or depend on ! ${PORT_OPTIONS:MDEBUG} and maybe use vendor >`strip` make target e.g.,

>  # STRIP can only be `-s` or empty
>  ALL_TARGET=	all ${STRIP:S/-s/strip/}
Adapted from the old Makefile for skalibs in ports. I'll yank those out because it doesn't run strip by default anyway. 

>> +CC?=		cc
>CC is always defined by sys.mk (fmake, bmake) or embedded (gmake).

>> +WRKSRC=		${WRKDIR}/${DISTNAME}
>No need to redefine the default value.

You're right on both counts. I thought I'd have to force-define what the default cc pointed to since without specifying CC=${CC} the upstream Makefile autodetects a compiler that doesn't support the -i flag. As for WRKSRC, I don't know why I didn't think that came included.

>> +USES=		${GMAKE}
>This works only by accident because the path to GNU make isn't an absolute one.

That was on the suggestion of portlint since building execline (and skalibs and s6) don't work with the stock make and I'm working around a reasonably linux-tools centric design.

>Define HAS_CONFIGURE and populate CONFIGURE_ARGS. This would also fix a case where CC contains spaces e.g.,
Unless I'm reading the porters stuff wrong HAS_CONFIGURE only works with autoconf and its ilk. Since skalibs et. al. don't use autotools I'm going to omit HAS_CONFIGURE (it seems to be ignored). However, that appears to mean that I need the CC=${CC} definition which breaks if there's a multiple item CC definition. If I find out a better way to override this, I'll fix it.

>do-build...
>do-install...
>use post-install...
All good suggestions and updated. 

>> +lib/libexecline.so
>> +lib/libexecline.so.2
>This requires USE_LDCONFIG in Makefile.
Missed that in the port handbook. Updated.

>> +	--prefix=${LOCALBASE} \
>This would break install if PREFIX != LOCALBASE i.e., poudriere testport -P. >You may need to pass --with-sysdeps as well to unbreak it.
Changed all LOCALBASE to PREFIX though that's still going to break if skalibs isn't going to be installed in the same root tree since execline needs to find the skalibs headers and I'm unaware of a good way of autodetecting that. 

Related to that, I've debated whether to static link libskarnet into the execline binaries. On the one hand dynamic linking is the standard, on the other it's nice to have the only external runtime dependency be your libc for things like proces supervisors. Since there's already a compile-time dependency on skalibs being installed in the same PREFIX as execline I'm going to leave it the default (static linking) unless there's a serious argument in the other direction.

Thanks for the commentary and advice, the skarnet stuff is my first foray into porting so I'm sure I'll make mistakes along the way.
Comment 5 Jan Beich freebsd_committer freebsd_triage 2015-02-05 15:00:05 UTC
(In reply to Colin Booth from comment #4)
> (In reply to Jan Beich from comment #1)
>
>>> +LDFLAGS?=	-s
>>> +STRIPFLAGS?=	-x
>
>>Better use ${STRIP} or depend on ! ${PORT_OPTIONS:MDEBUG} and maybe use vendor `strip` make target e.g.,
>
>>  # STRIP can only be `-s` or empty
>>  ALL_TARGET=	all ${STRIP:S/-s/strip/}
> Adapted from the old Makefile for skalibs in ports. I'll yank those out because
> it doesn't run strip by default anyway.

Not stripping binaries at all would induce a warning:

  $ DEVELOPER=1 make
  ...
  ====> Running Q/A tests (stage-qa)
  Warning: 'bin/shift' is not stripped consider trying INSTALL_TARGET=install-strip or using ${STRIP_CMD}
  Warning: 'bin/pipeline' is not stripped consider trying INSTALL_TARGET=install-strip or using ${STRIP_CMD}
  ...

>>> +USES=		${GMAKE}
>>This works only by accident because the path to GNU make isn't an absolute one.
>
> That was on the suggestion of portlint since building execline (and skalibs and
> s6) don't work with the stock make and I'm working around a reasonably
> linux-tools centric design.

Many commands in Mk/bsd.commands.mk can be redefined by user or port maintainer.
USES=gmake is valid, but not USES=${GMAKE}. And portlint(1) is smarter nowadays not to print some bogus warnings.

>
>>Define HAS_CONFIGURE and populate CONFIGURE_ARGS. This would also fix
>> a case where CC contains spaces e.g.,
> Unless I'm reading the porters stuff wrong HAS_CONFIGURE only works with
> autoconf and its ilk. Since skalibs et. al. don't use autotools I'm going to
> omit HAS_CONFIGURE (it seems to be ignored). However, that appears to mean that
> I need the CC=${CC} definition which breaks if there's a multiple item CC
> definition. If I find out a better way to override this, I'll fix it.

HAS_CONFIGURE is for generic configure-like scripts. It has no assumption about GNU autoconf. Look for defined(HAS_CONFIGURE) in Mk/bsd.port.mk to see what exactly you'd get. To summarize, more environment variables passed by default, they're properly quoted

Also check other ports with HAS_CONFIGURE e.g., lang/ocaml or lang/perl5.18.

>>> +	--prefix=${LOCALBASE} \
>>This would break install if PREFIX != LOCALBASE i.e., poudriere
>> testport -P. >You may need to pass --with-sysdeps as well to unbreak
>> it.
> Changed all LOCALBASE to PREFIX though that's still going to break if skalibs
> isn't going to be installed in the same root tree since execline needs to find
> the skalibs headers and I'm unaware of a good way of autodetecting that. 

LOCALBASE is where dependencies are already installed. PREFIX is where
the current port is supposed to install. Before STAGEDIR support people
used to check pkg-plist by overrding PREFIX to a temporary location.

The following should be enough for LOCALBASE != PREFIX support.

  # devel/skalibs
  CONFIGURE_ARGS= --prefix=${PREFIX} \

  # lang/execline
  CONFIGURE_ARGS= --prefix=${PREFIX} \
          --with-sysdeps=${LOCALBASE}/lib/skalibs/sysdeps \
          --with-include=${LOCALBASE}/include \
          --with-lib=${LOCALBASE}/lib/skalibs \
Comment 6 Colin Booth 2015-02-05 15:10:49 UTC
Created attachment 152586 [details]
Updated Makefile with advice from Jan Beich
Comment 7 Colin Booth 2015-02-06 17:46:31 UTC
Created attachment 152628 [details]
Updated patch
Comment 8 commit-hook freebsd_committer freebsd_triage 2015-02-10 20:34:23 UTC
A commit references this bug:

Author: jbeich
Date: Tue Feb 10 20:33:54 UTC 2015
New revision: 378797
URL: https://svnweb.freebsd.org/changeset/ports/378797

Log:
  - devel/skalibs: update to 2.2.1.0 [1]
  - lang/execline: update to 2.0.2.0 [2]
  - Pass maintainership to the submitter [1][2]
  - Mark sysutils/runwhen as BROKEN

  PR:		197233 [1]
  PR:		197234 [2]
  Differential Revision:	https://reviews.freebsd.org/D1818
  Submitted by:	Colin Booth <colin@heliocat.net>
  Approved by:	portmgr (bapt) [1]
  Approved by:	bapt (mentor)

Changes:
  head/devel/skalibs/Makefile
  head/devel/skalibs/distinfo
  head/devel/skalibs/pkg-descr
  head/devel/skalibs/pkg-plist
  head/lang/execline/Makefile
  head/lang/execline/distinfo
  head/lang/execline/pkg-descr
  head/lang/execline/pkg-plist
  head/sysutils/runwhen/Makefile
Comment 9 Jan Beich freebsd_committer freebsd_triage 2015-02-10 20:38:27 UTC
Committed with minor changes: no need .for loop over STRIP_CMD. Thanks.