Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Dec 2007 13:59:41 +0100
From:      "GP" <godpost@gmail.com>
To:        <freebsd-ports@freebsd.org>
Subject:   Re: HELP needed by experienced porter for simple review
Message-ID:  <003f01c8341a$0a252660$6300000a@pi>
References:  <003801c833aa$153bb2f0$6300000a@pi> <pan.2007.12.01.00.58.21.976326@hcl-club.lu>

next in thread | previous in thread | raw e-mail | index | archive | help
>>> 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@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 defined 
by
# the master makefile)
################################################################################

#env= Environment(**ARGUMENTS)

#NSLU2= defined
#CYGWIN= defined
Linux= defined

################################################################################
# Generic settings
#
# In some UNIX systems  build options that affect all ports can be set 
globally.
# this makefile should not override the existing value.
################################################################################

CC?= gcc

# compiler directives (defines)
# Sendfile
# -DUSE_INTERNAL_SENDFILE (less performance) if you cannot use the sendfile 
syscall 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 memory mapped 
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 >2Gb
CFLAGS+= -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
CFLAGS+= -D_GNU_SOURCE

# Compile options
CFLAGS+= -Wall -Wstrict-prototypes

# Liberaries
LIBS+= -ldvdread
# remove -liconv below if your system has libiconv built in
LIBS+= -liconv
LIBS+= -ljpeg
LIBS+= -lm

# Link options
LDFLAGS+= -O2 -s -L/usr/lib -L/usr/local/lib

################################################################################
# Operating system dependend settings
################################################################################
.if defined(FreeBSD)
# FreeBSD definitions
CFLAGS+= -DFreeBSD
CFLAGS+= -I. -I/usr/include -I/usr/local/include
CFLAGS+=-D_CONF_DIR=${TARGETDIR}/etc/
.undef(Linux)
.undef(NSLU2)
.undef(CYGWIN)
.else
#Linux definition
CFLAGS+= -DLinux
# Install settings.
create-install-target=defined
INSTALL_PROGRAM?= install -b -S .old -o root -g root -m 755
INSTALL_SCRIPT?= install -b -S .old -o root -g root -m 755
INSTALL_DATA?= install -b -S .old -o root -g root -m 644
INSTALL_MAN?= install -o root -g root -m 644
INSTALL_WRKSRC= .
TARGETDIR= $(DISTDIR)/usr
MANTARGETDIR= /usr/share/man
.endif

.if defined(NSLU2)
# -DUSE_INTERNAL_SENDFILE (less performance) if you cannot use the sendfile 
syscall 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 memory mapped 
files with 64-bit file access and you want to use it.  Not possible with 
 >2GB files on Unslung 5.5 on NSLU2.
CC= arm-linux-gcc
CFLAGS+= -mcpu=xscale -mbig-endian
CFLAGS+= -I/opt/include
LIBS+= -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.o 
piccache.o
OBJS+= utils.o config.o backtoback.o
OBJS+= gdstuff/gdstuff.o gdstuff/gd.o gdstuff/gdfontg.o gdstuff/gd_jpeg.o
OBJS+= gdstuff/gdhelpers.o gdstuff/gd_io_dp.o gdstuff/gd_io.o
OBJS+= 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 by 
spaces.
#$^ The names of all the dependencies separated by spaces, but with 
duplicate
#  names removed.
#$+ The names of all the dependencies separated by spaces with duplicate 
names
#  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 linking
all: $(OBJS) kissdx

################################################################################
# Linux install rules
################################################################################
.if !defined(FreeBSD)
.if defined(create-install-target)
#Install files on the system
install:
 $(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 files
uninstall:
 rm $(TARGETDIR)/sbin/kissdx
 rm $(TARGETDIR)/etc/kissdx.conf
 rm $(MANTARGETDIR)/man1/kissdx.1
 echo "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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003f01c8341a$0a252660$6300000a>