From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E1BEF138334 for ; Thu, 12 Sep 2019 00:28:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5C5C0E0AD1; Thu, 12 Sep 2019 00:28:35 +0000 (UTC) Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 19D31E0982 for ; Thu, 12 Sep 2019 00:28:34 +0000 (UTC) Received: by mail-io1-xd41.google.com with SMTP id j4so50343072iog.11 for ; Wed, 11 Sep 2019 17:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gentoo-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pTKMBV4cbXEgjZCJPbXdoB/JISyYnEfRC19PoiKE3PM=; b=zTCN3EYU+DpkKSYt+mS0UlEhz8n1yNoqKtSUpYFaOMQQSrCUC2xK6OL+aUaU2utsAl t6Br+ft05aP4aoqldnmTa2DmKXP4KuKKwKqPQKPssU/CYvK3TX0TO7OPT4F76NnS3IhF c74R6UGApFalJdkalKBzZVlJLbtCeNxpDyVWCEfdvCt8DTAdld6/FsqG3CB18f4Cv0sY PXOz/dH3HzPziSbjS3fGEfCptUWvY1h2pVpnSAiNQeQgPsjWcH5GzTFFqq24qYj6NZ1v Q1FIhY57rAssuCTa5sGmZPXQiwhtyvwRrj5AldVyyhG1gyaLvQitnZM7ddU7z6KkP15V zlLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pTKMBV4cbXEgjZCJPbXdoB/JISyYnEfRC19PoiKE3PM=; b=S6zQSY7CZTRQiRsQA3wWIkZNXxayG+VVJ6gHBaO/zHnoIIXVy+osrAddUUVxM1vCzc 4UIPf5+NEptzrFyJx5i0EUnDzCPlqFcjaBW/HQZSiZ07HbmSqRC9t5xL8ramOMwoINcE i/xnuhRuxius9Ys/cenMeZlkF+aSvIM/zH2F4SZBgDO+GIjlcFrGdTnKnMxxPtGw/ux7 fmrsZnUiVTkCacgdCgib4hSGN0lNrWUKymDfV2pUZK0fuVrRYrO60M57DHSG1npbuJFk QeWAK8CBk2wU9JD5ghvWehAGveK4jxerheQ1l7jDk97h4gHfnTEEZpbGMaCVHxFJ5TKV rJUg== X-Gm-Message-State: APjAAAV/Bu8Rlv6fixi3rZe1dzgnXb5/KmtkKZX2z+P7LeWjTUwubTAo vhdm8Wwredv9RcmyY/BGgK/fmll4StNTaDpHA/rKU4zI X-Google-Smtp-Source: APXvYqxKcQLwfE8E6FPhGYD83MzEAuw6eKxZaACw3iyHRSJfIdF2EUp58fyLu8UpMfOxTCqL2bZdmCobfOelfmpAgGo= X-Received: by 2002:a5d:9904:: with SMTP id x4mr952060iol.20.1568248114077; Wed, 11 Sep 2019 17:28:34 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 References: <20190911172128.18885-1-williamh@gentoo.org> <20190911172128.18885-2-williamh@gentoo.org> <20190912000525.GB21591@whubbs1.dev.av1.gaikai.org> In-Reply-To: <20190912000525.GB21591@whubbs1.dev.av1.gaikai.org> From: Alec Warner Date: Wed, 11 Sep 2019 17:28:22 -0700 Message-ID: Subject: Re: [gentoo-dev] [PATCH 1/3] go-module.eclass: introduce new eclass to handle go modules To: William Hubbs Cc: Gentoo Dev Content-Type: multipart/alternative; boundary="000000000000c279260592503774" X-Archives-Salt: 14cba90d-966c-4cf3-8581-84fa8ba26e4e X-Archives-Hash: c39e42086bd5e8fc87be11e6a621e8f2 --000000000000c279260592503774 Content-Type: text/plain; charset="UTF-8" On Wed, Sep 11, 2019 at 5:05 PM William Hubbs wrote: > On Wed, Sep 11, 2019 at 04:31:00PM -0700, Alec Warner wrote: > > On Wed, Sep 11, 2019 at 10:28 AM William Hubbs > wrote: > > > > > Copyright: Sony Interactive Entertainment Inc. > > > Signed-off-by: William Hubbs > > > --- > > > eclass/go-module.eclass | 76 +++++++++++++++++++++++++++++++++++++++++ > > > 1 file changed, 76 insertions(+) > > > create mode 100644 eclass/go-module.eclass > > > > > > diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass > > > new file mode 100644 > > > index 00000000000..7009fcd3beb > > > --- /dev/null > > > +++ b/eclass/go-module.eclass > > > @@ -0,0 +1,76 @@ > > > +# Copyright 1999-2015 Gentoo Foundation > > > +# Distributed under the terms of the GNU General Public License v2 > > > + > > > +# @ECLASS: go-module.eclass > > > +# @MAINTAINER: > > > +# William Hubbs > > > +# @SUPPORTED_EAPIS: 7 > > > +# @BLURB: basic eclass for building software written in the go > > > +# programming language that uses go modules. > > > +# @DESCRIPTION: > > > +# This eclass provides a convenience src_prepare() phase and some > basic > > > +# settings needed for all software written in the go programming > > > +# language that uses go modules. > > > +# > > > +# You will know the software you are packaging uses modules because > > > +# it will have files named go.sum and go.mod in its top-level source > > > +# directory. If it does not have these files, use the golang-* > eclasses. > > > +# > > > +# If the software you are packaging uses modules, the next question is > > > +# whether it has a directory named "vendor" at the top-level of the > > > source tree. > > > +# > > > +# If it doesn't, you need to create a tarball of what would be in the > > > +# vendor directory and mirror it locally. This is done with the > > > +# following commands if upstream is using a git repository: > > > +# > > > +# @CODE: > > > +# > > > +# $ cd /my/clone/of/upstream > > > +# $ git checkout > > > +# $ go mod vendor > > > +# $ tar cvf project-version-vendor.tar.gz vendor > > > +# > > > +# @CODE: > > > +# > > > +# Other than this, all you need to do is inherit this eclass then > > > +# make sure the exported src_prepare function is run. > > > + > > > +case ${EAPI:-0} in > > > + 7) ;; > > > + *) die "${ECLASS} API in EAPI ${EAPI} not yet established." > > > +esac > > > + > > > +if [[ -z ${_GO_MODULE} ]]; then > > > + > > > +_GO_MODULE=1 > > > + > > > +BDEPEND=">=dev-lang/go-1.12" > > > + > > > +# Do not download dependencies from the internet > > > +# make build output verbose by default > > > +export GOFLAGS="-mod=vendor -v -x" > > > + > > > +# Do not complain about CFLAGS etc since go projects do not use them. > > > +QA_FLAGS_IGNORED='.*' > > > + > > > +# Upstream does not support stripping go packages > > > +RESTRICT="strip" > > > > > > > https://golang.org/cmd/link/ implies you can pass -s -w to the compiler > to > > reduce binary size. > > > > Does that not work in portage by default, or does upstream just consider > > that bad practice? > > I haven't tried it, but here are the definitions of -s and -w. > > -s Omit the symbol table and debug information. > -w Omit the DWARF symbol table. > > These look like Go's equivalent of stripping the binaries, and I have my > doubts as to whether we should force this. > I don't care if you strip or not (I'm not even sure portage knows how to do it for go binaries) but I'm fairly sure the reason isn't because "upstream does not support stripping go binaries" because they clearly do...unless upstream is portage here...? > > William > > --000000000000c279260592503774 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, Sep 11, 2019 at 5:05 PM Willi= am Hubbs <williamh@gentoo.org= > wrote:
On W= ed, Sep 11, 2019 at 04:31:00PM -0700, Alec Warner wrote:
> On Wed, Sep 11, 2019 at 10:28 AM William Hubbs <williamh@gentoo.org> wrote: >
> > Copyright: Sony Interactive Entertainment Inc.
> > Signed-off-by: William Hubbs <williamh@gentoo.org>
> > ---
> >=C2=A0 eclass/go-module.eclass | 76 ++++++++++++++++++++++++++++++= +++++++++++
> >=C2=A0 1 file changed, 76 insertions(+)
> >=C2=A0 create mode 100644 eclass/go-module.eclass
> >
> > diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass > > new file mode 100644
> > index 00000000000..7009fcd3beb
> > --- /dev/null
> > +++ b/eclass/go-module.eclass
> > @@ -0,0 +1,76 @@
> > +# Copyright 1999-2015 Gentoo Foundation
> > +# Distributed under the terms of the GNU General Public License = v2
> > +
> > +# @ECLASS: go-module.eclass
> > +# @MAINTAINER:
> > +# William Hubbs <williamh@gentoo.org>
> > +# @SUPPORTED_EAPIS: 7
> > +# @BLURB: basic eclass for building software written in the go > > +# programming language that uses go modules.
> > +# @DESCRIPTION:
> > +# This eclass provides a convenience src_prepare() phase and som= e basic
> > +# settings needed for all software written in the go programming=
> > +# language that uses go modules.
> > +#
> > +# You will know the software you are packaging uses modules beca= use
> > +# it will have files named go.sum and go.mod in its top-level so= urce
> > +# directory. If it does not have these files, use the golang-* e= classes.
> > +#
> > +# If the software you are packaging uses modules, the next quest= ion is
> > +# whether it has a directory named "vendor" at the top= -level of the
> > source tree.
> > +#
> > +# If it doesn't, you need to create a tarball of what would = be in the
> > +# vendor directory and mirror it locally. This is done with the<= br> > > +# following commands if upstream is using a git repository:
> > +#
> > +# @CODE:
> > +#
> > +# $ cd /my/clone/of/upstream
> > +# $ git checkout <release>
> > +# $ go mod vendor
> > +# $ tar cvf project-version-vendor.tar.gz vendor
> > +#
> > +# @CODE:
> > +#
> > +# Other than this, all you need to do is inherit this eclass the= n
> > +# make sure=C2=A0 the exported src_prepare function is run.
> > +
> > +case ${EAPI:-0} in
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A07) ;;
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0*) die "${ECLASS} API in EAPI ${= EAPI} not yet established."
> > +esac
> > +
> > +if [[ -z ${_GO_MODULE} ]]; then
> > +
> > +_GO_MODULE=3D1
> > +
> > +BDEPEND=3D">=3Ddev-lang/go-1.12"
> > +
> > +# Do not download dependencies from the internet
> > +# make build output verbose by default
> > +export GOFLAGS=3D"-mod=3Dvendor -v -x"
> > +
> > +# Do not complain about CFLAGS etc since go projects do not use = them.
> > +QA_FLAGS_IGNORED=3D'.*'
> > +
> > +# Upstream does not support stripping go packages
> > +RESTRICT=3D"strip"
> >
>
> https://golang.org/cmd/link/ implies you can pass -s -w to the = compiler to
> reduce binary size.
>
> Does that not work in portage by default, or does upstream just consid= er
> that bad practice?

I haven't tried it, but here are the definitions of -s and -w.

-s=C2=A0 =C2=A0 =C2=A0 Omit the symbol table and debug information.
-w=C2=A0 =C2=A0 =C2=A0 Omit the DWARF symbol table.

These look like Go's equivalent of stripping the binaries, and I have m= y
doubts as to whether we should force this.

<= div>I don't care if you strip or not (I'm not even sure portage kno= ws how to do it for go binaries) but I'm fairly sure the reason isn'= ;t because "upstream does not support stripping go binaries" beca= use they clearly do...unless upstream is portage here...?
=C2=A0<= /div>

William

--000000000000c279260592503774--