Porting questions

Craig Leres leres at freebsd.org
Wed May 2 02:29:13 UTC 2018


On 05/01/18 11:04, Le Baron d’Merde wrote:
> When upstream does not provide a version (or a separated commit will be used
> like HEAD), the version format to be used for GitHub is: gYYYYMMDD
> 
> See 5.13: https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html#makefile-master_sites-github-description

I missed that; it's perfect, thanks!

>> (4) How to handle downloads that shouldn't be extracted: The toolchain uses
>> specific versions of a bunch of things:
>>
>>      TARBALLS= \
>>                      binutils-2.25.1.tar.bz2 \
>>                      expat-2.1.0.tar.gz \
>>                      gcc-5.2.0.tar.bz2 \
>>                      gdb-7.10.tar.xz \
>>                      gmp-6.0.0a.tar.xz \
>>                      isl-0.14.tar.xz \
>>                      mpc-1.0.3.tar.gz \
>>                      mpfr-3.1.3.tar.xz \
>>                      ncurses-6.0.tar.gz \
>>                      newlib-2.2.0.tar.gz
>>
>> Normally the build process downloads these which doesn't work well with
>> poudriere; you don't want to download these every time you build port. I put
>> copies in my /usr/ports/distfiles and add symlinks to the work tree in
>> post-extract and later the build script correctly skips downloading them
>> when it finds them already there. I'd like to add these to DISTFILES for
>> auto-download and checksums but I don't want them extracted by do-extract.
>> Is my best option to override the do-extract target?
> 
> I guess those are git submodules. GH_TUPLE are used for them. You can see a
> working example on x11/polybar

Actually they're not, they're just the specific versions of things that 
are built to deal with the cross compile objects. In the end I added 
them to DISTFILES with the appropriate MASTER_SITES entries and 
discovered EXTRACT_ONLY and set that to the github tarball.

On 05/01/18 12:21, Gleb Popov wrote:
 >     (3) USES=gcc doesn't provide a binary named gcc: crosstool-NG has
 >     the string "gcc" firmly baked into it. When I have USES=gcc (today)
 >     I get gcc6 but without patching a ton of files I need gcc to exist
 >     when poudriere is building. I solved this by also adding:
 >
 >          BUILD_DEPENDS+= gcc:lang/gcc
 >
 >     but it seems wrong to me that USES=gcc doesn't provide a binary
 >     named gcc.
 >
 >
 > You can add
 > BINARY_ALIAS=   gcc=gcc6
 > line to work around this.

It'd be sweet if this worked but it doesn't. I think the problem is that
create-binary-alias happens slightly before do-configure which is the 
first place I need gcc to exist.

Thanks guys!

		Craig
-------------- next part --------------
# Created by: Craig Leres <leres at freebsd.org>
# $FreeBSD$

PORTNAME=	xtensa-esp32-elf
DISTVERSION=	1.22.0.g20171219
CATEGORIES=	devel
MASTER_SITES=	GNU/binutils:source1 \
		https://sourceforge.net/projects/expat/files/expat/2.1.0/:source2 \
		GNU/gcc/gcc-5.2.0/:source3 \
		GNU/gdb:source4 \
		GNU/gmp:source5 \
		http://isl.gforge.inria.fr/:source6 \
		GNU/mpc:source7 \
		http://www.mpfr.org/mpfr-3.1.3/:source8 \
		GNU/ncurses:source9 \
		https://sourceforge.net/projects/devkitpro/files/sources/newlib/:source10
DISTFILES=	binutils-2.25.1.tar.bz2:source1 \
		expat-2.1.0.tar.gz:source2 \
		gcc-5.2.0.tar.bz2:source3 \
		gdb-7.10.tar.xz:source4 \
		gmp-6.0.0a.tar.xz:source5 \
		isl-0.14.tar.xz:source6 \
		mpc-1.0.3.tar.gz:source7 \
		mpfr-3.1.3.tar.xz:source8 \
		ncurses-6.0.tar.gz:source9 \
		newlib-2.2.0.tar.gz:source10
EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}

MAINTAINER=	leres at freebsd.org
COMMENT=	Toolchain for xtensa-esp32-elf

LICENSE=	GPLv2 LGPL21
LICENSE_COMB=	multi

BUILD_DEPENDS+=	bash:shells/bash \
		gawk:lang/gawk \
		gcc:lang/gcc \
		git:devel/git \
		gpatch:devel/patch \
		${LOCALBASE}/bin/grep:textproc/gnugrep \
		gperf:devel/gperf \
		gsed:textproc/gsed \
		help2man:misc/help2man \
		makeinfo:print/texinfo \
		python:lang/python \
		wget:ftp/wget

USES=		autoreconf:build bison gmake libtool python:build
USE_GCC=	yes
USE_GITHUB=	yes
USE_LDCONFIG=	${PREFIX}/${PORTNAME}/libexec/gcc/xtensa-esp32-elf/5.2.0
SUBDIR=		crosstool-NG
TAGNAME=	1.22.0-80-g6c4433a5
GH_TUPLE=	espressif:${SUBDIR}:${TAGNAME}

post-extract:
	${MKDIR} ${BUILD_WRKSRC}/.build/tarballs
.for F in $(DISTFILES:N$(EXTRACT_ONLY))
	${LN} -s ${DISTDIR}/${F:C/:source[0-9]+$//} ${BUILD_WRKSRC}/.build/tarballs
.endfor

pre-configure:
	 cd ${BUILD_WRKSRC} && ./bootstrap
	 ${PRINTF} "#!/bin/sh\necho '${SUBDIR:tl}-${TAGNAME}'\n" > \
	     ${BUILD_WRKSRC}/version.sh
	 ${CHMOD} -w+x ${BUILD_WRKSRC}/version.sh

do-configure:
	cd ${BUILD_WRKSRC} && \
	    ./configure --enable-local --with-grep=${LOCALBASE}/bin/grep

pre-build:
	cd ${BUILD_WRKSRC} && \
	    ${SETENV} -uMAKELEVEL -uMAKEFLAGS -u.MAKE.LEVEL.ENV \
	    ${MAKE_CMD} install && ./ct-ng xtensa-esp32-elf

do-build:
	cd ${BUILD_WRKSRC} && CT_ALLOW_BUILD_AS_ROOT_SURE=1 ./ct-ng build

post-build:
	cd ${BUILD_WRKSRC}/builds/${PORTNAME} && \
	    ${RM} build.log.bz2 lib/charset.alias

do-install:
	cd ${BUILD_WRKSRC}/builds && \
	    ${COPYTREE_SHARE} ${PORTNAME} ${STAGEDIR}${PREFIX}

.include <bsd.port.mk>


More information about the freebsd-hackers mailing list