On Mon, Feb 13, 2017 at 11:06:12PM +0100, Andre Stoebe wrote:
> On 12.02.2017 20:34, Mikolaj Kucharski wrote:
> > portcheck didn't complain, make lib-depends-check is happy too.
> > 
> > However I see that in sources of the app you hardcode `/usr/local`
> > path. I think it would be better to add to the ports Makefile something
> > as follows:
> > 
> > 
> > --- Makefile        Thu Feb  9 10:32:39 2017
> > +++ Makefile.new    Sun Feb 12 19:30:38 2017
> > @@ -19,4 +19,8 @@
> >  
> >  NO_TEST =          Yes
> >  
> > +pre-configure:
> > +   sed -i -e "s,/usr/local,${PREFIX},g;" \
> > +           ${WRKSRC}/Makefile ${WRKSRC}/dicepassc.c ${WRKSRC}/dicepassc.1
> > +
> >  .include <bsd.port.mk>
> 
> Hi,
> 
> thanks for the feedback.
> 
> You're right, PREFIX isn't honored at all which bothers me too, now
> that I understand a bit better. I'm actually quite inexperienced with
> make and thankful that bsd.prog.mk does most of the work for me...
> 
> Would it be better to handle it in the sources? I did some tests with
> sed (for the manual) and a preprocessor define (for the c file) to set
> the paths based on PREFIX. But I wonder if that's overkill... After
> all it's an OpenBSD-only application.
> 
> Regards
> Andre
> 
> Something like this:
> 
> PROG=         dicepassc
> SRCS=         ${PROG}.c
> MAN=          ${PROG}.1
> MDOC=         ${PROG}.mdoc
> 
> PREFIX?=      /usr/local
> BINDIR=               ${PREFIX}/bin
> MANDIR=               ${PREFIX}/man/man
> SHAREDIR=     ${PREFIX}/share
> WORDLISTDIR=  ${SHAREDIR}/${PROG}
> 
> CFLAGS+=      -g -W -Wall -Werror
> CFLAGS+=      -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
> CFLAGS+=      -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
> CFLAGS+=      -DWORDLISTDIR=${WORDLISTDIR}
> 
> CLEANFILES+=  ${MAN}
> 
> ${MAN}: ${MDOC}
>       sed -e "s,WORDLISTDIR,${WORDLISTDIR},g" ${MDOC} >${MAN}
> 
> afterinstall:
>       ${INSTALL} -d -o${SHAREOWN} -g${SHAREGRP} -m${DIRMODE} \
>           ${DESTDIR}${WORDLISTDIR}
>       ${INSTALL} ${INSTALL_COPY} -o${SHAREOWN} -g${SHAREGRP} -m${SHAREMODE} \
>           wordlists/diceware.wordlist \
>           wordlists/eff_large.wordlist \
>           wordlists/eff_short_1.wordlist \
>           ${DESTDIR}${WORDLISTDIR}
> 
> .include <bsd.prog.mk>

This seems reasonable to me, even though it may be an overkill, if you
are targeting only OpenBSD.

-- 
best regards
q#

Reply via email to