HELP needed by experienced porter for simple review
GP
godpost at gmail.com
Sun Dec 2 13:38:00 PST 2007
Any body?
>>>> I'm new to porting for FreeBSD and make files aren't my strongest suit.
>>>> So
>>>> I would be greatful if I could get an experienced porter to review my
>>>> make
>>>> files, for at very simple deamon.
>>>>
>>>> I've read the porter handbook and the port seems to be working fine.
>>>> But
>>>> I'm uncertain as to what is best practise and since this will hopefully
>>>> be
>>>> the first of many ports, I would like to get i right.
>>>>
>>>> If you want to help, please drop me a note and I will send you the two
>>>> small makefiles to review.
>>
>> Hi and welcome!
>> First of all you should install ports-mgmt/portlint and run it against
>> your port (if you haven't done it already). Be sure to use the switch to
>> enable additional checks (I got bitten once because I forgot it).
>> Then you could perhaps put your work online somewhere and provide a link,
>> so everybody can take a look at it and test.
>>
>> Best regards,
>> Jona
>>
Ok. thanks.
Its simple so I will just put in in this mail.
I hope to have the ability to make changes in the source, so I've included
the proposed application
Makefile as well.
Its all working, but I would like to know if the concepts are sound?
Portlint throws a warning, but I don't se any reasonable way arrount that:
/usr/ports/distfiles>portlint
WARN: Makefile: possible use of absolute pathname "/etc/rc.conf.bak".
0 fatal errors and 1 warning found.
Root
Makefile: --------------------------------------------------------------------------------------
# New ports collection makefile for: kissdx
# Date created: 20. November 2007
# Whom: Simon I. Rigét
#
# $FreeBSD$
PORTNAME= kissdx
PORTVERSION= 0.13.10a
CATEGORIES= multimedia net
MASTER_SITES= http://freebsd.paragi.dk/kissdx/ \
http://kissdx.vidartysse.net/
DISTNAME= ${PORTNAME}-${PORTVERSION}
MAINTAINER= freebsd at paragi.dk
COMMENT= A multimedia streaming server for KiSS/Linksys player
USE_ICONV= yes
# Dependencies of other packeges
LIB_DEPENDS= libdvdread:${PORTSDIR}/multimedia/libdvdread \
libiconv:${PORTSDIR}/converters/libiconv \
gd-2:${PORTSDIR}/graphics/gd
jpeg-6b_4:${PORTSDIR}/graphics/jpeg
# Man pages
MAN1= kissdx.1
MANCOMPRESSED= yes
# RC start and stop service
USE_RC_SUBR= kissdx
# set enviroment variables for port makefile
MAKE_ENV= FreeBSD=defined
# Convert CR/LF to LF in source files
USE_DOS2UNIX= yes
post-patch:
${REINPLACE_CMD} -e 's|Linux|Unix|g' ${WRKSRC}/kissdx.1
${REINPLACE_CMD} -e 's|/etc/|/usr/local/etc/|' ${WRKSRC}/kissdx.1
$(GZIP_CMD) -c ${INSTALL_WRKSRC}/kissdx.1 >${INSTALL_WRKSRC}/kissdx.1.gz
$(MKDIR) $(FILESDIR)
$(CP) ${WRKSRC}/kissdx.in ${FILESDIR}
do-install: all
$(INSTALL_PROGRAM) ${INSTALL_WRKSRC}/kissdx ${TARGETDIR}/sbin/kissdx
$(INSTALL_DATA) ${INSTALL_WRKSRC}/kissdx.conf ${TARGETDIR}/etc/kissdx.conf
$(INSTALL_MAN) ${INSTALL_WRKSRC}/kissdx.1.gz
${TARGETDIR}/man/man1/kissdx.1.gz
echo "kissdx_enabled=\"YES\"" >> /etc/rc.conf
do-deinstall:
$(RM) ${TARGETDIR}/sbin/kissdx
$(RM) ${TARGETDIR}/etc/kissdx.conf
$(RM) ${TARGETDIR}/man/man1/kissdx.*
$(RM) ${TARGETDIR}/etc/rc.d/kissdx
$(CP) ${/etc/rc.conf} ${/etc/rc.conf}.bak
${GREP} -v kissdx_ /etc/rc.conf.bak >/etc/rc.conf
.include <bsd.port.mk>
pkg-plist: ------------------------------------------------------------------------------------
sbin/kissdx
etc/kissdx.conf
etc/rc.d/kissdx
Application
Makefile: ------------------------------------------------------------------------------------
################################################################################# KiSS DX multi OS Makefile# By SR. 2007-11-30################################################################################ ################################################################################# Operating system# Uncomment for onr of the desired OS (Execpt FreeBSD which will be definedby# the master makefile)################################################################################ #env= Environment(**ARGUMENTS)#NSLU2= defined#CYGWIN= definedLinux= defined ################################################################################# Generic settings## In some UNIX systems build options that affect all ports can be setglobally.# this makefile should not override the existing value.################################################################################CC?= gcc# compiler directives (defines)# Sendfile# -DUSE_INTERNAL_SENDFILE (less performance) if you cannot use the
sendfilesyscall on your# target platform with 64-bit file access. Needed for Unslung 5.5 on NSLU2.# -DUSE_INTERNAL_SENDFILE_MMAP (better performance)# with -DUSE_INTERNAL_SENDFILE if your target platform supports memorymapped# files with 64-bit file access and you want to use it. Not possible with# >2GB files on Unslung 5.5 on NSLU2.CFLAGS+= -DUSE_INTERNAL_SENDFILE # Support for lage file sizes >2GbCFLAGS+= -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64CFLAGS+= -D_GNU_SOURCE# Compile optionsCFLAGS+= -Wall -Wstrict-prototypes# LiberariesLIBS+= -ldvdread# remove -liconv below if your system has libiconv built inLIBS+= -liconvLIBS+= -ljpegLIBS+= -lm# Link optionsLDFLAGS+= -O2 -s -L/usr/lib -L/usr/local/lib################################################################################# Operating system dependend settings################################################################################.if defined(FreeBSD)# FreeBSD definitionsCFLAGS+= -DFreeB
SDCFLAGS+= -I. -I/usr/include -I/usr/local/includeCFLAGS+=-D_CONF_DIR=${TARGETDIR}/etc/.undef(Linux).undef(NSLU2).undef(CYGWIN).else#Linux definitionCFLAGS+= -DLinux# Install settings.create-install-target=definedINSTALL_PROGRAM?= install -b -S .old -o root -g root -m 755INSTALL_SCRIPT?= install -b -S .old -o root -g root -m 755INSTALL_DATA?= install -b -S .old -o root -g root -m 644INSTALL_MAN?= install -o root -g root -m 644INSTALL_WRKSRC= .TARGETDIR= $(DISTDIR)/usrMANTARGETDIR= /usr/share/man.endif.if defined(NSLU2)CC= arm-linux-gccCFLAGS+= -mcpu=xscale -mbig-endianCFLAGS+= -I/opt/includeLIBS+= -L/opt/lib.undef(create-install-target).endif################################################################################# Make a list of object files as targets for compilation################################################################################OBJS= kissdx.o connection.o sendfile.o dvdread.o playlist.o jpeg.opiccache.oOBJS+= utils.o config.o backtoback.oOBJS+= gdst
uff/gdstuff.o gdstuff/gd.o gdstuff/gdfontg.o gdstuff/gd_jpeg.oOBJS+= gdstuff/gdhelpers.o gdstuff/gd_io_dp.o gdstuff/gd_io.oOBJS+= gdstuff/gd_security.o################################################################################# Compile and link rules## Build in macros:#$@ The file name of the target.#$< The name of the first dependency.#$* The part of a filename which matched a suffix rule.#$? The names of all the dependencies newer than the target separated byspaces.#$^ The names of all the dependencies separated by spaces, but withduplicate# names removed.#$+ The names of all the dependencies separated by spaces with duplicatenames# included and in the same order as in the rule.################################################################################ .c.o:$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< .o :$(CC) -o $@ $(LIBS) $(LDFLAGS) $(OBJS)# Do all the compiling and linkingall: $(OBJS) kissdx########################################################################
######### Linux install rules################################################################################.if !defined(FreeBSD).if defined(create-install-target)#Install files on the systeminstall:$(INSTALL_PROGRAM) ${INSTALL_WRKSRC}/kissdx $(TARGETDIR)/sbin/kissdx$(INSTALL_DATA) ${INSTALL_WRKSRC}/kissdx.conf $(TARGETDIR)/etc/kissdx.conf$(INSTALL_MAN) ${INSTALL_WRKSRC}/kissdx.1 $(MANTARGETDIR)/man1/kissdx.1 #Remove all installed filesuninstall:rm $(TARGETDIR)/sbin/kissdxrm $(TARGETDIR)/etc/kissdx.confrm $(MANTARGETDIR)/man1/kissdx.1echo "All files successfully removed".endif# This clean only removes compiled files.clean:rm -rf kissdx.exe kissdx $(OBJS) *.bak *~echo "Clean as a whistle".endif
More information about the freebsd-ports
mailing list