From owner-freebsd-hackers@freebsd.org Tue May 1 18:04:22 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A57EFB26C4 for ; Tue, 1 May 2018 18:04:22 +0000 (UTC) (envelope-from lebarondemerde@privacychain.ch) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::606]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45AB184221 for ; Tue, 1 May 2018 18:04:20 +0000 (UTC) (envelope-from lebarondemerde@privacychain.ch) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward103o.mail.yandex.net (Yandex) with ESMTP id EA0B05881D6C for ; Tue, 1 May 2018 21:04:08 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id CGGfzFYGDP-480CtDXj; Tue, 01 May 2018 21:04:08 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 4oBScjTgKN-468SF6IX; Tue, 01 May 2018 21:04:07 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Date: Tue, 1 May 2018 15:04:02 -0300 From: Le Baron =?utf-8?B?ZOKAmU1lcmRl?= To: freebsd-hackers@freebsd.org Subject: Re: Porting questions Message-ID: <20180501180402.e4kigr4f5qh44m6d@privacychain.ch> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180323 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 May 2018 18:04:22 -0000 Hi! Ps. reviews.freebsd.org is a good place for that. :) On Tue, May 01, 2018 at 10:26:32AM -0700, Craig Leres wrote: > I'm working a port for the Espressif ESP32 toolchain so I can move > development of some projects (FreeRTOS and Arduino) from Ubuntu to FreeBSD. > I have a few questions. > > (1) Naming: The pre-built linux 64 bit toolchain is called: > > xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz > > so I thought the port should be called xtensa-esp32-elf; is this a > reasonable name? > > (2) Port version: The toolchain is built from the latest version: > > https://github.com/espressif/crosstool-NG > > There is not a release that corresponds to this version; is it legit for me > to use: > > DISTVERSION= 1.22.0-80-g6c4433a5 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 > GH_TUPLE= espressif:crosstool-NG:${DISTVERSION} I *think* GH_TAGNAME would be more aproppiated. > > which apparently gives me 1.22.0.80.g6.c4433.a5 as the PORTVERSION? > > (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. I didn't tried but ${REINPLACE_CMD} should do the job. See 4.4.3: https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/slow-patch.html > > (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 > > I've attached the current version of the Makefile for informal review. > > Craig > # Created by: Craig Leres > # $FreeBSD$ > > PORTNAME= xtensa-esp32-elf > DISTVERSION= 1.22.0-80-g6c4433a5 > CATEGORIES= devel > #DISTFILES= > #MASTER_SITES= SF > DIST_SUBDIR= xtensa-esp32-elf > > MAINTAINER= leres@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 \ > wget:ftp/wget > > USES= autoreconf:build bison gmake libtool python:build > USE_GITHUB= yes > GH_TUPLE= espressif:crosstool-NG:${DISTVERSION} > USE_GCC= yes > > 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 > > post-extract: > ${MKDIR} ${BUILD_WRKSRC}/.build/tarballs > .for F in $(TARBALLS) > ${LN} -s ${DISTDIR}/${DIST_SUBDIR}/${F} ${BUILD_WRKSRC}/.build/tarballs > .endfor > > pre-configure: > cd ${BUILD_WRKSRC} && ./bootstrap > > 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 > > .include > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" Cheers! -- Best Regards. LBdM.