D
Deleted member 67440
Guest
I am not at all familiar writing ports for FreeBSD, so I ask for help from those who do it most often.
Of course there is documentation, but it is not exactly immediate in use, even the "quick one" is not so quick.
So these are beginner's questions, but on the other hand every system has its own port mechanism, until now (thanks to other users) I get the OpenBSD package, but I would also like to do it for FreeBSD
---
What I want: compile a single zpaqfranz.cpp into two executable (same file, different names)
/usr/local/bin/zpaqfranz
/usr/local/bin/dir
Why? Because change behavior if called "dir" (... something like... Windows' dir command)
---
Final target: pkg install zpaqfranz
---
I am confused by the existence of TWO Makefiles.
The first is the ..."normal" one, for compiling with make install clean or whatever
Something like that
The problem is here: ONLY_FOR_ARCHS= i386 amd64
On "non Intel" CPUs it is necessary to #define a NOJIT, with something like (just a snippet)
But I am confused by "the second" Makefile (the port one), just about this one
=======
Recap (as in the attached file)
1) I made a "caricasito" folder, with the "normal" Makefile and zpaqfranz.cpp (the source)
2) compress everything into .tar.gz
tar -czvf zpaqfranz-55.8.tar.gz Makefile zpaqfranz.cpp
3) upload to http://www.francocorbelli.it/zpaqfranz/zpaqfranz-55.8.tar.gz
(it is the MASTER_SITES= http://www.francocorbelli.it/zpaqfranz/ of the port Makefile)
4) so far so good, then
make makesum in the zpaqfolder/ folder with
- Makefile "the 2nd"
- pkg-descr
- pkg-plist
getting the distinfo
5) created the .shar with
tar cf zpaqfranz.shar --format shar zpaqfranz
6) finally (just to be sure)
portlint zpaqfranz
---
Now the question: how to conditionally compile cutting
ONLY_FOR_ARCHS= i386 amd64 ?
If I understand correctly, it is possible to compile the source both using the Makefile inside the .tar.gz file (the "first" Makefile) or with the port's Makefile ("the second") and, in this case, with conditionality (i.e. define the constant NOJIT if the architecture is not Intel)
But how?
I understand this is a routine porting operation, but this is my very first on FreeBSD
Thank you
Of course there is documentation, but it is not exactly immediate in use, even the "quick one" is not so quick.
So these are beginner's questions, but on the other hand every system has its own port mechanism, until now (thanks to other users) I get the OpenBSD package, but I would also like to do it for FreeBSD
---
What I want: compile a single zpaqfranz.cpp into two executable (same file, different names)
/usr/local/bin/zpaqfranz
/usr/local/bin/dir
Why? Because change behavior if called "dir" (... something like... Windows' dir command)
---
Final target: pkg install zpaqfranz
---
I am confused by the existence of TWO Makefiles.
The first is the ..."normal" one, for compiling with make install clean or whatever
Something like that
Code:
CC?= cc
INSTALL?= install
RM?= rm
PROG= zpaqfranz
CFLAGS+= -march=native -Dunix
LDADD= -static -pthread -lstdc++ -lm
BINDIR= /usr/local/bin
BSD_INSTALL_PROGRAM?= install -m 0555
ONLY_FOR_ARCHS= i386 amd64
all: build
build: ${PROG}
install: ${PROG}
${BSD_INSTALL_PROGRAM} ${PROG} ${DESTDIR}${BINDIR}
${BSD_INSTALL_PROGRAM} ${PROG} ${DESTDIR}${BINDIR}/dir
${PROG}: ${OBJECTS}
${CC} ${CFLAGS} zpaqfranz.cpp -o ${PROG} ${LDADD}
clean:
${RM} -f ${PROG}
The problem is here: ONLY_FOR_ARCHS= i386 amd64
On "non Intel" CPUs it is necessary to #define a NOJIT, with something like (just a snippet)
Code:
.if ${ARCH} == "amd64" || ( ${ARCH} == "i386" && !empty(MACHINE_CPU:Msse2) )
ZPAQFLAGS= -msse2
.else
ZPAQFLAGS= -DNOJIT
.endif
But I am confused by "the second" Makefile (the port one), just about this one
Code:
PORTNAME= zpaqfranz
DISTVERSION= 55.8
CATEGORIES= archivers
MASTER_SITES= http://www.francocorbelli.it/zpaqfranz/
MAINTAINER= franco@francocorbelli.com
COMMENT= Swiss army knife for the serious backup and disaster recovery ma
nager
LICENSE= BSD2CLAUSE MIT
LICENSE_COMB= dual
WRKSRC= ${WRKDIR}
.include <bsd.port.mk>
do-build: SOMETHING????
=======
Recap (as in the attached file)
1) I made a "caricasito" folder, with the "normal" Makefile and zpaqfranz.cpp (the source)
2) compress everything into .tar.gz
tar -czvf zpaqfranz-55.8.tar.gz Makefile zpaqfranz.cpp
3) upload to http://www.francocorbelli.it/zpaqfranz/zpaqfranz-55.8.tar.gz
(it is the MASTER_SITES= http://www.francocorbelli.it/zpaqfranz/ of the port Makefile)
4) so far so good, then
make makesum in the zpaqfolder/ folder with
- Makefile "the 2nd"
- pkg-descr
- pkg-plist
getting the distinfo
5) created the .shar with
tar cf zpaqfranz.shar --format shar zpaqfranz
6) finally (just to be sure)
portlint zpaqfranz
---
Now the question: how to conditionally compile cutting
ONLY_FOR_ARCHS= i386 amd64 ?
If I understand correctly, it is possible to compile the source both using the Makefile inside the .tar.gz file (the "first" Makefile) or with the port's Makefile ("the second") and, in this case, with conditionality (i.e. define the constant NOJIT if the architecture is not Intel)
But how?
I understand this is a routine porting operation, but this is my very first on FreeBSD
Thank you