diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2022-01-12 17:22:51 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2022-01-12 17:22:51 +0200 |
| commit | 025bdf5ab5d943eb92180de25753401954bb88b8 (patch) | |
| tree | 68e495134679fbe15fae76c802912717cab747ca | |
| parent | b0741471335e9fc86d1a7e3591b1f7c27263f144 (diff) | |
| download | garbage-025bdf5ab5d943eb92180de25753401954bb88b8.tar garbage-025bdf5ab5d943eb92180de25753401954bb88b8.tar.gz garbage-025bdf5ab5d943eb92180de25753401954bb88b8.zip | |
Added the current setup
69 files changed, 8550 insertions, 0 deletions
diff --git a/acct-group/plugdev/Manifest b/acct-group/plugdev/Manifest new file mode 100644 index 0000000..5f9b71d --- /dev/null +++ b/acct-group/plugdev/Manifest @@ -0,0 +1,2 @@ +EBUILD plugdev-0-r1.ebuild 209 BLAKE2B 680ffebfbb8aa140a1cc83b909f60f9832c695994a3505a59d822a365170e8b96f66cd57833670f587463900102062836b835e7a44c34f26211daaab1827e392 SHA512 0403744e2f993bfb6003c8c86f2d1ad798cc20361952634fef55ee0fc31c3a916c1af39c03487bca6ddacf0c411d33e3e0c6c02334bd781bd52f652036f23224 +MISC metadata.xml 248 BLAKE2B f308d2aa052d11e427850af58bbebf95e7773f5562ed221f39043474b4c3827d724d49667edf1874272a5586a13201159f40e8f5eafb7e400e79c6566e1a6ac2 SHA512 b875c838394523483ae7d93585207eb3c642a345bbb08e1dcef3ceb737c813fa779e2f5479d48cdcc30732b8a0a9e6ecc648df940def6731e4dff43b23786e6d diff --git a/acct-group/plugdev/metadata.xml b/acct-group/plugdev/metadata.xml new file mode 100644 index 0000000..076793e --- /dev/null +++ b/acct-group/plugdev/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>mgorny@gentoo.org</email> + <name>Michał Górny</name> + </maintainer> +</pkgmetadata> diff --git a/acct-group/plugdev/plugdev-0-r1.ebuild b/acct-group/plugdev/plugdev-0-r1.ebuild new file mode 100644 index 0000000..66735a7 --- /dev/null +++ b/acct-group/plugdev/plugdev-0-r1.ebuild @@ -0,0 +1,9 @@ +# Copyright 2019-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit acct-group + +DESCRIPTION="Group controlling access to removable media" +ACCT_GROUP_ID=272 diff --git a/dev-cpp/gulrak-filesystem/Manifest b/dev-cpp/gulrak-filesystem/Manifest new file mode 100644 index 0000000..dca2506 --- /dev/null +++ b/dev-cpp/gulrak-filesystem/Manifest @@ -0,0 +1,3 @@ +DIST gulrak-filesystem-1.5.10.tar.gz 176873 BLAKE2B 0c9ccfd918ede195c65a25a361c9d3a7acca99d2e5e917911a5dcd7e74c989c291f37e962943771860ea8b14f26d066863faea4dd17cb25d44aa9061913d5e5c SHA512 470dd9e1c4358f9d8d9f531d8c3c6716cdd156c815315748436a1dc3caf095d320e58eae2274df8c15e293cc96170752fb00aed8ad2210d417b174c13297fbac +EBUILD gulrak-filesystem-1.5.10.ebuild 740 BLAKE2B 40fe1f3d586ec7fdfe0a5782b2668077fcb534745789bebcdd31f717763d2c02ba9f0072ada0c1cd9303183c63379328b9cce4d5fac558924b073a7e573151a4 SHA512 83b2b4c5fe819672e8b38b21760a42607325bbae9568a5e5e3cfba569e5d5376aae66cf8031e35c450a54bd3d620ad9986e48f39b1478e97e0678f71870b8f8e +MISC metadata.xml 330 BLAKE2B 00186bf8c44c6d7268ff44a6914530d56ef344300d10285a84b3a705e9f463e74aabcdb8bd4375d5e094e662565dbeeca882d33e72f24ae35392c63b7d63377f SHA512 9e84dee6929db5525f13d961bdf17b2db795f5f8cb4211aed4b1d3286207b8935e9a4276a7c0ebe09317347f64e8a54a835d2f607ae47b737462bdf9dbfc1c79 diff --git a/dev-cpp/gulrak-filesystem/gulrak-filesystem-1.5.10.ebuild b/dev-cpp/gulrak-filesystem/gulrak-filesystem-1.5.10.ebuild new file mode 100644 index 0000000..4ca983d --- /dev/null +++ b/dev-cpp/gulrak-filesystem/gulrak-filesystem-1.5.10.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cmake + +DESCRIPTION="Header-only single-file std::filesystem compatible helper library" +HOMEPAGE="https://github.com/gulrak/filesystem" +SRC_URI="https://github.com/gulrak/filesystem/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="examples test" +RESTRICT="!test? ( test )" + +S="${WORKDIR}/${P#*-}" + +src_configure() { + local mycmakeargs=( + -DGHC_FILESYSTEM_BUILD_EXAMPLES=OFF + -DGHC_FILESYSTEM_BUILD_TESTING=$(usex test) + -DGHC_FILESYSTEM_WITH_INSTALL=ON + ) + + cmake_src_configure +} + +src_install() { + cmake_src_install + + docinto examples + use examples && dodoc examples/*.cpp +} diff --git a/dev-cpp/gulrak-filesystem/metadata.xml b/dev-cpp/gulrak-filesystem/metadata.xml new file mode 100644 index 0000000..e567ba1 --- /dev/null +++ b/dev-cpp/gulrak-filesystem/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>chewi@gentoo.org</email> + <name>James Le Cuirot</name> + </maintainer> + <upstream> + <remote-id type="github">gulrak/filesystem</remote-id> + </upstream> +</pkgmetadata> diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest new file mode 100644 index 0000000..80db4e2 --- /dev/null +++ b/dev-lang/python/Manifest @@ -0,0 +1,7 @@ +AUX pydoc.conf 169 BLAKE2B ce40bb3d5f858bd7a8d9ef5bf215a8ab592568a724f0e08aea219da014dac12fdfcbcf5fb168bb9aa57be110f74d656aed46179ffe11e3c992d84a647e442b7b SHA512 30d0776a4004cd641e6f283658c3c24915a21ea15fe40e506ff2c3a5f95936aa00c9490b04ab25f29e9b7ac65cd88fd54ca0b08e000e73820b13c7c57c0bf5b2 +AUX pydoc.init 18356 BLAKE2B 8ec51539d5f1f85ccfa5b55f8840da9a2146f68fc2de6b96d5d9169465b52bd3e7e7d5922b801838da81701741c6e76db8f0405d893548e1f4a48b9d65d16616 SHA512 a69948cdc5f456950639c3a6e4b8e4197f1c7139cec770005a36f3ddd86da3ebbafebaf4d0ed84752148abb936124e6b085117fad6a895384f3ac85b60a991ff +DIST Python-3.8.12.tar.xz 18443568 BLAKE2B 73413aee7a31347ac4342718a54d23d4036220262c4cd41cd50b06c3b1698d52d11cf7ac2c781b919f2cdb0dcb6397d623c463dcdcd1edca99abbbce239a3c6e SHA512 2f93fe5ff83f470c7b6a1b7f29f499a2a010fabd649e9fe65ad3fbfa21b6e1966e77c9b7ac012d978159bc3fe63fec2d64bc6982fc2ee1714d3fa0e47631f279 +DIST Python-3.8.12.tar.xz.asc 833 BLAKE2B 33f59aa667555832ee510d2a7295079f34a3983dfa84beab20b33ec691ea3eecfcc4a62591fe233fc30622d0236ee69a3d41b8922ee2f4c632df3523d565c3ec SHA512 ef552b716a721f410abb14387594c8b0ddc65ce4b8a6ae6bf920c1db2ea9ddf6bbf547e93d3716495ae31848eb1049aae4257016e888393681bbfb6f6529bc12 +DIST python-gentoo-patches-3.8.12_p1.tar.xz 16632 BLAKE2B cce7a41d020af1ffc55a01ef67b20bcb16c68adbccc1e44ef166d1707e817ed6c3bae70f84c56553f27bca449015e273014c0be73bc2f9b4e25844ddce385486 SHA512 4621727c2e9cc1c5519e021210e16a97e7167ea831445dfdd07f5b0ed642b5919834244111708a971ce098b10b439797e1c76827eccab803f801052c671f1ae6 +EBUILD python-3.8.12_p1-r1.ebuild 9938 BLAKE2B af641dd352b65814ec8b54d3d205f89174ac4d1ca11d8c6138c2d00bb1918ef982bbb82a0e15dedbb9ba43a2f9f3b63d853cc49cd0cb399a469b5ca1a6825ec7 SHA512 5c6b45639b13d5cc5fd97aebad52f1ee5832d646857510dc5909e0f0afd7cd0dc848dbf78a7e12838d072c3b036ef93cfe11bee528d42bda43afddad0b1e03db +MISC metadata.xml 740 BLAKE2B 31abd8d03440517adf39f29f36e87f821dbf029602f40d4b252b1ec8e6a52955ad9325fe66a9a3bd2e9c4436e6c6865853f75c3169016c7a44327a06b07694df SHA512 b601a773d5fe4e29d43e9ce5d857bb525b706b95745056a74a2476a37f182075363cb44814f9d6f73b8be08a63d75ec322b608463796c6eef7aa8d636a2350b8 diff --git a/dev-lang/python/files/pydoc.conf b/dev-lang/python/files/pydoc.conf new file mode 100644 index 0000000..3c6920c --- /dev/null +++ b/dev-lang/python/files/pydoc.conf @@ -0,0 +1,6 @@ +# /etc/init.d/pydoc.conf + +# This file contains the configuration for pydoc's internal webserver. + +# Default port for Python's pydoc server. +@PYDOC_PORT_VARIABLE@="7464" diff --git a/dev-lang/python/files/pydoc.init b/dev-lang/python/files/pydoc.init new file mode 100644 index 0000000..62326ec --- /dev/null +++ b/dev-lang/python/files/pydoc.init @@ -0,0 +1,278 @@ +<!DOCTYPE html> +<html lang='en'> +<head> +<title>pydoc.init « files « python « dev-lang - repo/gentoo.git - Official Gentoo ebuild repository</title> +<meta name='generator' content='cgit v1.2.3-18-g5258'/> +<meta name='robots' content='index,follow'/> +<link rel='stylesheet' type='text/css' href='/cgit.css'/> +<link rel='shortcut icon' href='//www.gentoo.org/favicon.ico'/> +<link rel='alternate' title='Atom feed' href='https://gitweb.gentoo.org/repo/gentoo.git/atom/dev-lang/python/files/pydoc.init?h=master' type='application/atom+xml'/> +<link rel='vcs-git' href='https://anongit.gentoo.org/git/repo/gentoo.git' title='repo/gentoo.git Git repository'/> +<link rel='vcs-git' href='git+ssh://git@git.gentoo.org/repo/gentoo.git' title='repo/gentoo.git Git repository'/> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta name="theme-color" content="#54487a"> +<meta name="description" content="Browse the Gentoo Git repositories"> +<link href="https://assets.gentoo.org/tyrian/v2/tyrian.min.css" rel="stylesheet" media="screen"> +</head> +<body> +<header> + <div class="site-title"> + <div class="container"> + <div class="row justify-content-between"> + <div class="logo"> + <a href="/" title="Back to the homepage" class="site-logo"> + <img src="https://assets.gentoo.org/tyrian/v2/site-logo.png" alt="Gentoo" srcset="https://assets.gentoo.org/tyrian/v2/site-logo.svg"> + </a> + <span class="site-label">GitWeb</span> + </div> + <div class="site-title-buttons"> + <div class="btn-group btn-group-sm"> + <a href="https://get.gentoo.org/" role="button" class="btn get-gentoo"><span class="fa fa-fw fa-download"></span> + <strong>Get Gentoo!</strong></a> + <div class="btn-group btn-group-sm"> + <a class="btn gentoo-org-sites dropdown-toggle" data-toggle="dropdown" data-target="#" href="#"> + <span class="fa fa-fw fa-map-o"></span> <span class="d-none d-sm-inline">gentoo.org sites</span> + <span class="caret"></span> + </a> + <div class="dropdown-menu dropdown-menu-right"> + <a class="dropdown-item" href="https://www.gentoo.org/" title="Main Gentoo website"><span class="fa fa-home fa-fw"></span> + gentoo.org</a> + <a class="dropdown-item" href="https://wiki.gentoo.org/" title="Find and contribute documentation"><span class="fa fa-file-text-o fa-fw"></span> + Wiki</a> + <a class="dropdown-item" href="https://bugs.gentoo.org/" title="Report issues and find common issues"><span class="fa fa-bug fa-fw"></span> + Bugs</a> + <a class="dropdown-item" href="https://forums.gentoo.org/" title="Discuss with the community"><span class="fa fa-comments-o fa-fw"></span> + Forums</a> + <a class="dropdown-item" href="https://packages.gentoo.org/" title="Find software for your Gentoo"><span class="fa fa-hdd-o fa-fw"></span> + Packages</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="https://planet.gentoo.org/" title="Find out what's going on in the developer community"><span class="fa fa-rss fa-fw"></span> + Planet</a> + <a class="dropdown-item" href="https://archives.gentoo.org/" title="Read up on past discussions"><span class="fa fa-archive fa-fw"></span> + Archives</a> + <a class="dropdown-item" href="https://sources.gentoo.org/" title="Browse our source code"><span class="fa fa-code fa-fw"></span> + Sources</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="https://infra-status.gentoo.org/" title="Get updates on the services provided by Gentoo"><span class="fa fa-server fa-fw"></span> + Infra Status</a> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + <nav class="tyrian-navbar navbar navbar-dark navbar-expand-lg bg-primary" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-main-collapse" aria-controls="navbar-main-collapse" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + </div> + <div class="collapse navbar-collapse navbar-main-collapse" id="navbar-main-collapse"> + <ul class="navbar-nav mr-auto"> + <li class="nav-item"><a class="nav-link" href="/">Home</a></li> + <li class="nav-item"><a class="nav-link" href="/repo/gentoo.git">Gentoo Repository</a></li> + <li class="nav-item"><a class="nav-link" href="/repo/">Repositories</a></li> + <li class="nav-item"><a class="nav-link" href="/proj/">Projects</a></li> + <li class="nav-item"><a class="nav-link" href="/dev/">Developer Overlays</a></li> + <li class="nav-item"><a class="nav-link" href="/user/">User Overlays</a></li> + <li class="nav-item"><a class="nav-link" href="/data/">Data</a></li> + <li class="nav-item"><a class="nav-link" href="/sites/">Websites</a></li> + </ul> + </div> + </div> + </nav> +</header> + +<div class="container pb-5"> + <div class="row"> + <div class="col-md-12"> +<div id='cgit'><table id='header'> +<tr> +<td class='logo' rowspan='2'><a href='/'><img src='/cgit.png' alt='cgit logo'/></a></td> +<td class='main'><a href='/'>index</a> : <a title='repo/gentoo.git' href='/repo/gentoo.git/'>repo/gentoo.git</a></td><td class='form'><form method='get'> +<select name='h' onchange='this.form.submit();'> +<option value='master' selected='selected'>master</option> +</select> <input type='submit' value='switch'/></form></td></tr> +<tr><td class='sub'>Official Gentoo ebuild repository</td><td class='sub right'>Infrastructure team <infrastructure@gentoo.org></td></tr></table> +<table class='tabs'><tr><td> +<a href='/repo/gentoo.git/'>summary</a><a href='/repo/gentoo.git/refs/'>refs</a><a href='/repo/gentoo.git/log/dev-lang/python/files/pydoc.init'>log</a><a class='active' href='/repo/gentoo.git/tree/dev-lang/python/files/pydoc.init'>tree</a><a href='/repo/gentoo.git/commit/dev-lang/python/files/pydoc.init'>commit</a><a href='/repo/gentoo.git/diff/dev-lang/python/files/pydoc.init'>diff</a></td><td class='form'><form class='right' method='get' action='/repo/gentoo.git/log/dev-lang/python/files/pydoc.init'> +<select name='qt'> +<option value='grep'>log msg</option> +<option value='author'>author</option> +<option value='committer'>committer</option> +<option value='range'>range</option> +</select> +<input class='txt' type='search' size='10' name='q' value=''/> +<input type='submit' value='search'/> +</form> +</td></tr></table> +<div class='path'>path: <a href='/repo/gentoo.git/tree/'>root</a>/<a href='/repo/gentoo.git/tree/dev-lang'>dev-lang</a>/<a href='/repo/gentoo.git/tree/dev-lang/python'>python</a>/<a href='/repo/gentoo.git/tree/dev-lang/python/files'>files</a>/<a href='/repo/gentoo.git/tree/dev-lang/python/files/pydoc.init'>pydoc.init</a></div><div class='content'>blob: f8e05636da4ed1970e196aa65ff063b761656ba9 (<a href='/repo/gentoo.git/plain/dev-lang/python/files/pydoc.init'>plain</a>) +<table summary='blob content' class='blob'> +<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a> +<a id='n2' href='#n2'>2</a> +<a id='n3' href='#n3'>3</a> +<a id='n4' href='#n4'>4</a> +<a id='n5' href='#n5'>5</a> +<a id='n6' href='#n6'>6</a> +<a id='n7' href='#n7'>7</a> +<a id='n8' href='#n8'>8</a> +<a id='n9' href='#n9'>9</a> +<a id='n10' href='#n10'>10</a> +<a id='n11' href='#n11'>11</a> +<a id='n12' href='#n12'>12</a> +<a id='n13' href='#n13'>13</a> +<a id='n14' href='#n14'>14</a> +<a id='n15' href='#n15'>15</a> +<a id='n16' href='#n16'>16</a> +<a id='n17' href='#n17'>17</a> +<a id='n18' href='#n18'>18</a> +<a id='n19' href='#n19'>19</a> +<a id='n20' href='#n20'>20</a> +<a id='n21' href='#n21'>21</a> +<a id='n22' href='#n22'>22</a> +<a id='n23' href='#n23'>23</a> +<a id='n24' href='#n24'>24</a> +</pre></td> +<td class='lines'><pre><code><style>pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight .c { color: #888888 } /* Comment */ +.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ +.highlight .k { color: #008800; font-weight: bold } /* Keyword */ +.highlight .ch { color: #888888 } /* Comment.Hashbang */ +.highlight .cm { color: #888888 } /* Comment.Multiline */ +.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ +.highlight .cpf { color: #888888 } /* Comment.PreprocFile */ +.highlight .c1 { color: #888888 } /* Comment.Single */ +.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ +.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #aa0000 } /* Generic.Error */ +.highlight .gh { color: #333333 } /* Generic.Heading */ +.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #555555 } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #666666 } /* Generic.Subheading */ +.highlight .gt { color: #aa0000 } /* Generic.Traceback */ +.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #008800 } /* Keyword.Pseudo */ +.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ +.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ +.highlight .na { color: #336699 } /* Name.Attribute */ +.highlight .nb { color: #003388 } /* Name.Builtin */ +.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ +.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ +.highlight .nd { color: #555555 } /* Name.Decorator */ +.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ +.highlight .nl { color: #336699; font-style: italic } /* Name.Label */ +.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ +.highlight .py { color: #336699; font-weight: bold } /* Name.Property */ +.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #336699 } /* Name.Variable */ +.highlight .ow { color: #008800 } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ +.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ +.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ +.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ +.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ +.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ +.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ +.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ +.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ +.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ +.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ +.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ +.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ +.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ +.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ +.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ +.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ +.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ +.highlight .vc { color: #336699 } /* Name.Variable.Class */ +.highlight .vg { color: #dd7700 } /* Name.Variable.Global */ +.highlight .vi { color: #3333bb } /* Name.Variable.Instance */ +.highlight .vm { color: #336699 } /* Name.Variable.Magic */ +.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="c1">#!/sbin/openrc-run</span> +<span class="c1"># Copyright 1999-2016 Gentoo Foundation</span> +<span class="c1"># Distributed under the terms of the GNU General Public Licence v2</span> + +<span class="n">start</span><span class="p">()</span> <span class="p">{</span> + <span class="n">local</span> <span class="n">pydoc_port</span><span class="o">=</span><span class="s2">"${@PYDOC_PORT_VARIABLE@-${PYDOC_PORT}}"</span> + + <span class="k">if</span> <span class="p">[</span> <span class="o">-</span><span class="n">z</span> <span class="s2">"${pydoc_port}"</span> <span class="p">];</span> <span class="n">then</span> + <span class="n">eerror</span> <span class="s2">"Port not set"</span> + <span class="k">return</span> <span class="mi">1</span> + <span class="n">fi</span> + + <span class="n">ebegin</span> <span class="s2">"Starting pydoc server on port ${pydoc_port}"</span> + <span class="n">start</span><span class="o">-</span><span class="n">stop</span><span class="o">-</span><span class="n">daemon</span> <span class="o">--</span><span class="n">start</span> <span class="o">--</span><span class="n">background</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">pidfile</span> \ + <span class="o">--</span><span class="n">pidfile</span> <span class="o">/</span><span class="k">var</span><span class="o">/</span><span class="n">run</span><span class="o">/</span><span class="err">@</span><span class="n">PYDOC</span><span class="err">@</span><span class="o">.</span><span class="n">pid</span> \ + <span class="o">--</span><span class="n">exec</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="err">@</span><span class="n">PYDOC</span><span class="err">@</span> <span class="o">--</span> <span class="o">-</span><span class="n">p</span> <span class="s2">"${pydoc_port}"</span> + <span class="n">eend</span> <span class="o">$</span><span class="err">?</span> +<span class="p">}</span> + +<span class="n">stop</span><span class="p">()</span> <span class="p">{</span> + <span class="n">ebegin</span> <span class="s2">"Stopping pydoc server"</span> + <span class="n">start</span><span class="o">-</span><span class="n">stop</span><span class="o">-</span><span class="n">daemon</span> <span class="o">--</span><span class="n">stop</span> <span class="o">--</span><span class="n">quiet</span> <span class="o">--</span><span class="n">pidfile</span> <span class="o">/</span><span class="k">var</span><span class="o">/</span><span class="n">run</span><span class="o">/</span><span class="err">@</span><span class="n">PYDOC</span><span class="err">@</span><span class="o">.</span><span class="n">pid</span> + <span class="n">eend</span> <span class="o">$</span><span class="err">?</span> +<span class="p">}</span> +</pre></div> +</code></pre></td></tr></table> +</div> <!-- class=content --> + </div> + </div> + </div> + </div> + + <footer> + <div class="container"> + <div class="row"> + <div class="col-12 offset-md-2 col-md-7"> + + </div> + <div class="col-12 col-md-3"> + <h3 class="footerhead">Questions or comments?</h3> + Please feel free to <a href="https://www.gentoo.org/inside-gentoo/contact/">contact us</a>. + </div> + </div> + <div class="row"> + <div class="col-2 col-sm-3 col-md-2"> + <ul class="footerlinks three-icons"> + <li><a href="https://twitter.com/gentoo" title="@Gentoo on Twitter"><span class="fa fa-twitter fa-fw"></span></a></li> + <li><a href="https://www.facebook.com/gentoo.org" title="Gentoo on Facebook"><span class="fa fa-facebook fa-fw"></span></a></li> + <li></li> + </ul> + </div> + <div class="col-10 col-sm-9 col-md-10"> + <strong>© 2001–2021 Gentoo Foundation, Inc.</strong><br> + <small> + Gentoo is a trademark of the Gentoo Foundation, Inc. + The contents of this document, unless otherwise expressly stated, are licensed under the + <a href="https://creativecommons.org/licenses/by-sa/4.0/" rel="license">CC-BY-SA-4.0</a> license. + The <a href="https://www.gentoo.org/inside-gentoo/foundation/name-logo-guidelines.html">Gentoo Name and Logo Usage Guidelines</a> apply. + </small> + </div> + </div> + </div> + </footer> + + <script src="https://assets.gentoo.org/tyrian/v2/jquery-3.3.slim.js"></script> + <script src="https://assets.gentoo.org/tyrian/v2/popper.min.js"></script> + <script src="https://assets.gentoo.org/tyrian/v2/bootstrap.min.js"></script> +</div> <!-- id=cgit --> +</body> +</html> diff --git a/dev-lang/python/metadata.xml b/dev-lang/python/metadata.xml new file mode 100644 index 0000000..54c2aa9 --- /dev/null +++ b/dev-lang/python/metadata.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> +</maintainer> +<use> + <flag name="bluetooth">Build Bluetooth protocol support in socket module</flag> + <flag name="libedit">Link readline extension against <pkg>dev-libs/libedit</pkg> instead of <pkg>sys-libs/readline</pkg>.</flag> + <flag name="pgo">Optimize the build using Profile Guided Optimization (PGO)</flag> + <flag name="lto">Optimize the build using Link Time Optimization (LTO)</flag> + <flag name="wininst">Install Windows executables required to create an executable installer for MS Windows.</flag> +</use> +</pkgmetadata> diff --git a/dev-lang/python/python-3.8.12_p1-r1.ebuild b/dev-lang/python/python-3.8.12_p1-r1.ebuild new file mode 100644 index 0000000..5c31c44 --- /dev/null +++ b/dev-lang/python/python-3.8.12_p1-r1.ebuild @@ -0,0 +1,340 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +WANT_LIBTOOL="none" + +inherit autotools flag-o-matic multiprocessing pax-utils \ + python-utils-r1 toolchain-funcs verify-sig + +MY_PV=${PV/_rc/rc} +MY_P="Python-${MY_PV%_p*}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-${MY_PV}" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE="https://www.python.org/" +SRC_URI="https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~floppym/python/${PATCHSET}.tar.xz + verify-sig? ( + https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz.asc + )" +S="${WORKDIR}/${MY_P}" + +LICENSE="PSF-2" +SLOT="${PYVER}" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" +IUSE="bluetooth build examples gdbm hardened +ncurses +readline +sqlite +ssl test tk wininst +xml" +RESTRICT="!test? ( test )" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND="app-arch/bzip2:= + app-arch/xz-utils:= + dev-lang/python-exec[python_targets_python3_8(-)] + dev-libs/libffi:= + sys-apps/util-linux:= + >=sys-libs/zlib-1.1.3:= + virtual/libcrypt:= + virtual/libintl + gdbm? ( sys-libs/gdbm:=[berkdb] ) + ncurses? ( >=sys-libs/ncurses-5.2:= ) + readline? ( >=sys-libs/readline-4.1:= ) + sqlite? ( >=dev-db/sqlite-3.3.8:3= ) + ssl? ( >=dev-libs/openssl-1.1.1:= ) + tk? ( + >=dev-lang/tcl-8.0:= + >=dev-lang/tk-8.0:= + dev-tcltk/blt:= + dev-tcltk/tix + ) + xml? ( >=dev-libs/expat-2.1:= )" +# bluetooth requires headers from bluez +DEPEND="${RDEPEND} + bluetooth? ( net-wireless/bluez ) + test? ( app-arch/xz-utils[extra-filters(+)] )" +BDEPEND=" + virtual/awk + virtual/pkgconfig + sys-devel/autoconf-archive + verify-sig? ( sec-keys/openpgp-keys-python ) + !sys-devel/gcc[libffi(-)]" +RDEPEND+=" !build? ( app-misc/mime-types )" + +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc + +src_unpack() { + if use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} + fi + default +} + +src_prepare() { + # Ensure that internal copies of expat, libffi and zlib are not used. + rm -fr Modules/expat || die + rm -fr Modules/_ctypes/libffi* || die + rm -fr Modules/zlib || die + + local PATCHES=( + "${WORKDIR}/${PATCHSET}" + ) + + default + + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" + + # force correct number of jobs + # https://bugs.gentoo.org/737660 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die + + eautoreconf +} + +src_configure() { + local disable + # disable automagic bluetooth headers detection + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no + use gdbm || disable+=" gdbm" + use ncurses || disable+=" _curses _curses_panel" + use readline || disable+=" readline" + use sqlite || disable+=" _sqlite3" + use ssl || export PYTHON_DISABLE_SSL="1" + use tk || disable+=" _tkinter" + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. + export PYTHON_DISABLE_MODULES="${disable}" + + if ! use xml; then + ewarn "You have configured Python without XML support." + ewarn "This is NOT a recommended configuration as you" + ewarn "may face problems parsing any XML documents." + fi + + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" + fi + + if [[ "$(gcc-major-version)" -ge 4 ]]; then + append-flags -fwrapv + fi + + filter-flags -malign-double + + # https://bugs.gentoo.org/show_bug.cgi?id=50309 + if is-flagq -O3; then + is-flagq -fstack-protector-all && replace-flags -O3 -O2 + use hardened && replace-flags -O3 -O2 + fi + + # https://bugs.gentoo.org/700012 + if is-flagq -flto || is-flagq '-flto=*'; then + append-cflags $(test-flags-CC -ffat-lto-objects) + fi + + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. + tc-export CXX + + # Fix implicit declarations on cross and prefix builds. Bug #674070. + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw + + local dbmliborder + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + + local myeconfargs=( + # glibc-2.30 removes it; since we can't cleanly force-rebuild + # Python on glibc upgrade, remove it proactively to give + # a chance for users rebuilding python before glibc + ac_cv_header_stropts_h=no + + --enable-shared + --enable-ipv6 + --infodir='${prefix}/share/info' + --mandir='${prefix}/share/man' + --with-computed-gotos + --with-dbmliborder="${dbmliborder}" + --with-libc= + --enable-loadable-sqlite-extensions + --without-ensurepip + --with-system-expat + --with-system-ffi + ) + + OPT="" econf "${myeconfargs[@]}" + + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then + eerror "configure has detected that the sem_open function is broken." + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." + die "Broken sem_open function (bug 496328)" + fi +} + +src_compile() { + # Ensure sed works as expected + # https://bugs.gentoo.org/594768 + local -x LC_ALL=C + # Prevent using distutils bundled by setuptools. + # https://bugs.gentoo.org/823728 + export SETUPTOOLS_USE_DISTUTILS=stdlib + + emake CPPFLAGS= CFLAGS= LDFLAGS= + + # Work around bug 329499. See also bug 413751 and 457194. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E python + else + pax-mark m python + fi +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # Skip failing tests. + local skipped_tests="gdb" + + for test in ${skipped_tests}; do + mv "${S}"/Lib/test/test_${test}.py "${T}" + done + + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") + + emake test EXTRATESTOPTS="-u-network -j${jobs}" \ + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty + local result=$? + + for test in ${skipped_tests}; do + mv "${T}/test_${test}.py" "${S}"/Lib/test + done + + elog "The following tests have been skipped:" + for test in ${skipped_tests}; do + elog "test_${test}.py" + done + + elog "If you would like to run them, you may:" + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" + elog "and run the tests separately." + + if [[ ${result} -ne 0 ]]; then + die "emake test failed" + fi +} + +src_install() { + local libdir=${ED}/usr/lib/python${PYVER} + + emake DESTDIR="${D}" altinstall + + # Remove static library + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die + + sed \ + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ + -e "s/\(PY_LDFLAGS=\).*/\1/" \ + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" + + # Fix collisions between different slots of Python. + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die + + # Cheap hack to get version with ABIFLAGS + local abiver=$(cd "${ED}/usr/include"; echo python*) + if [[ ${abiver} != python${PYVER} ]]; then + # Replace python3.X with a symlink to python3.Xm + rm "${ED}/usr/bin/python${PYVER}" || die + dosym "${abiver}" "/usr/bin/python${PYVER}" + # Create python3.X-config symlink + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" + # Create python-3.5m.pc symlink + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" + fi + + # python seems to get rebuilt in src_install (bug 569908) + # Work around it for now. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E "${ED}/usr/bin/${abiver}" + else + pax-mark m "${ED}/usr/bin/${abiver}" + fi + + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die + + use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die + + dodoc Misc/{ACKS,HISTORY,NEWS} + + if use examples; then + docinto examples + find Tools -name __pycache__ -exec rm -fr {} + || die + dodoc -r Tools + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ + emake --no-print-directory -s -f - 2>/dev/null) + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${PYVER}:" \ + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" + + local -x EPYTHON=python${PYVER} + # if not using a cross-compiler, use the fresh binary + if ! tc-is-cross-compiler; then + local -x PYTHON=./python + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} + else + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} + fi + + echo "EPYTHON='${EPYTHON}'" > epython.py || die + python_domodule epython.py + + # python-exec wrapping support + local pymajor=${PYVER%.*} + local scriptdir=${D}$(python_get_scriptdir) + mkdir -p "${scriptdir}" || die + # python and pythonX + ln -s "../../../bin/${abiver}" \ + "${scriptdir}/python${pymajor}" || die + ln -s "python${pymajor}" "${scriptdir}/python" || die + # python-config and pythonX-config + # note: we need to create a wrapper rather than symlinking it due + # to some random dirname(argv[0]) magic performed by python-config + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die + #!/bin/sh + exec "${abiver}-config" "\${@}" + EOF + chmod +x "${scriptdir}/python${pymajor}-config" || die + ln -s "python${pymajor}-config" \ + "${scriptdir}/python-config" || die + # 2to3, pydoc + ln -s "../../../bin/2to3-${PYVER}" \ + "${scriptdir}/2to3" || die + ln -s "../../../bin/pydoc${PYVER}" \ + "${scriptdir}/pydoc" || die + # idle + if use tk; then + ln -s "../../../bin/idle${PYVER}" \ + "${scriptdir}/idle" || die + fi +} diff --git a/dev-libs/libratbag/Manifest b/dev-libs/libratbag/Manifest new file mode 100644 index 0000000..21477bc --- /dev/null +++ b/dev-libs/libratbag/Manifest @@ -0,0 +1,6 @@ +AUX ratbagd.init 336 BLAKE2B c6f2ef095cd7d929c3097a18e912ae4b3615bd0ebbdfdaa9f4151b312614c016af2f3581c2fbb2853472cb70ce47d5f26f254772fb9f3dabba2ce93626b672b7 SHA512 3908b3481b49bcebc84e3023ff911dcbc1773e4322356def0067ed4aa426184cf43e12de702e98210157d17c2806d57c1cb4bc79ddb0b8660036a6fe3974607e +DIST libratbag-0.15.tar.gz 249492 BLAKE2B 0f5b35800cb9f82cb892dacd5e3b041843cf5513507ee4882ec5b3f8c8aec8a24594736f2eb1c8e373a0ee38ace1e6328cbd4816d6e5b2cd1f2154ebd803a5fa SHA512 add47a6b3d771de77c6307e128a549f5295e216059b5a2375aa6b2b6bbebcf9a93d7bf148181b3f39f855976e9b6f57072dd9198d07828bebe85409f4ad994aa +DIST libratbag-0.16.tar.gz 253080 BLAKE2B ede56838c822519b4fe4c6846f5d6d237104fc06f96fb17aa62b4c712965f00827973ebe732ee5ac9a16f101baf0b63eb445fbb97746df3b8ed24d6e085b34e1 SHA512 b3f2fee39ec85c0e08d257753241fb0e553de53eb7409a3b95f93a0fac3989a9411c53c915e72bef19bcfc5682fe9cdafaeb1f41f2718ab02766859f565415e3 +EBUILD libratbag-0.15.ebuild 1958 BLAKE2B e4bf7db7c49a78ac78abeffbf1afc38e6acdfd069db6e8812cf5e593f52d085f5d5cdfbb8f570774379ffc3cea6f6534faab6e60c339905df5588898f379e195 SHA512 76b0afa674f72cb36f08d8479735797fbdfb8cbb22f0cd22de065918e25beca60ac27886b0e8bfc40ce0a235ec3a0076fbb05cb0e2e21aa7c9c2bb477cfc381d +EBUILD libratbag-0.16.ebuild 1958 BLAKE2B e4bf7db7c49a78ac78abeffbf1afc38e6acdfd069db6e8812cf5e593f52d085f5d5cdfbb8f570774379ffc3cea6f6534faab6e60c339905df5588898f379e195 SHA512 76b0afa674f72cb36f08d8479735797fbdfb8cbb22f0cd22de065918e25beca60ac27886b0e8bfc40ce0a235ec3a0076fbb05cb0e2e21aa7c9c2bb477cfc381d +MISC metadata.xml 17145 BLAKE2B 580aa6833f2898b3b59b9f76f77641e7419dd8e2005a4fe1e8273a325b98dae4742b4e5aebea84affcd18d45c14568fadb2596cfc9b8213bb1f2595bcc46b8d4 SHA512 33188bcd4338528e1b8c23601f94aaf7798b4f52193ef0b5eae3c0614d52bdbcd373a09a6e4abb8015adb77f0149755ddcfd6bd380dedacfe3476608ee8e0e67 diff --git a/dev-libs/libratbag/files/ratbagd.init b/dev-libs/libratbag/files/ratbagd.init new file mode 100644 index 0000000..d3e7d08 --- /dev/null +++ b/dev-libs/libratbag/files/ratbagd.init @@ -0,0 +1,13 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="system daemon to introspect and modify configurable mice" +pidfile="/run/${SVCNAME}.pid" +command="/usr/bin/ratbagd" +start_stop_daemon_args="--quiet" +command_background="true" + +depend() { + need dbus +} diff --git a/dev-libs/libratbag/libratbag-0.15.ebuild b/dev-libs/libratbag/libratbag-0.15.ebuild new file mode 100644 index 0000000..b46974b --- /dev/null +++ b/dev-libs/libratbag/libratbag-0.15.ebuild @@ -0,0 +1,94 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8..9} ) + +inherit meson python-single-r1 systemd udev + +DESCRIPTION="Library to configure gaming mice" +HOMEPAGE="https://github.com/libratbag/libratbag" +SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="doc elogind systemd test" +REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} + ^^ ( elogind systemd ) +" +RESTRICT="!test? ( test )" + +BDEPEND=" + ${PYTHON_DEPS} + dev-lang/swig + virtual/pkgconfig + doc? ( app-doc/doxygen ) + test? ( + dev-libs/check + dev-libs/gobject-introspection + dev-util/valgrind + $(python_gen_cond_dep ' + dev-python/pygobject:3[${PYTHON_USEDEP}] + dev-python/python-evdev[${PYTHON_USEDEP}] + ') + ) +" +RDEPEND=" + ${PYTHON_DEPS} + acct-group/plugdev + dev-libs/json-glib + dev-libs/libevdev + virtual/libudev + $(python_gen_cond_dep ' + dev-python/pygobject:3[${PYTHON_USEDEP}] + dev-python/python-evdev[${PYTHON_USEDEP}] + ') + elogind? ( sys-auth/elogind ) + systemd? ( sys-apps/systemd ) +" +DEPEND=" + ${RDEPEND} + dev-libs/gobject-introspection +" + +src_prepare() { + default + + if use elogind ; then + # Fix systemd includes for elogind + sed -i -e 's@include <systemd@include <elogind@' \ + ratbagd/ratbag*.c || die + fi +} + +src_configure() { + python_setup + + local emesonargs=( + $(meson_use doc documentation) + $(meson_use systemd) + $(meson_use test tests) + -Ddbus-group="plugdev" + -Dlogind-provider=$(usex elogind elogind systemd) + -Dsystemd-unit-dir="$(systemd_get_systemunitdir)" + -Dudev-dir="${EPREFIX}$(get_udevdir)" + ) + + meson_src_configure +} + +src_install() { + meson_src_install + python_fix_shebang "${ED}"/usr/bin/ + newinitd "${FILESDIR}"/ratbagd.init ratbagd +} + +pkg_postinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + elog 'You need to be in "plugdev" group in order to access the' + elog 'ratbagd dbus interface' + fi +} diff --git a/dev-libs/libratbag/libratbag-0.16.ebuild b/dev-libs/libratbag/libratbag-0.16.ebuild new file mode 100644 index 0000000..b46974b --- /dev/null +++ b/dev-libs/libratbag/libratbag-0.16.ebuild @@ -0,0 +1,94 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8..9} ) + +inherit meson python-single-r1 systemd udev + +DESCRIPTION="Library to configure gaming mice" +HOMEPAGE="https://github.com/libratbag/libratbag" +SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="doc elogind systemd test" +REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} + ^^ ( elogind systemd ) +" +RESTRICT="!test? ( test )" + +BDEPEND=" + ${PYTHON_DEPS} + dev-lang/swig + virtual/pkgconfig + doc? ( app-doc/doxygen ) + test? ( + dev-libs/check + dev-libs/gobject-introspection + dev-util/valgrind + $(python_gen_cond_dep ' + dev-python/pygobject:3[${PYTHON_USEDEP}] + dev-python/python-evdev[${PYTHON_USEDEP}] + ') + ) +" +RDEPEND=" + ${PYTHON_DEPS} + acct-group/plugdev + dev-libs/json-glib + dev-libs/libevdev + virtual/libudev + $(python_gen_cond_dep ' + dev-python/pygobject:3[${PYTHON_USEDEP}] + dev-python/python-evdev[${PYTHON_USEDEP}] + ') + elogind? ( sys-auth/elogind ) + systemd? ( sys-apps/systemd ) +" +DEPEND=" + ${RDEPEND} + dev-libs/gobject-introspection +" + +src_prepare() { + default + + if use elogind ; then + # Fix systemd includes for elogind + sed -i -e 's@include <systemd@include <elogind@' \ + ratbagd/ratbag*.c || die + fi +} + +src_configure() { + python_setup + + local emesonargs=( + $(meson_use doc documentation) + $(meson_use systemd) + $(meson_use test tests) + -Ddbus-group="plugdev" + -Dlogind-provider=$(usex elogind elogind systemd) + -Dsystemd-unit-dir="$(systemd_get_systemunitdir)" + -Dudev-dir="${EPREFIX}$(get_udevdir)" + ) + + meson_src_configure +} + +src_install() { + meson_src_install + python_fix_shebang "${ED}"/usr/bin/ + newinitd "${FILESDIR}"/ratbagd.init ratbagd +} + +pkg_postinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + elog 'You need to be in "plugdev" group in order to access the' + elog 'ratbagd dbus interface' + fi +} diff --git a/dev-libs/libratbag/metadata.xml b/dev-libs/libratbag/metadata.xml new file mode 100644 index 0000000..f8eda1d --- /dev/null +++ b/dev-libs/libratbag/metadata.xml @@ -0,0 +1,268 @@ +<!DOCTYPE html> +<html lang='en'> +<head> +<title>metadata.xml « libratbag « dev-libs - repo/gentoo.git - Official Gentoo ebuild repository</title> +<meta name='generator' content='cgit v1.2.3-18-g5258'/> +<meta name='robots' content='index,follow'/> +<link rel='stylesheet' type='text/css' href='/cgit.css'/> +<link rel='shortcut icon' href='//www.gentoo.org/favicon.ico'/> +<link rel='alternate' title='Atom feed' href='https://gitweb.gentoo.org/repo/gentoo.git/atom/dev-libs/libratbag/metadata.xml?h=master' type='application/atom+xml'/> +<link rel='vcs-git' href='https://anongit.gentoo.org/git/repo/gentoo.git' title='repo/gentoo.git Git repository'/> +<link rel='vcs-git' href='git+ssh://git@git.gentoo.org/repo/gentoo.git' title='repo/gentoo.git Git repository'/> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta name="theme-color" content="#54487a"> +<meta name="description" content="Browse the Gentoo Git repositories"> +<link href="https://assets.gentoo.org/tyrian/v2/tyrian.min.css" rel="stylesheet" media="screen"> +</head> +<body> +<header> + <div class="site-title"> + <div class="container"> + <div class="row justify-content-between"> + <div class="logo"> + <a href="/" title="Back to the homepage" class="site-logo"> + <img src="https://assets.gentoo.org/tyrian/v2/site-logo.png" alt="Gentoo" srcset="https://assets.gentoo.org/tyrian/v2/site-logo.svg"> + </a> + <span class="site-label">GitWeb</span> + </div> + <div class="site-title-buttons"> + <div class="btn-group btn-group-sm"> + <a href="https://get.gentoo.org/" role="button" class="btn get-gentoo"><span class="fa fa-fw fa-download"></span> + <strong>Get Gentoo!</strong></a> + <div class="btn-group btn-group-sm"> + <a class="btn gentoo-org-sites dropdown-toggle" data-toggle="dropdown" data-target="#" href="#"> + <span class="fa fa-fw fa-map-o"></span> <span class="d-none d-sm-inline">gentoo.org sites</span> + <span class="caret"></span> + </a> + <div class="dropdown-menu dropdown-menu-right"> + <a class="dropdown-item" href="https://www.gentoo.org/" title="Main Gentoo website"><span class="fa fa-home fa-fw"></span> + gentoo.org</a> + <a class="dropdown-item" href="https://wiki.gentoo.org/" title="Find and contribute documentation"><span class="fa fa-file-text-o fa-fw"></span> + Wiki</a> + <a class="dropdown-item" href="https://bugs.gentoo.org/" title="Report issues and find common issues"><span class="fa fa-bug fa-fw"></span> + Bugs</a> + <a class="dropdown-item" href="https://forums.gentoo.org/" title="Discuss with the community"><span class="fa fa-comments-o fa-fw"></span> + Forums</a> + <a class="dropdown-item" href="https://packages.gentoo.org/" title="Find software for your Gentoo"><span class="fa fa-hdd-o fa-fw"></span> + Packages</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="https://planet.gentoo.org/" title="Find out what's going on in the developer community"><span class="fa fa-rss fa-fw"></span> + Planet</a> + <a class="dropdown-item" href="https://archives.gentoo.org/" title="Read up on past discussions"><span class="fa fa-archive fa-fw"></span> + Archives</a> + <a class="dropdown-item" href="https://sources.gentoo.org/" title="Browse our source code"><span class="fa fa-code fa-fw"></span> + Sources</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="https://infra-status.gentoo.org/" title="Get updates on the services provided by Gentoo"><span class="fa fa-server fa-fw"></span> + Infra Status</a> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + <nav class="tyrian-navbar navbar navbar-dark navbar-expand-lg bg-primary" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-main-collapse" aria-controls="navbar-main-collapse" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + </div> + <div class="collapse navbar-collapse navbar-main-collapse" id="navbar-main-collapse"> + <ul class="navbar-nav mr-auto"> + <li class="nav-item"><a class="nav-link" href="/">Home</a></li> + <li class="nav-item"><a class="nav-link" href="/repo/gentoo.git">Gentoo Repository</a></li> + <li class="nav-item"><a class="nav-link" href="/repo/">Repositories</a></li> + <li class="nav-item"><a class="nav-link" href="/proj/">Projects</a></li> + <li class="nav-item"><a class="nav-link" href="/dev/">Developer Overlays</a></li> + <li class="nav-item"><a class="nav-link" href="/user/">User Overlays</a></li> + <li class="nav-item"><a class="nav-link" href="/data/">Data</a></li> + <li class="nav-item"><a class="nav-link" href="/sites/">Websites</a></li> + </ul> + </div> + </div> + </nav> +</header> + +<div class="container pb-5"> + <div class="row"> + <div class="col-md-12"> +<div id='cgit'><table id='header'> +<tr> +<td class='logo' rowspan='2'><a href='/'><img src='/cgit.png' alt='cgit logo'/></a></td> +<td class='main'><a href='/'>index</a> : <a title='repo/gentoo.git' href='/repo/gentoo.git/'>repo/gentoo.git</a></td><td class='form'><form method='get'> +<select name='h' onchange='this.form.submit();'> +<option value='master' selected='selected'>master</option> +</select> <input type='submit' value='switch'/></form></td></tr> +<tr><td class='sub'>Official Gentoo ebuild repository</td><td class='sub right'>Infrastructure team <infrastructure@gentoo.org></td></tr></table> +<table class='tabs'><tr><td> +<a href='/repo/gentoo.git/'>summary</a><a href='/repo/gentoo.git/refs/'>refs</a><a href='/repo/gentoo.git/log/dev-libs/libratbag/metadata.xml'>log</a><a class='active' href='/repo/gentoo.git/tree/dev-libs/libratbag/metadata.xml'>tree</a><a href='/repo/gentoo.git/commit/dev-libs/libratbag/metadata.xml'>commit</a><a href='/repo/gentoo.git/diff/dev-libs/libratbag/metadata.xml'>diff</a></td><td class='form'><form class='right' method='get' action='/repo/gentoo.git/log/dev-libs/libratbag/metadata.xml'> +<select name='qt'> +<option value='grep'>log msg</option> +<option value='author'>author</option> +<option value='committer'>committer</option> +<option value='range'>range</option> +</select> +<input class='txt' type='search' size='10' name='q' value=''/> +<input type='submit' value='search'/> +</form> +</td></tr></table> +<div class='path'>path: <a href='/repo/gentoo.git/tree/'>root</a>/<a href='/repo/gentoo.git/tree/dev-libs'>dev-libs</a>/<a href='/repo/gentoo.git/tree/dev-libs/libratbag'>libratbag</a>/<a href='/repo/gentoo.git/tree/dev-libs/libratbag/metadata.xml'>metadata.xml</a></div><div class='content'>blob: 1829a7338338e8f3dffbf7b462c221f8c31c47a7 (<a href='/repo/gentoo.git/plain/dev-libs/libratbag/metadata.xml'>plain</a>) +<table summary='blob content' class='blob'> +<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a> +<a id='n2' href='#n2'>2</a> +<a id='n3' href='#n3'>3</a> +<a id='n4' href='#n4'>4</a> +<a id='n5' href='#n5'>5</a> +<a id='n6' href='#n6'>6</a> +<a id='n7' href='#n7'>7</a> +<a id='n8' href='#n8'>8</a> +<a id='n9' href='#n9'>9</a> +<a id='n10' href='#n10'>10</a> +<a id='n11' href='#n11'>11</a> +<a id='n12' href='#n12'>12</a> +<a id='n13' href='#n13'>13</a> +<a id='n14' href='#n14'>14</a> +<a id='n15' href='#n15'>15</a> +<a id='n16' href='#n16'>16</a> +<a id='n17' href='#n17'>17</a> +<a id='n18' href='#n18'>18</a> +<a id='n19' href='#n19'>19</a> +</pre></td> +<td class='lines'><pre><code><style>pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight .c { color: #888888 } /* Comment */ +.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ +.highlight .k { color: #008800; font-weight: bold } /* Keyword */ +.highlight .ch { color: #888888 } /* Comment.Hashbang */ +.highlight .cm { color: #888888 } /* Comment.Multiline */ +.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ +.highlight .cpf { color: #888888 } /* Comment.PreprocFile */ +.highlight .c1 { color: #888888 } /* Comment.Single */ +.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ +.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #aa0000 } /* Generic.Error */ +.highlight .gh { color: #333333 } /* Generic.Heading */ +.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #555555 } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #666666 } /* Generic.Subheading */ +.highlight .gt { color: #aa0000 } /* Generic.Traceback */ +.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #008800 } /* Keyword.Pseudo */ +.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ +.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ +.highlight .na { color: #336699 } /* Name.Attribute */ +.highlight .nb { color: #003388 } /* Name.Builtin */ +.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ +.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ +.highlight .nd { color: #555555 } /* Name.Decorator */ +.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ +.highlight .nl { color: #336699; font-style: italic } /* Name.Label */ +.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ +.highlight .py { color: #336699; font-weight: bold } /* Name.Property */ +.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #336699 } /* Name.Variable */ +.highlight .ow { color: #008800 } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ +.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ +.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ +.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ +.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ +.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ +.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ +.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ +.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ +.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ +.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ +.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ +.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ +.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ +.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ +.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ +.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ +.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ +.highlight .vc { color: #336699 } /* Name.Variable.Class */ +.highlight .vg { color: #dd7700 } /* Name.Variable.Global */ +.highlight .vi { color: #3333bb } /* Name.Variable.Instance */ +.highlight .vm { color: #336699 } /* Name.Variable.Magic */ +.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span> +<span class="cp"><!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"></span> +<span class="nt"><pkgmetadata></span> + <span class="nt"><maintainer</span> <span class="na">type=</span><span class="s">"person"</span> <span class="na">proxied=</span><span class="s">"yes"</span><span class="nt">></span> + <span class="nt"><email></span>alex@1stleg.com<span class="nt"></email></span> + <span class="nt"><name></span>Alex Barker<span class="nt"></name></span> + <span class="nt"></maintainer></span> + <span class="nt"><maintainer</span> <span class="na">type=</span><span class="s">"project"</span> <span class="na">proxied=</span><span class="s">"proxy"</span><span class="nt">></span> + <span class="nt"><email></span>proxy-maint@gentoo.org<span class="nt"></email></span> + <span class="nt"><name></span>Proxy Maintainers<span class="nt"></name></span> + <span class="nt"></maintainer></span> + <span class="nt"><maintainer</span> <span class="na">type=</span><span class="s">"person"</span> <span class="na">proxied=</span><span class="s">"proxy"</span><span class="nt">></span> + <span class="nt"><email></span>polynomial-c@gentoo.org<span class="nt"></email></span> + <span class="nt"><name></span>Lars Wendler<span class="nt"></name></span> + <span class="nt"></maintainer></span> + <span class="nt"><upstream></span> + <span class="nt"><remote-id</span> <span class="na">type=</span><span class="s">"github"</span><span class="nt">></span>libratbag/libratbag<span class="nt"></remote-id></span> + <span class="nt"></upstream></span> +<span class="nt"></pkgmetadata></span> +</pre></div> +</code></pre></td></tr></table> +</div> <!-- class=content --> + </div> + </div> + </div> + </div> + + <footer> + <div class="container"> + <div class="row"> + <div class="col-12 offset-md-2 col-md-7"> + + </div> + <div class="col-12 col-md-3"> + <h3 class="footerhead">Questions or comments?</h3> + Please feel free to <a href="https://www.gentoo.org/inside-gentoo/contact/">contact us</a>. + </div> + </div> + <div class="row"> + <div class="col-2 col-sm-3 col-md-2"> + <ul class="footerlinks three-icons"> + <li><a href="https://twitter.com/gentoo" title="@Gentoo on Twitter"><span class="fa fa-twitter fa-fw"></span></a></li> + <li><a href="https://www.facebook.com/gentoo.org" title="Gentoo on Facebook"><span class="fa fa-facebook fa-fw"></span></a></li> + <li></li> + </ul> + </div> + <div class="col-10 col-sm-9 col-md-10"> + <strong>© 2001–2021 Gentoo Foundation, Inc.</strong><br> + <small> + Gentoo is a trademark of the Gentoo Foundation, Inc. + The contents of this document, unless otherwise expressly stated, are licensed under the + <a href="https://creativecommons.org/licenses/by-sa/4.0/" rel="license">CC-BY-SA-4.0</a> license. + The <a href="https://www.gentoo.org/inside-gentoo/foundation/name-logo-guidelines.html">Gentoo Name and Logo Usage Guidelines</a> apply. + </small> + </div> + </div> + </div> + </footer> + + <script src="https://assets.gentoo.org/tyrian/v2/jquery-3.3.slim.js"></script> + <script src="https://assets.gentoo.org/tyrian/v2/popper.min.js"></script> + <script src="https://assets.gentoo.org/tyrian/v2/bootstrap.min.js"></script> +</div> <!-- id=cgit --> +</body> +</html> diff --git a/dev-python/packaging/Manifest b/dev-python/packaging/Manifest new file mode 100644 index 0000000..19e78db --- /dev/null +++ b/dev-python/packaging/Manifest @@ -0,0 +1,3 @@ +DIST packaging-21.3.gh.tar.gz 80471 BLAKE2B a16ba1e74f0c868816131a7cb07b7aa0c14760cf3ad4c3d6737ac30ef99276c33b1f018d29e710f28e8d0cfb0e3e6b91e375d1d17e2b7ec6302164377cd503d0 SHA512 8960deacda26877b73d98a3b632e760e902a16ec7a04707f84044980e4d4fb33e4f584db115c9008066aa876079f28633bafe37fbd5ce9a23830b6b89eb4ae7a +EBUILD packaging-21.3-r1.ebuild 958 BLAKE2B 6b8cff1a9479ec3e2529489a4c56de56b84cae71e253babbb98f5a7e4cb800cc0d0aad784a706859215863e9f92eb9df8780f4506bcb179820e155e4fc0d3c58 SHA512 8be4774229bebe45ee6935e1365c2c9c9de8a6ab8a833980738fb324fa066456e0d84e197abfe1e820a63448dc82e2e5425d3fe3f49278e64bab87afa1a544d2 +MISC metadata.xml 391 BLAKE2B 0d73ed3809b26e3069048116ab247ceeb9e2932e0d8d6063b97cc1f0ed8359e73a54b22035fedb169524e502b6a07b8203e6c35d801f738bbed685d90e12bf96 SHA512 eb4d1ca476a45232547fdd961a4e6715dda24c7ab82e1f1995ac977b9825793d5d10a2ac408b1ee0b7c8b8444f2c42be33d6fb1012461f96db9a71477cca67ae diff --git a/dev-python/packaging/metadata.xml b/dev-python/packaging/metadata.xml new file mode 100644 index 0000000..229a32e --- /dev/null +++ b/dev-python/packaging/metadata.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <stabilize-allarches/> + <upstream> + <remote-id type="pypi">packaging</remote-id> + <remote-id type="github">pypa/packaging</remote-id> + </upstream> +</pkgmetadata> diff --git a/dev-python/packaging/packaging-21.3-r1.ebuild b/dev-python/packaging/packaging-21.3-r1.ebuild new file mode 100644 index 0000000..d39ba4b --- /dev/null +++ b/dev-python/packaging/packaging-21.3-r1.ebuild @@ -0,0 +1,37 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# please keep this ebuild at EAPI 7 -- sys-apps/portage dep +EAPI=7 + +PYTHON_COMPAT=( python3_{8..10} pypy3 ) +inherit distutils-r1 + +DESCRIPTION="Core utilities for Python packages" +HOMEPAGE=" + https://github.com/pypa/packaging/ + https://pypi.org/project/packaging/" +SRC_URI=" + https://github.com/pypa/packaging/archive/${PV}.tar.gz -> ${P}.gh.tar.gz" + +SLOT="0" +LICENSE="|| ( Apache-2.0 BSD-2 )" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + +RDEPEND=" + || ( + >=dev-python/pyparsing-3.0.6[${PYTHON_USEDEP}] + <dev-python/pyparsing-3.0.5[${PYTHON_USEDEP}] + ) +" +DEPEND=" + test? ( + dev-python/pretend[${PYTHON_USEDEP}] + ) +" + +distutils_enable_tests pytest + +python_test() { + epytest --capture=no +} diff --git a/dev-python/python-evdev/Manifest b/dev-python/python-evdev/Manifest new file mode 100644 index 0000000..c17a815 --- /dev/null +++ b/dev-python/python-evdev/Manifest @@ -0,0 +1,3 @@ +DIST python-evdev-1.4.0.tar.gz 86010 BLAKE2B 958d85f852e88a27fd22ec2511ba1367a69141f294d96f55d45fb5da176c539aef09a6c65d31be87581d0176571c7bd1ca84d580e920e460c3ca810d8efa45be SHA512 a98552bb1c5075c73ebb0a2a3a0fb241e061ed476d5342c8e8e23b3da86fa769a7d5d8027cfa243542d8b62efb89a9b1daf1c4768173295cd466714e4c53029d +EBUILD python-evdev-1.4.0.ebuild 758 BLAKE2B 0360e57adb922efd858e795a6d67397ca48d2ee265b733159ab1dd999f0f25e9231542a4015effc74c8683abb4f5a828d22e14e02bfb8c1db902e780d60a528f SHA512 4edf3a0f4900876c86d05cc6e5f158c8f4ab4aa3734f89484670c6a9fe5f81ce09282f3e73f71034d138153b746bcfd6827a538bafde06de576a84ac48b0dfb6 +MISC metadata.xml 236 BLAKE2B 3432dc60db586ece2a4503a7360be713bbd86c5fb6f0bbd88becdcbff3d3fc1ea0686e836da9ce965cc7f3934cbf0b098000efba470d85ed4dd27d43581ff656 SHA512 e4094b8bd3c78483b7a36697dd232f371a826cbf485900b3903d679f945659b8af64720786fd02a414052df6de2e2b0aa2bf7119a2a4b9e69ca70e8649acb809 diff --git a/dev-python/python-evdev/metadata.xml b/dev-python/python-evdev/metadata.xml new file mode 100644 index 0000000..685f012 --- /dev/null +++ b/dev-python/python-evdev/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!-- maintainer-needed --> + <upstream> + <remote-id type="pypi">evdev</remote-id> + </upstream> +</pkgmetadata> diff --git a/dev-python/python-evdev/python-evdev-1.4.0.ebuild b/dev-python/python-evdev/python-evdev-1.4.0.ebuild new file mode 100644 index 0000000..9dea3a6 --- /dev/null +++ b/dev-python/python-evdev/python-evdev-1.4.0.ebuild @@ -0,0 +1,30 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{7..10} ) + +inherit distutils-r1 + +DESCRIPTION="Python library for evdev bindings" +HOMEPAGE="https://python-evdev.readthedocs.io/" +SRC_URI="https://github.com/gvalkov/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="amd64 ~arm ~x86" + +distutils_enable_tests pytest + +python_compile() { + distutils-r1_python_compile build_ecodes \ + --evdev-headers \ + "${SYSROOT}/usr/include/linux/input.h:${SYSROOT}/usr/include/linux/input-event-codes.h" +} + +python_test() { + # test_uinput requires write access to /dev/uinput + pytest -vv --deselect tests/test_uinput.py || + die "tests failed for ${EPYTHON}" +} diff --git a/dev-python/setuptools/Manifest b/dev-python/setuptools/Manifest new file mode 100644 index 0000000..03a400b --- /dev/null +++ b/dev-python/setuptools/Manifest @@ -0,0 +1,4 @@ +DIST python-gentoo-patches-3.10.0_p1.tar.xz 10068 BLAKE2B 1c9817b449831559f0a0b722c02a5f55d94b3dfde98e5882c1403fe24a4addf7074ab39c09b91cff6fd7ace2e4b6e8ed899d9a0b9ffd6612ce315c4c192bd309 SHA512 39aa41dbf17b6dc5255491c75031a3dae6962b44125e426dbfdce365a6533c5dae9856b1fff8016a189124b7cff72d2665ce99da344c2f9dff005ba685e8c2c4 +DIST setuptools-59.8.0.tar.gz 2282358 BLAKE2B 2f1b49285fc70420e24f958c4955200ef0407a7f3aa52fd581a165fd47c7bbde8366c26963f1bbb36f0f77797c12cbb9016fdc69e1a5cc696bb67aacca16d140 SHA512 d906558b498bda8abf28831224502c6f0290a4cdbf087fe07af8321dba3dfd1e19fa5b4a820033e54c4561b82ea8ec54c287b4fd657892ed28c2a7de91a9107e +EBUILD setuptools-59.8.0.ebuild 2933 BLAKE2B d5f4b008152d6a1324ea2a63da229f71fda4f6e20f1d7790f69257e9945ad98c02d765dc5c4e76fe44b476eeb19df6b21f582c684ab13e7b6452e280babfa0fb SHA512 e627a7c69f998d01dcd24c446efddf1af40e97065b13df3398e1c6e8c320f42cf1d5b04d2e84325f32298e0c91c8d789def20d4e947d6aca6e66ddda8058d14e +MISC metadata.xml 469 BLAKE2B 4a26769b09a3785586b22db850b7fc5c4818f31c3ace9cc94476d35df05e50edf6721f3c95ec615c3b2efe071ef284a54ea2d53566316ba653f7830bb48f80bf SHA512 dd682c4ad2e59a97094ebdabe4d1063e2319ed05e1fe9d8c2fafe069badb3b4cf8bb6d9f50e09d2128e2a081c1c69827407ac8aed644ebf70eb4ca1bc9a57319 diff --git a/dev-python/setuptools/metadata.xml b/dev-python/setuptools/metadata.xml new file mode 100644 index 0000000..46eeb10 --- /dev/null +++ b/dev-python/setuptools/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <stabilize-allarches/> + <upstream> + <remote-id type="pypi">setuptools</remote-id> + <remote-id type="github">pypa/setuptools</remote-id> + <remote-id type="cpe">cpe:/a:python:setuptools</remote-id> + </upstream> +</pkgmetadata> diff --git a/dev-python/setuptools/setuptools-59.8.0.ebuild b/dev-python/setuptools/setuptools-59.8.0.ebuild new file mode 100644 index 0000000..30b1a68 --- /dev/null +++ b/dev-python/setuptools/setuptools-59.8.0.ebuild @@ -0,0 +1,87 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# please keep this ebuild at EAPI 7 -- sys-apps/portage dep +EAPI=7 + +# Set to 'manual' to avoid triggering install QA check +DISTUTILS_USE_SETUPTOOLS=manual +PYTHON_COMPAT=( python3_{8..10} pypy3 ) +PYTHON_REQ_USE="xml(+)" + +inherit distutils-r1 multiprocessing + +CPY_PATCHSET="python-gentoo-patches-3.10.0_p1" +DESCRIPTION="Collection of extensions to Distutils" +HOMEPAGE="https://github.com/pypa/setuptools https://pypi.org/project/setuptools/" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz + https://dev.gentoo.org/~floppym/python/${CPY_PATCHSET}.tar.xz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="test" +RESTRICT="!test? ( test )" + +BDEPEND=" + test? ( + $(python_gen_cond_dep ' + dev-python/jaraco-envs[${PYTHON_USEDEP}] + >=dev-python/jaraco-path-3.2.0[${PYTHON_USEDEP}] + dev-python/mock[${PYTHON_USEDEP}] + dev-python/pip[${PYTHON_USEDEP}] + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/pytest[${PYTHON_USEDEP}] + dev-python/pytest-fixture-config[${PYTHON_USEDEP}] + dev-python/pytest-virtualenv[${PYTHON_USEDEP}] + dev-python/pytest-xdist[${PYTHON_USEDEP}] + >=dev-python/virtualenv-20[${PYTHON_USEDEP}] + dev-python/wheel[${PYTHON_USEDEP}] + ' python3_{8..10} pypy3) + ) +" +PDEPEND=" + >=dev-python/certifi-2016.9.26[${PYTHON_USEDEP}] + dev-python/setuptools_scm[${PYTHON_USEDEP}]" + +# Force in-source build because build system modifies sources. +DISTUTILS_IN_SOURCE_BUILD=1 + +DOCS=( {CHANGES,README}.rst ) + +src_prepare() { + # apply distutils patches to the bundled distutils + pushd setuptools/_distutils >/dev/null || die + # TODO: distutils C++ patch? + eapply -p3 "${WORKDIR}/${CPY_PATCHSET}/0006-distutils-make-OO-enable-both-opt-1-and-opt-2-optimi.patch" + popd >/dev/null || die + + distutils-r1_src_prepare +} + +python_test() { + # keep in sync with python_gen_cond_dep above! + has "${EPYTHON}" python3.{8..10} pypy3 || continue + + distutils_install_for_testing + local EPYTEST_DESELECT=( + # network + setuptools/tests/test_distutils_adoption.py + 'setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[None]' + # unhappy with pytest-xdist? + setuptools/tests/test_easy_install.py::TestUserInstallTest::test_local_index + # TODO + setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_allow_hosts + setuptools/tests/test_test.py::test_tests_are_run_once + ) + + # test_easy_install raises a SandboxViolation due to ${HOME}/.pydistutils.cfg + # It tries to sandbox the test in a tempdir + HOME="${PWD}" epytest \ + -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")" setuptools +} + +python_install() { + export DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT=1 + distutils-r1_python_install +} diff --git a/dev-util/vulkan-headers/Manifest b/dev-util/vulkan-headers/Manifest new file mode 100644 index 0000000..292f3c2 --- /dev/null +++ b/dev-util/vulkan-headers/Manifest @@ -0,0 +1,2 @@ +DIST vulkan-headers-1.2.198.0.tar.gz 1288092 BLAKE2B 27e776fa9b7491db8056527d4095274dfa4f1d822a436673bfd06cfd4b8aa912bf85de8d044c7d1c421db589f752c25632267de465cff8672371b3fd6d43ee90 SHA512 f9bff10ec0c2030c5ddc6b350154eb7cfc2eccb5f09f61b311557e480735355be2892e592b76b42760947cb87d154a2334069c89c0d89439c284e68cd72cc9ce +EBUILD vulkan-headers-1.2.198.0.ebuild 628 BLAKE2B bf5b298046662977242d3db22de10213bc559f55cd23b2232d5be302d1eeb2147f835e2ee2179881083f554831eaeccd91e5b3c37dabd938d133f90a2dec7504 SHA512 04c5352edc4cfca3438c6f1359f61ca188a478416bbc3d93e3efc2dccf50cd2e58909e5235483ada5423e65da21d86894d81b58795fef0dba65269eff9b64253 diff --git a/dev-util/vulkan-headers/vulkan-headers-1.2.198.0.ebuild b/dev-util/vulkan-headers/vulkan-headers-1.2.198.0.ebuild new file mode 100644 index 0000000..1a47e3d --- /dev/null +++ b/dev-util/vulkan-headers/vulkan-headers-1.2.198.0.ebuild @@ -0,0 +1,24 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +MY_PN=Vulkan-Headers +inherit cmake + +if [[ ${PV} == *9999* ]]; then + EGIT_REPO_URI="https://github.com/KhronosGroup/${MY_PN}.git" + inherit git-r3 +else + SRC_URI="https://github.com/KhronosGroup/${MY_PN}/archive/sdk-${PV}.0.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" + S="${WORKDIR}"/${MY_PN}-sdk-${PV}.0 +fi + +DESCRIPTION="Vulkan Header files and API registry" +HOMEPAGE="https://github.com/KhronosGroup/Vulkan-Headers" + +LICENSE="Apache-2.0" +SLOT="0" + +BDEPEND=">=dev-util/cmake-3.10.2" diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass new file mode 100644 index 0000000..95c92cc --- /dev/null +++ b/eclass/autotools.eclass @@ -0,0 +1,678 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: autotools.eclass +# @MAINTAINER: +# base-system@gentoo.org +# @SUPPORTED_EAPIS: 5 6 7 8 +# @BLURB: Regenerates auto* build scripts +# @DESCRIPTION: +# This eclass is for safely handling autotooled software packages that need to +# regenerate their build scripts. All functions will abort in case of errors. + +# Note: We require GNU m4, as does autoconf. So feel free to use any features +# from the GNU version of m4 without worrying about other variants (i.e. BSD). + +if [[ ${__AUTOTOOLS_AUTO_DEPEND+set} == "set" ]] ; then + # See if we were included already, but someone changed the value + # of AUTOTOOLS_AUTO_DEPEND on us. We could reload the entire + # eclass at that point, but that adds overhead, and it's trivial + # to re-order inherit in eclasses/ebuilds instead. #409611 + if [[ ${__AUTOTOOLS_AUTO_DEPEND} != ${AUTOTOOLS_AUTO_DEPEND} ]] ; then + die "AUTOTOOLS_AUTO_DEPEND changed value between inherits; please inherit ${ECLASS} first! ${__AUTOTOOLS_AUTO_DEPEND} -> ${AUTOTOOLS_AUTO_DEPEND}" + fi +fi + +if [[ -z ${_AUTOTOOLS_ECLASS} ]] ; then +_AUTOTOOLS_ECLASS=1 + +case ${EAPI} in + 5|6) + # Needed for eqawarn + inherit eutils + ;; + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI} not supported" ;; +esac + +inherit gnuconfig libtool + +# @ECLASS-VARIABLE: WANT_AUTOCONF +# @PRE_INHERIT +# @DESCRIPTION: +# The major version of autoconf your package needs +: ${WANT_AUTOCONF:=latest} + +# @ECLASS-VARIABLE: WANT_AUTOMAKE +# @PRE_INHERIT +# @DESCRIPTION: +# The major version of automake your package needs +: ${WANT_AUTOMAKE:=latest} + +# @ECLASS-VARIABLE: WANT_LIBTOOL +# @PRE_INHERIT +# @DESCRIPTION: +# Do you want libtool? Valid values here are "latest" and "none". +: ${WANT_LIBTOOL:=latest} + +# @ECLASS-VARIABLE: _LATEST_AUTOMAKE +# @INTERNAL +# @DESCRIPTION: +# CONSTANT! +# The latest major unstable and stable version/slot of automake available +# on each arch. +# Only add unstable version if it is in a different slot than latest stable +# version. +# List latest unstable version first to boost testing adoption rate because +# most package manager dependency resolver will pick the first suitable +# version. +# If a newer slot is stable on any arch, and is NOT reflected in this list, +# then circular dependencies may arise during emerge @system bootstraps. +# +# See bug #312315 and bug #465732 for further information and context. +# +# Do NOT change this variable in your ebuilds! +# If you want to force a newer minor version, you can specify the correct +# WANT value by using a colon: <PV>:<WANT_AUTOMAKE> +_LATEST_AUTOMAKE=( 1.16.2-r1:1.16 ) + +_automake_atom="sys-devel/automake" +_autoconf_atom="sys-devel/autoconf" +if [[ -n ${WANT_AUTOMAKE} ]] ; then + case ${WANT_AUTOMAKE} in + # Even if the package doesn't use automake, we still need to depend + # on it because we run aclocal to process m4 macros. This matches + # the autoreconf tool, so this requirement is correct, bug #401605. + none) ;; + latest) _automake_atom="|| ( `printf '>=sys-devel/automake-%s:%s ' ${_LATEST_AUTOMAKE[@]/:/ }` )" ;; + *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*";; + esac + export WANT_AUTOMAKE +fi + +if [[ -n ${WANT_AUTOCONF} ]] ; then + case ${WANT_AUTOCONF} in + none) _autoconf_atom="" ;; # some packages don't require autoconf at all + 2.1) _autoconf_atom="~sys-devel/autoconf-2.13" ;; + # if you change the "latest" version here, change also autotools_env_setup + latest|2.5) _autoconf_atom=">=sys-devel/autoconf-2.69" ;; + *) die "Invalid WANT_AUTOCONF value '${WANT_AUTOCONF}'" ;; + esac + export WANT_AUTOCONF +fi + +_libtool_atom=">=sys-devel/libtool-2.4" +if [[ -n ${WANT_LIBTOOL} ]] ; then + case ${WANT_LIBTOOL} in + none) _libtool_atom="" ;; + latest) ;; + *) die "Invalid WANT_LIBTOOL value '${WANT_LIBTOOL}'" ;; + esac + export WANT_LIBTOOL +fi + +# @ECLASS-VARIABLE: AUTOTOOLS_DEPEND +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# Contains the combination of requested automake/autoconf/libtool +# versions in *DEPEND format. +AUTOTOOLS_DEPEND="${_automake_atom} + ${_autoconf_atom} + ${_libtool_atom}" +RDEPEND="" + +# @ECLASS-VARIABLE: AUTOTOOLS_AUTO_DEPEND +# @PRE_INHERIT +# @DESCRIPTION: +# Set to 'no' to disable automatically adding to DEPEND. This lets +# ebuilds form conditional depends by using ${AUTOTOOLS_DEPEND} in +# their own DEPEND string. +: ${AUTOTOOLS_AUTO_DEPEND:=yes} +if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then + case ${EAPI} in + 5|6) DEPEND=${AUTOTOOLS_DEPEND} ;; + *) BDEPEND=${AUTOTOOLS_DEPEND} ;; + esac +fi +__AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass + +unset _automake_atom _autoconf_atom + +# @ECLASS-VARIABLE: AM_OPTS +# @DEFAULT_UNSET +# @DESCRIPTION: +# Additional options to pass to automake during +# eautoreconf call. +: ${AM_OPTS:=} + +# @ECLASS-VARIABLE: AT_NOEAUTOHEADER +# @DEFAULT_UNSET +# @DESCRIPTION: +# Don't run eautoheader command if set to 'yes'; only used to work around +# packages that don't want their headers being modified. +: ${AT_NOEAUTOHEADER:=} + +# @ECLASS-VARIABLE: AT_NOEAUTOMAKE +# @DEFAULT_UNSET +# @DESCRIPTION: +# Don't run eautomake command if set to 'yes'; only used to workaround +# broken packages. Generally you should, instead, fix the package to +# not call AM_INIT_AUTOMAKE if it doesn't actually use automake. +: ${AT_NOEAUTOMAKE:=} + +# @ECLASS-VARIABLE: AT_NOELIBTOOLIZE +# @DEFAULT_UNSET +# @DESCRIPTION: +# Don't run elibtoolize command if set to 'yes', +# useful when elibtoolize needs to be ran with +# particular options +: ${AT_NOELIBTOOLIZE:=} + +# @ECLASS-VARIABLE: AT_M4DIR +# @DEFAULT_UNSET +# @DESCRIPTION: +# Additional director(y|ies) aclocal should search +: ${AT_M4DIR:=} + +# @ECLASS-VARIABLE: AT_SYS_M4DIR +# @DEFAULT_UNSET +# @INTERNAL +# @DESCRIPTION: +# For system integrators, a list of additional aclocal search paths. +# This variable gets eval-ed, so you can use variables in the definition +# that may not be valid until eautoreconf & friends are run. +: ${AT_SYS_M4DIR:=} + +# @FUNCTION: eautoreconf +# @DESCRIPTION: +# This function mimes the behavior of autoreconf, but uses the different +# eauto* functions to run the tools. It doesn't accept parameters, but +# the directory with include files can be specified with AT_M4DIR variable. +# +# Should do a full autoreconf - normally what most people will be interested in. +# Also should handle additional directories specified by AC_CONFIG_SUBDIRS. +eautoreconf() { + local x g + + # Subdirs often share a common build dir, bug #529404. If so, we can't safely + # run in parallel because many tools clobber the content in there. Libtool + # and automake both `rm && cp` while aclocal reads the output. We might be + # able to handle this if we split the steps and grab locks on the dirs the + # tools actually write to. Then we'd run all the common tools that use + # those inputs. Doing this in bash does not scale easily. + # If we do re-enable parallel support, make sure bug #426512 is handled. + if [[ -z ${AT_NO_RECURSIVE} ]] ; then + # Take care of subdirs + for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS) ; do + if [[ -d ${x} ]] ; then + pushd "${x}" >/dev/null + # Avoid unsafe nested multijob_finish_one for bug #426512. + AT_NOELIBTOOLIZE="yes" eautoreconf || die + popd >/dev/null + fi + done + fi + + einfo "Running eautoreconf in '${PWD}' ..." + + local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR) + [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs} + + # Run all the tools before aclocal so we can gather the .m4 files. + local i tools=( + # <tool> <was run> <command> + glibgettext false "autotools_run_tool glib-gettextize --copy --force" + gettext false "autotools_run_tool --at-missing autopoint --force" + # intltool must come after autopoint. + intltool false "autotools_run_tool intltoolize --automake --copy --force" + gtkdoc false "autotools_run_tool --at-missing gtkdocize --copy" + gnomedoc false "autotools_run_tool --at-missing gnome-doc-prepare --copy --force" + libtool false "_elibtoolize --auto-ltdl --install --copy --force" + ) + for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do + if _at_uses_${tools[i]} ; then + tools[i+1]=true + ${tools[i+2]} + fi + done + + # Generate aclocal.m4 with our up-to-date m4 files. + local rerun_aclocal=false + eaclocal + + # Check to see if we had macros expanded by other macros or in other + # m4 files that we couldn't detect early. This is uncommon, but some + # packages do this, so we have to handle it correctly. + for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do + if ! ${tools[i+1]} && _at_uses_${tools[i]} ; then + ${tools[i+2]} + rerun_aclocal=true + fi + done + ${rerun_aclocal} && eaclocal + + if [[ ${WANT_AUTOCONF} == "2.1" ]] ; then + eautoconf + else + eautoconf --force + fi + [[ ${AT_NOEAUTOHEADER} != "yes" ]] && eautoheader + [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} + + if [[ ${AT_NOELIBTOOLIZE} != "yes" ]] ; then + # Call it here to prevent failures due to elibtoolize called _before_ + # eautoreconf. + elibtoolize --force "${PWD}" + fi + + return 0 +} + +# @FUNCTION: _at_uses_pkg +# @USAGE: <macros> +# @INTERNAL +# @DESCRIPTION: +# See if the specified macros are enabled. +_at_uses_pkg() { + if [[ -n $(autotools_check_macro "$@") ]] ; then + return 0 + else + # If the trace didn't find it (perhaps because aclocal.m4 hasn't + # been generated yet), cheat, but be conservative. + local macro args=() + for macro ; do + args+=( -e "^[[:space:]]*${macro}\>" ) + done + egrep -q "${args[@]}" configure.?? + fi +} +_at_uses_autoheader() { _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}; } +_at_uses_automake() { _at_uses_pkg AM_INIT_AUTOMAKE; } +_at_uses_gettext() { _at_uses_pkg AM_GNU_GETTEXT_{,REQUIRE_}VERSION; } +_at_uses_glibgettext() { _at_uses_pkg AM_GLIB_GNU_GETTEXT; } +_at_uses_intltool() { _at_uses_pkg {AC,IT}_PROG_INTLTOOL; } +_at_uses_gtkdoc() { _at_uses_pkg GTK_DOC_CHECK; } +_at_uses_gnomedoc() { _at_uses_pkg GNOME_DOC_INIT; } +_at_uses_libtool() { _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT; } +_at_uses_libltdl() { _at_uses_pkg LT_CONFIG_LTDL_DIR; } + +# @FUNCTION: eaclocal_amflags +# @DESCRIPTION: +# Extract the ACLOCAL_AMFLAGS value from the Makefile.am and try to handle +# (most) of the crazy crap that people throw at us. +eaclocal_amflags() { + local aclocal_opts amflags_file + + for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in ; do + [[ -e ${amflags_file} ]] || continue + # setup the env in case the pkg does something crazy + # in their ACLOCAL_AMFLAGS. like run a shell script + # which turns around and runs autotools (bug #365401) + # or split across multiple lines (bug #383525) + autotools_env_setup + aclocal_opts=$(sed -n \ + "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ \ + # match the first line + s:[^=]*=::p; \ + # then gobble up all escaped lines + : nextline /\\\\$/{ n; p; b nextline; } \ + }" ${amflags_file}) + eval aclocal_opts=\""${aclocal_opts}"\" + break + done + + echo ${aclocal_opts} +} + +# @FUNCTION: eaclocal +# @DESCRIPTION: +# These functions runs the autotools using autotools_run_tool with the +# specified parametes. The name of the tool run is the same of the function +# without e prefix. +# They also force installing the support files for safety. +# Respects AT_M4DIR for additional directories to search for macros. +eaclocal() { + [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ + autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags) +} + +# @FUNCTION: _elibtoolize +# @DESCRIPTION: +# Runs libtoolize. +# +# Note the '_' prefix: avoid collision with elibtoolize() from libtool.eclass. +_elibtoolize() { + local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)} + + if [[ ${1} == "--auto-ltdl" ]] ; then + shift + _at_uses_libltdl && set -- "$@" --ltdl + fi + + [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake + + autotools_run_tool ${LIBTOOLIZE} "$@" +} + +# @FUNCTION: eautoheader +# @DESCRIPTION: +# Runs autoheader. +eautoheader() { + _at_uses_autoheader || return 0 + autotools_run_tool --at-no-fail --at-m4flags autoheader "$@" +} + +# @FUNCTION: eautoconf +# @DESCRIPTION: +# Runs autoconf. +eautoconf() { + if [[ ! -f configure.ac && ! -f configure.in ]] ; then + echo + eerror "No configure.{ac,in} present in '${PWD}'!" + echo + die "No configure.{ac,in} present!" + fi + + + if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]] ; then + case ${EAPI:-0} in + 0|1|2|3|4|5|6|7) + eqawarn "This package has a configure.in file which has long been deprecated. Please" + eqawarn "update it to use configure.ac instead as newer versions of autotools will die" + eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details." + ;; + *) + # Move configure file to the new location only on newer EAPIs to ensure + # checks are done rather than retroactively breaking ebuilds. + eqawarn "Moving configure.in to configure.ac (bug #426262)" + mv configure.{in,ac} || die + ;; + esac + fi + + # Install config.guess and config.sub which are required by many macros + # in autoconf >=2.70. + local _gnuconfig=$(gnuconfig_findnewest) + cp "${_gnuconfig}"/config.{guess,sub} . || die + + autotools_run_tool --at-m4flags autoconf "$@" +} + +# @FUNCTION: eautomake +# @DESCRIPTION: +# Runs automake. +eautomake() { + local extra_opts=() + local makefile_name + + # Run automake if: + # - a Makefile.am type file exists + # - the configure script is using the AM_INIT_AUTOMAKE directive + for makefile_name in {GNUmakefile,{M,m}akefile}.am "" ; do + [[ -f ${makefile_name} ]] && break + done + + _automake_version() { + autotools_run_tool --at-output automake --version 2>/dev/null | + sed -n -e '1{s:.*(GNU automake) ::p;q}' + } + + if [[ -z ${makefile_name} ]] ; then + _at_uses_automake || return 0 + + elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]] ; then + local used_automake + local installed_automake + + installed_automake=$(WANT_AUTOMAKE= _automake_version) + used_automake=$(head -n 1 < ${makefile_name%.am}.in | \ + sed -e 's:.*by automake \(.*\) from .*:\1:') + + if [[ ${installed_automake} != ${used_automake} ]] ; then + ewarn "Automake used for the package (${used_automake}) differs from" \ + "the installed version (${installed_automake})." + ewarn "Forcing a full rebuild of the autotools to workaround." + eautoreconf + return 0 + fi + fi + + [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] \ + || extra_opts+=( --foreign ) + + # Older versions of automake do not support --force-missing. But we want + # to use this whenever possible to update random bundled files, bug #133489. + case $(_automake_version) in + 1.4|1.4[.-]*) ;; + *) extra_opts+=( --force-missing ) ;; + esac + + autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@" +} + +# @FUNCTION: eautopoint +# @DESCRIPTION: +# Runs autopoint (from the gettext package). +eautopoint() { + autotools_run_tool autopoint "$@" +} + +# @FUNCTION: config_rpath_update +# @USAGE: [destination] +# @DESCRIPTION: +# Some packages utilize the config.rpath helper script, but don't +# use gettext directly. So we have to copy it in manually since +# we can't let `autopoint` do it for us. +config_rpath_update() { + local dst src + + case ${EAPI} in + 5|6) + src="${EPREFIX}/usr/share/gettext/config.rpath" + ;; + *) + src="${BROOT}/usr/share/gettext/config.rpath" + ;; + esac + + [[ $# -eq 0 ]] && set -- $(find -name config.rpath) + [[ $# -eq 0 ]] && return 0 + + einfo "Updating all config.rpath files" + for dst in "$@" ; do + einfo " ${dst}" + cp "${src}" "${dst}" || die + done +} + +# @FUNCTION: autotools_env_setup +# @INTERNAL +# @DESCRIPTION: +# Process the WANT_AUTO{CONF,MAKE} flags. +autotools_env_setup() { + # We do the "latest" → version switch here because it solves + # possible order problems, see bug #270010 as an example. + if [[ ${WANT_AUTOMAKE} == "latest" ]] ; then + local pv + for pv in ${_LATEST_AUTOMAKE[@]/#*:} ; do + # Break on first hit to respect _LATEST_AUTOMAKE order. + local hv_args="" + case ${EAPI} in + 5|6) + hv_args="--host-root" + ;; + 7) + hv_args="-b" + ;; + esac + ROOT=/ has_version ${hv_args} "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}" && break + done + [[ ${WANT_AUTOMAKE} == "latest" ]] && \ + die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}" + fi + [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5 +} + +# @FUNCTION: autotools_run_tool +# @USAGE: [--at-no-fail] [--at-m4flags] [--at-missing] [--at-output] <autotool> [tool-specific flags] +# @INTERNAL +# @DESCRIPTION: +# Run the specified autotool helper, but do logging and error checking +# around it in the process. +autotools_run_tool() { + # Process our own internal flags first + local autofail=true m4flags=false missing_ok=false return_output=false + while [[ -n ${1} ]] ; do + case ${1} in + --at-no-fail) autofail=false ;; + --at-m4flags) m4flags=true ;; + --at-missing) missing_ok=true ;; + --at-output) return_output=true ;; + # whatever is left goes to the actual tool + *) break ;; + esac + shift + done + + if [[ ${EBUILD_PHASE_FUNC} != "src_unpack" && ${EBUILD_PHASE_FUNC} != "src_prepare" ]] ; then + eqawarn "Running '${1}' in ${EBUILD_PHASE_FUNC} phase" + fi + + if ${missing_ok} && ! type -P ${1} >/dev/null ; then + einfo "Skipping '$*' because '${1}' not installed" + return 0 + fi + + autotools_env_setup + + # Allow people to pass in full paths, bug #549268 + local STDERR_TARGET="${T}/${1##*/}.out" + # most of the time, there will only be one run, but if there are + # more, make sure we get unique log filenames + if [[ -e ${STDERR_TARGET} ]] ; then + local i=1 + while :; do + STDERR_TARGET="${T}/${1##*/}-${i}.out" + [[ -e ${STDERR_TARGET} ]] || break + : $(( i++ )) + done + fi + + if ${m4flags} ; then + set -- "${1}" $(autotools_m4dir_include) $(autotools_m4sysdir_include) "${@:2}" + fi + + # If the caller wants to probe something, then let them do it directly. + if ${return_output} ; then + "$@" + return + fi + + printf "***** ${1} *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}" + + ebegin "Running '$@'" + "$@" >> "${STDERR_TARGET}" 2>&1 + if ! eend $? && ${autofail} ; then + echo + eerror "Failed running '${1}'!" + eerror + eerror "Include in your bug report the contents of:" + eerror + eerror " ${STDERR_TARGET}" + echo + die "Failed running '${1}'!" + fi +} + +# Internal function to check for support + +# Keep a list of all the macros we might use so that we only +# have to run the trace code once. Order doesn't matter. +ALL_AUTOTOOLS_MACROS=( + A{C,M}_PROG_LIBTOOL LT_INIT LT_CONFIG_LTDL_DIR + A{C,M}_CONFIG_HEADER{S,} + AC_CONFIG_SUBDIRS + AC_CONFIG_AUX_DIR AC_CONFIG_MACRO_DIR + AM_INIT_AUTOMAKE + AM_GLIB_GNU_GETTEXT + AM_GNU_GETTEXT_{,REQUIRE_}VERSION + {AC,IT}_PROG_INTLTOOL + GTK_DOC_CHECK + GNOME_DOC_INIT +) +autotools_check_macro() { + [[ -f configure.ac || -f configure.in ]] || return 0 + + # We can run in multiple dirs, so we have to cache the trace + # data in $PWD rather than an env var. + local trace_file=".__autoconf_trace_data" + if [[ ! -e ${trace_file} ]] || [[ ! aclocal.m4 -ot ${trace_file} ]] ; then + WANT_AUTOCONF="2.5" autoconf \ + $(autotools_m4dir_include) \ + ${ALL_AUTOTOOLS_MACROS[@]/#/--trace=} > ${trace_file} 2>/dev/null + fi + + local macro args=() + for macro ; do + has ${macro} ${ALL_AUTOTOOLS_MACROS[@]} || die "internal error: add ${macro} to ALL_AUTOTOOLS_MACROS" + args+=( -e ":${macro}:" ) + done + grep "${args[@]}" ${trace_file} +} + +# @FUNCTION: autotools_check_macro_val +# @USAGE: <macro> [macros] +# @INTERNAL +# @DESCRIPTION: +# Look for a macro and extract its value. +autotools_check_macro_val() { + local macro scan_out + + for macro ; do + autotools_check_macro "${macro}" | \ + gawk -v macro="${macro}" \ + '($0 !~ /^[[:space:]]*(#|dnl)/) { + if (match($0, macro ":(.*)$", res)) + print res[1] + }' | uniq + done + + return 0 +} + +_autotools_m4dir_include() { + local x include_opts flag + + # Use the right flag to autoconf based on the version #448986 + [[ ${WANT_AUTOCONF} == "2.1" ]] \ + && flag="l" \ + || flag="I" + + for x in "$@" ; do + case ${x} in + # We handle it below + -${flag}) ;; + *) + [[ ! -d ${x} ]] && ewarn "${ECLASS}: '${x}' does not exist" + include_opts+=" -${flag} ${x}" + ;; + esac + done + + echo ${include_opts} +} +autotools_m4dir_include() { _autotools_m4dir_include ${AT_M4DIR} ; } +autotools_m4sysdir_include() { + # First try to use the paths the system integrator has set up. + local paths=( $(eval echo ${AT_SYS_M4DIR}) ) + + if [[ ${#paths[@]} -eq 0 && -n ${SYSROOT} ]] ; then + # If they didn't give us anything, then default to the SYSROOT. + # This helps when cross-compiling. + local path="${SYSROOT}/usr/share/aclocal" + [[ -d ${path} ]] && paths+=( "${path}" ) + fi + _autotools_m4dir_include "${paths[@]}" +} + +fi diff --git a/eclass/eapi8-dosym.eclass b/eclass/eapi8-dosym.eclass new file mode 100644 index 0000000..52f0ffe --- /dev/null +++ b/eclass/eapi8-dosym.eclass @@ -0,0 +1,108 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: eapi8-dosym.eclass +# @MAINTAINER: +# PMS team <pms@gentoo.org> +# @AUTHOR: +# Ulrich Müller <ulm@gentoo.org> +# @SUPPORTED_EAPIS: 5 6 7 +# @BLURB: Testing implementation of EAPI 8 dosym -r option +# @DESCRIPTION: +# A stand-alone implementation of the dosym command aimed for EAPI 8. +# Intended to be used for wider testing of the proposed option and to +# allow ebuilds to switch to the new model early, with minimal change +# needed for actual EAPI 8. +# +# https://bugs.gentoo.org/708360 + +case ${EAPI} in + 5|6|7) ;; + *) die "${ECLASS}: EAPI=${EAPI:-0} not supported" ;; +esac + +# @FUNCTION: _dosym8_canonicalize +# @USAGE: <path> +# @INTERNAL +# @DESCRIPTION: +# Transparent bash-only replacement for GNU "realpath -m -s". +# Resolve references to "/./", "/../" and remove extra "/" characters +# from <path>, without touching any actual file. +_dosym8_canonicalize() { + local path slash i prev out IFS=/ + + path=( $1 ) + [[ $1 == /* ]] && slash=/ + + while true; do + # Find first instance of non-".." path component followed by "..", + # or as a special case, "/.." at the beginning of the path. + # Also drop empty and "." path components as we go along. + prev= + for i in ${!path[@]}; do + if [[ -z ${path[i]} || ${path[i]} == . ]]; then + unset "path[i]" + elif [[ ${path[i]} != .. ]]; then + prev=${i} + elif [[ ${prev} || ${slash} ]]; then + # Found, remove path components and reiterate + [[ ${prev} ]] && unset "path[prev]" + unset "path[i]" + continue 2 + fi + done + # No (further) instance found, so we're done + break + done + + out="${slash}${path[*]}" + echo "${out:-.}" +} + +# @FUNCTION: dosym8 +# @USAGE: [-r] <target> <link> +# @DESCRIPTION: +# Create a symbolic link <link>, pointing to <target>. If the +# directory containing the new link does not exist, create it. +# +# If called with option -r, expand <target> relative to the apparent +# path of the directory containing <link>. For example, "dosym8 -r +# /bin/foo /usr/bin/foo" will create a link named "../../bin/foo". +dosym8() { + local option_r + + case $1 in + -r) option_r=t; shift ;; + esac + + [[ $# -eq 2 ]] || die "${FUNCNAME}: bad number of arguments" + + local target=$1 link=$2 + + if [[ ${option_r} ]]; then + local linkdir comp + + # Expansion makes sense only for an absolute target path + [[ ${target} == /* ]] \ + || die "${FUNCNAME}: -r specified but no absolute target path" + + target=$(_dosym8_canonicalize "${target}") + linkdir=$(_dosym8_canonicalize "/${link#/}") + linkdir=${linkdir%/*} # poor man's dirname(1) + linkdir=${linkdir:-/} # always keep the initial "/" + + local ifs_save=${IFS-$' \t\n'} IFS=/ + for comp in ${linkdir}; do + if [[ ${target%%/*} == "${comp}" ]]; then + target=${target#"${comp}"} + target=${target#/} + else + target=..${target:+/}${target} + fi + done + IFS=${ifs_save} + target=${target:-.} + fi + + dosym "${target}" "${link}" +} diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass new file mode 100644 index 0000000..32119cb --- /dev/null +++ b/eclass/flag-o-matic.eclass @@ -0,0 +1,851 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: flag-o-matic.eclass +# @MAINTAINER: +# toolchain@gentoo.org +# @SUPPORTED_EAPIS: 5 6 7 8 +# @BLURB: common functions to manipulate and query toolchain flags +# @DESCRIPTION: +# This eclass contains a suite of functions to help developers sanely +# and safely manage toolchain flags in their builds. + +case ${EAPI:-0} in + 0|1|2|3|4) die "flag-o-matic.eclass: EAPI ${EAPI} is too old." ;; + 5|6|7|8) ;; + *) die "EAPI ${EAPI} is not supported by flag-o-matic.eclass." ;; +esac + +if [[ -z ${_FLAG_O_MATIC_ECLASS} ]]; then +_FLAG_O_MATIC_ECLASS=1 + +inherit toolchain-funcs + +[[ ${EAPI} == [567] ]] && inherit eutils + +# @FUNCTION: all-flag-vars +# @DESCRIPTION: +# Return all the flag variables that our high level funcs operate on. +all-flag-vars() { + echo {ADA,C,CPP,CXX,CCAS,F,FC,LD}FLAGS +} + +# @FUNCTION: setup-allowed-flags +# @INTERNAL +# @DESCRIPTION: +# {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags +# Note: shell globs and character lists are allowed +setup-allowed-flags() { + [[ ${EAPI} == [567] ]] || + die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." + _setup-allowed-flags "$@" +} + +# @FUNCTION: _setup-allowed-flags +# @INTERNAL +# @DESCRIPTION: +# {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags +# Note: shell globs and character lists are allowed +_setup-allowed-flags() { + ALLOWED_FLAGS=( + -pipe -O '-O[12sg]' -mcpu -march -mtune + '-fstack-protector*' + '-fsanitize*' '-fno-sanitize*' + '-fstack-check*' -fno-stack-check + -fbounds-check -fbounds-checking -fno-strict-overflow + -fno-PIE -fno-pie -nopie -no-pie -fno-unit-at-a-time + + # debugging symbols should generally be very safe to add + -g '-g[0-9]' + -ggdb '-ggdb[0-9]' + -gdwarf '-gdwarf-*' + -gstabs -gstabs+ + -gz + + -fno-ident -fpermissive -frecord-gcc-switches + '-fdiagnostics*' '-fplugin*' + '-W*' -w + + # CPPFLAGS and LDFLAGS + '-[DUILR]*' '-Wl,*' + + # Linker choice flag + '-fuse-ld' + ) + + # allow a bunch of flags that negate features / control ABI + ALLOWED_FLAGS+=( + '-fno-stack-protector*' '-fabi-version=*' + -fno-strict-aliasing -fno-bounds-check -fno-bounds-checking -fstrict-overflow + -fno-omit-frame-pointer '-fno-builtin*' + ) + ALLOWED_FLAGS+=( + -mregparm -mno-app-regs -mapp-regs -mno-mmx -mno-sse + -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 + -mno-avx -mno-aes -mno-pclmul -mno-sse4a -mno-3dnow -mno-popcnt + -mno-abm -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -mplt + -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu + -mieee -mieee-with-inexact -mschedule -mfloat-gprs -mspe -mno-spe + -mtls-direct-seg-refs -mno-tls-direct-seg-refs -mflat -mno-flat + -mno-faster-structs -mfaster-structs -m32 -m64 -mx32 -mabi + -mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 -mcmodel + -mstack-bias -mno-stack-bias -msecure-plt '-m*-toc' -mfloat-abi + -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 + -mfix-rm7000 -mno-fix-rm7000 -mfix-r10000 -mno-fix-r10000 + -mr10k-cache-barrier -mthumb -marm + + # gcc 4.5 + -mno-fma4 -mno-movbe -mno-xop -mno-lwp + # gcc 4.6 + -mno-fsgsbase -mno-rdrnd -mno-f16c -mno-bmi -mno-tbm + # gcc 4.7 + -mno-avx2 -mno-bmi2 -mno-fma -mno-lzcnt + # gcc 4.8 + -mno-fxsr -mno-hle -mno-rtm -mno-xsave -mno-xsaveopt + # gcc 4.9 + -mno-avx512cd -mno-avx512er -mno-avx512f -mno-avx512pf -mno-sha + ) + + # Allow some safe individual flags. Should come along with the bug reference. + ALLOWED_FLAGS+=( + # Allow explicit stack realignment to run non-conformant + # binaries: bug #677852 + -mstackrealign + ) +} + +# @FUNCTION: _filter-hardened +# @INTERNAL +# @DESCRIPTION: +# Inverted filters for hardened compiler. This is trying to unpick +# the hardened compiler defaults. +_filter-hardened() { + local f + for f in "$@" ; do + case "${f}" in + # Ideally we should only concern ourselves with PIE flags, + # not -fPIC or -fpic, but too many places filter -fPIC without + # thinking about -fPIE. + -fPIC|-fpic|-fPIE|-fpie|-Wl,pie|-pie) + gcc-specs-pie || continue + if ! is-flagq -nopie && ! is-flagq -no-pie ; then + # Support older Gentoo form first (-nopie) before falling + # back to the official gcc-6+ form (-no-pie). + if test-flags -nopie >/dev/null ; then + append-flags -nopie + else + append-flags -no-pie + fi + fi + ;; + -fstack-protector) + gcc-specs-ssp || continue + is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector);; + -fstack-protector-all) + gcc-specs-ssp-to-all || continue + is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all);; + -fno-strict-overflow) + gcc-specs-nostrict || continue + is-flagq -fstrict-overflow || append-flags $(test-flags -fstrict-overflow);; + esac + done +} + +# @FUNCTION: _filter-var +# @INTERNAL +# @DESCRIPTION: +# Remove occurrences of strings from variable given in $1 +# Strings removed are matched as globs, so for example +# '-O*' would remove -O1, -O2 etc. +_filter-var() { + local f x var=$1 new=() + shift + + for f in ${!var} ; do + for x in "$@" ; do + # Note this should work with globs like -O* + [[ ${f} == ${x} ]] && continue 2 + done + new+=( "${f}" ) + done + export ${var}="${new[*]}" +} + +# @FUNCTION: filter-flags +# @USAGE: <flags> +# @DESCRIPTION: +# Remove particular <flags> from {C,CPP,CXX,CCAS,F,FC,LD}FLAGS. Accepts shell globs. +filter-flags() { + _filter-hardened "$@" + local v + for v in $(all-flag-vars) ; do + _filter-var ${v} "$@" + done + return 0 +} + +# @FUNCTION: filter-lfs-flags +# @DESCRIPTION: +# Remove flags that enable Large File Support. +filter-lfs-flags() { + [[ $# -ne 0 ]] && die "filter-lfs-flags takes no arguments" + # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html + # _LARGEFILE_SOURCE: enable support for new LFS funcs (ftello/etc...) + # _LARGEFILE64_SOURCE: enable support for 64bit variants (off64_t/fseeko64/etc...) + # _FILE_OFFSET_BITS: default to 64bit variants (off_t is defined as off64_t) + # _TIME_BITS: default to 64bit time_t (requires _FILE_OFFSET_BITS=64) + filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_TIME_BITS=64 +} + +# @FUNCTION: filter-ldflags +# @USAGE: <flags> +# @DESCRIPTION: +# Remove particular <flags> from LDFLAGS. Accepts shell globs. +filter-ldflags() { + _filter-var LDFLAGS "$@" + return 0 +} + +# @FUNCTION: append-cppflags +# @USAGE: <flags> +# @DESCRIPTION: +# Add extra <flags> to the current CPPFLAGS. +append-cppflags() { + [[ $# -eq 0 ]] && return 0 + export CPPFLAGS+=" $*" + return 0 +} + +# @FUNCTION: append-cflags +# @USAGE: <flags> +# @DESCRIPTION: +# Add extra <flags> to the current CFLAGS. If a flag might not be supported +# with different compilers (or versions), then use test-flags-CC like so: +# @CODE +# append-cflags $(test-flags-CC -funky-flag) +# @CODE +append-cflags() { + [[ $# -eq 0 ]] && return 0 + # Do not do automatic flag testing ourselves. #417047 + export CFLAGS+=" $*" + return 0 +} + +# @FUNCTION: append-cxxflags +# @USAGE: <flags> +# @DESCRIPTION: +# Add extra <flags> to the current CXXFLAGS. If a flag might not be supported +# with different compilers (or versions), then use test-flags-CXX like so: +# @CODE +# append-cxxflags $(test-flags-CXX -funky-flag) +# @CODE +append-cxxflags() { + [[ $# -eq 0 ]] && return 0 + # Do not do automatic flag testing ourselves. #417047 + export CXXFLAGS+=" $*" + return 0 +} + +# @FUNCTION: append-fflags +# @USAGE: <flags> +# @DESCRIPTION: +# Add extra <flags> to the current {F,FC}FLAGS. If a flag might not be supported +# with different compilers (or versions), then use test-flags-F77 like so: +# @CODE +# append-fflags $(test-flags-F77 -funky-flag) +# @CODE +append-fflags() { + [[ $# -eq 0 ]] && return 0 + # Do not do automatic flag testing ourselves. #417047 + export FFLAGS+=" $*" + export FCFLAGS+=" $*" + return 0 +} + +# @FUNCTION: append-lfs-flags +# @DESCRIPTION: +# Add flags that enable Large File Support. +append-lfs-flags() { + [[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments" + # see comments in filter-lfs-flags func for meaning of these + append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE +} + +# @FUNCTION: append-ldflags +# @USAGE: <flags> +# @DESCRIPTION: +# Add extra <flags> to the current LDFLAGS. +append-ldflags() { + [[ $# -eq 0 ]] && return 0 + local flag + for flag in "$@"; do + [[ ${flag} == -l* ]] && \ + eqawarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS" + done + + export LDFLAGS="${LDFLAGS} $*" + return 0 +} + +# @FUNCTION: append-flags +# @USAGE: <flags> +# @DESCRIPTION: +# Add extra <flags> to your current {C,CXX,F,FC}FLAGS. +append-flags() { + [[ $# -eq 0 ]] && return 0 + case " $* " in + *' '-[DIU]*) eqawarn 'please use append-cppflags for preprocessor flags' ;; + *' '-L*|\ + *' '-Wl,*) eqawarn 'please use append-ldflags for linker flags' ;; + esac + append-cflags "$@" + append-cxxflags "$@" + append-fflags "$@" + return 0 +} + +# @FUNCTION: replace-flags +# @USAGE: <old> <new> +# @DESCRIPTION: +# Replace the <old> flag with <new>. Accepts shell globs for <old>. +replace-flags() { + [[ $# != 2 ]] && die "Usage: replace-flags <old flag> <new flag>" + + local f var new + for var in $(all-flag-vars) ; do + # Looping over the flags instead of using a global + # substitution ensures that we're working with flag atoms. + # Otherwise globs like -O* have the potential to wipe out the + # list of flags. + new=() + for f in ${!var} ; do + # Note this should work with globs like -O* + [[ ${f} == ${1} ]] && f=${2} + new+=( "${f}" ) + done + export ${var}="${new[*]}" + done + + return 0 +} + +# @FUNCTION: replace-cpu-flags +# @USAGE: <old> <new> +# @DESCRIPTION: +# Replace cpu flags (like -march/-mcpu/-mtune) that select the <old> cpu +# with flags that select the <new> cpu. Accepts shell globs for <old>. +replace-cpu-flags() { + local newcpu="$#" ; newcpu="${!newcpu}" + while [ $# -gt 1 ] ; do + # quote to make sure that no globbing is done (particularly on + # ${oldcpu}) prior to calling replace-flags + replace-flags "-march=${1}" "-march=${newcpu}" + replace-flags "-mcpu=${1}" "-mcpu=${newcpu}" + replace-flags "-mtune=${1}" "-mtune=${newcpu}" + shift + done + return 0 +} + +# @FUNCTION: _is_flagq +# @USAGE: <variable> <flag> +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if <flag> is in a given <variable>, else returns shell false. +_is_flagq() { + local x var="$1[*]" + for x in ${!var} ; do + [[ ${x} == $2 ]] && return 0 + done + return 1 +} + +# @FUNCTION: is-flagq +# @USAGE: <flag> +# @DESCRIPTION: +# Returns shell true if <flag> is in {C,CXX,F,FC}FLAGS, else returns shell false. Accepts shell globs. +is-flagq() { + [[ -n $2 ]] && die "Usage: is-flag <flag>" + + local var + for var in $(all-flag-vars) ; do + _is_flagq ${var} "$1" && return 0 + done + return 1 +} + +# @FUNCTION: is-flag +# @USAGE: <flag> +# @DESCRIPTION: +# Echo's "true" if flag is set in {C,CXX,F,FC}FLAGS. Accepts shell globs. +is-flag() { + is-flagq "$@" && echo true +} + +# @FUNCTION: is-ldflagq +# @USAGE: <flag> +# @DESCRIPTION: +# Returns shell true if <flag> is in LDFLAGS, else returns shell false. Accepts shell globs. +is-ldflagq() { + [[ -n $2 ]] && die "Usage: is-ldflag <flag>" + _is_flagq LDFLAGS $1 +} + +# @FUNCTION: is-ldflag +# @USAGE: <flag> +# @DESCRIPTION: +# Echo's "true" if flag is set in LDFLAGS. Accepts shell globs. +is-ldflag() { + is-ldflagq "$@" && echo true +} + +# @FUNCTION: filter-mfpmath +# @USAGE: <math types> +# @DESCRIPTION: +# Remove specified math types from the fpmath flag. For example, if the user +# has -mfpmath=sse,386, running `filter-mfpmath sse` will leave the user with +# -mfpmath=386. +filter-mfpmath() { + local orig_mfpmath new_math prune_math + + # save the original -mfpmath flag + orig_mfpmath=$(get-flag -mfpmath) + # get the value of the current -mfpmath flag + new_math=$(get-flag mfpmath) + # convert "both" to something we can filter + new_math=${new_math/both/387,sse} + new_math=" ${new_math//[,+]/ } " + # figure out which math values are to be removed + prune_math="" + for prune_math in "$@" ; do + new_math=${new_math/ ${prune_math} / } + done + new_math=$(echo ${new_math}) + new_math=${new_math// /,} + + if [[ -z ${new_math} ]] ; then + # if we're removing all user specified math values are + # slated for removal, then we just filter the flag + filter-flags ${orig_mfpmath} + else + # if we only want to filter some of the user specified + # math values, then we replace the current flag + replace-flags ${orig_mfpmath} -mfpmath=${new_math} + fi + return 0 +} + +# @FUNCTION: strip-flags +# @DESCRIPTION: +# Strip *FLAGS of everything except known good/safe flags. This runs over all +# flags returned by all_flag_vars(). +strip-flags() { + [[ $# -ne 0 ]] && die "strip-flags takes no arguments" + local x y var + + local ALLOWED_FLAGS + _setup-allowed-flags + + set -f # disable pathname expansion + + for var in $(all-flag-vars) ; do + local new=() + + for x in ${!var} ; do + local flag=${x%%=*} + for y in "${ALLOWED_FLAGS[@]}" ; do + if [[ -z ${flag%%${y}} ]] ; then + new+=( "${x}" ) + break + fi + done + done + + # In case we filtered out all optimization flags fallback to -O2 + if _is_flagq ${var} "-O*" && ! _is_flagq new "-O*" ; then + new+=( -O2 ) + fi + + if [[ ${!var} != "${new[*]}" ]] ; then + einfo "strip-flags: ${var}: changed '${!var}' to '${new[*]}'" + fi + export ${var}="${new[*]}" + done + + set +f # re-enable pathname expansion + + return 0 +} + +# @FUNCTION: test-flag-PROG +# @USAGE: <compiler> <flag> +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if <flag> is supported by given <compiler>, +# else returns shell false. +test-flag-PROG() { + [[ ${EAPI} == [567] ]] || + die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." + _test-flag-PROG "$@" +} + +# @FUNCTION: _test-flag-PROG +# @USAGE: <compiler> <flag> +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if <flag> is supported by given <compiler>, +# else returns shell false. +_test-flag-PROG() { + local comp=$1 + local lang=$2 + shift 2 + + if [[ -z ${comp} ]]; then + return 1 + fi + if [[ -z $1 ]]; then + return 1 + fi + + # verify selected compiler exists before using it + comp=($(tc-get${comp})) + # 'comp' can already contain compiler options. + # 'type' needs a binary name + if ! type -p ${comp[0]} >/dev/null; then + return 1 + fi + + # Set up test file. + local in_src in_ext cmdline_extra=() + case "${lang}" in + # compiler/assembler only + c) + in_ext='c' + in_src='int main(void) { return 0; }' + cmdline_extra+=(-xc -c) + ;; + c++) + in_ext='cc' + in_src='int main(void) { return 0; }' + cmdline_extra+=(-xc++ -c) + ;; + f77) + in_ext='f' + # fixed source form + in_src=' end' + cmdline_extra+=(-xf77 -c) + ;; + f95) + in_ext='f90' + in_src='end' + cmdline_extra+=(-xf95 -c) + ;; + + # C compiler/assembler/linker + c+ld) + in_ext='c' + in_src='int main(void) { return 0; }' + cmdline_extra+=(-xc) + ;; + esac + local test_in=${T}/test-flag.${in_ext} + local test_out=${T}/test-flag.exe + + printf "%s\n" "${in_src}" > "${test_in}" || die "Failed to create '${test_in}'" + + # Currently we rely on warning-free output of a compiler + # before the flag to see if a flag prduces any warnings. + # This has a few drawbacks: + # - if compiler already generates warnings we filter out + # every single flag: bug #712488 + # - if user actually wants to see warnings we just strip + # them regardless of warnings type. + # + # We can add more selective detection of no-op flags via + # '-Werror=ignored-optimization-argument' and similar error options + # similar to what we are doing with '-Qunused-arguments'. + local cmdline=( + "${comp[@]}" + # Clang will warn about unknown gcc flags but exit 0. + # Need -Werror to force it to exit non-zero. + -Werror + "$@" + # -x<lang> options need to go before first source file + "${cmdline_extra[@]}" + + "${test_in}" -o "${test_out}" + ) + + if ! "${cmdline[@]}" &>/dev/null; then + # -Werror makes clang bail out on unused arguments as well; + # try to add -Qunused-arguments to work-around that + # other compilers don't support it but then, it's failure like + # any other + cmdline+=( -Qunused-arguments ) + "${cmdline[@]}" &>/dev/null + fi +} + +# @FUNCTION: test-flag-CC +# @USAGE: <flag> +# @DESCRIPTION: +# Returns shell true if <flag> is supported by the C compiler, else returns shell false. +test-flag-CC() { _test-flag-PROG CC c "$@"; } + +# @FUNCTION: test-flag-CXX +# @USAGE: <flag> +# @DESCRIPTION: +# Returns shell true if <flag> is supported by the C++ compiler, else returns shell false. +test-flag-CXX() { _test-flag-PROG CXX c++ "$@"; } + +# @FUNCTION: test-flag-F77 +# @USAGE: <flag> +# @DESCRIPTION: +# Returns shell true if <flag> is supported by the Fortran 77 compiler, else returns shell false. +test-flag-F77() { _test-flag-PROG F77 f77 "$@"; } + +# @FUNCTION: test-flag-FC +# @USAGE: <flag> +# @DESCRIPTION: +# Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false. +test-flag-FC() { _test-flag-PROG FC f95 "$@"; } + +# @FUNCTION: test-flag-CCLD +# @USAGE: <flag> +# @DESCRIPTION: +# Returns shell true if <flag> is supported by the C compiler and linker, else returns shell false. +test-flag-CCLD() { _test-flag-PROG CC c+ld "$@"; } + +# @FUNCTION: test-flags-PROG +# @USAGE: <compiler> <flag> [more flags...] +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if <flags> are supported by given <compiler>, +# else returns shell false. +test-flags-PROG() { + [[ ${EAPI} == [567] ]] || + die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." + _test-flags-PROG "$@" +} + +# @FUNCTION: _test-flags-PROG +# @USAGE: <compiler> <flag> [more flags...] +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if <flags> are supported by given <compiler>, +# else returns shell false. +_test-flags-PROG() { + local comp=$1 + local flags=() + local x + + shift + + [[ -z ${comp} ]] && return 1 + + while (( $# )); do + case "$1" in + # '-B /foo': bug # 687198 + --param|-B) + if test-flag-${comp} "$1" "$2"; then + flags+=( "$1" "$2" ) + fi + shift 2 + ;; + *) + if test-flag-${comp} "$1"; then + flags+=( "$1" ) + fi + shift 1 + ;; + esac + done + + echo "${flags[*]}" + + # Just bail if we dont have any flags + [[ ${#flags[@]} -gt 0 ]] +} + +# @FUNCTION: test-flags-CC +# @USAGE: <flags> +# @DESCRIPTION: +# Returns shell true if <flags> are supported by the C compiler, else returns shell false. +test-flags-CC() { _test-flags-PROG CC "$@"; } + +# @FUNCTION: test-flags-CXX +# @USAGE: <flags> +# @DESCRIPTION: +# Returns shell true if <flags> are supported by the C++ compiler, else returns shell false. +test-flags-CXX() { _test-flags-PROG CXX "$@"; } + +# @FUNCTION: test-flags-F77 +# @USAGE: <flags> +# @DESCRIPTION: +# Returns shell true if <flags> are supported by the Fortran 77 compiler, else returns shell false. +test-flags-F77() { _test-flags-PROG F77 "$@"; } + +# @FUNCTION: test-flags-FC +# @USAGE: <flags> +# @DESCRIPTION: +# Returns shell true if <flags> are supported by the Fortran 90 compiler, else returns shell false. +test-flags-FC() { _test-flags-PROG FC "$@"; } + +# @FUNCTION: test-flags-CCLD +# @USAGE: <flags> +# @DESCRIPTION: +# Returns shell true if <flags> are supported by the C compiler and default linker, else returns shell false. +test-flags-CCLD() { _test-flags-PROG CCLD "$@"; } + +# @FUNCTION: test-flags +# @USAGE: <flags> +# @DESCRIPTION: +# Short-hand that should hopefully work for both C and C++ compiler, but +# its really only present due to the append-flags() abomination. +test-flags() { test-flags-CC "$@"; } + +# @FUNCTION: test_version_info +# @USAGE: <version> +# @DESCRIPTION: +# Returns shell true if the current C compiler version matches <version>, else returns shell false. +# Accepts shell globs. +test_version_info() { + if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then + return 0 + else + return 1 + fi +} + +# @FUNCTION: strip-unsupported-flags +# @DESCRIPTION: +# Strip {C,CXX,F,FC}FLAGS of any flags not supported by the active toolchain. +strip-unsupported-flags() { + [[ $# -ne 0 ]] && die "strip-unsupported-flags takes no arguments" + export CFLAGS=$(test-flags-CC ${CFLAGS}) + export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS}) + export FFLAGS=$(test-flags-F77 ${FFLAGS}) + export FCFLAGS=$(test-flags-FC ${FCFLAGS}) + export LDFLAGS=$(test-flags-CCLD ${LDFLAGS}) +} + +# @FUNCTION: get-flag +# @USAGE: <flag> +# @DESCRIPTION: +# Find and echo the value for a particular flag. Accepts shell globs. +get-flag() { + [[ $# -ne 1 ]] && die "usage: <flag>" + local f var findflag="$1" + + # this code looks a little flaky but seems to work for + # everything we want ... + # for example, if CFLAGS="-march=i686": + # `get-flag -march` == "-march=i686" + # `get-flag march` == "i686" + for var in $(all-flag-vars) ; do + for f in ${!var} ; do + if [ "${f/${findflag}}" != "${f}" ] ; then + printf "%s\n" "${f/-${findflag}=}" + return 0 + fi + done + done + return 1 +} + +# @FUNCTION: replace-sparc64-flags +# @DESCRIPTION: +# Sets mcpu to v8 and uses the original value as mtune if none specified. +replace-sparc64-flags() { + [[ $# -ne 0 ]] && die "replace-sparc64-flags takes no arguments" + local SPARC64_CPUS="ultrasparc3 ultrasparc v9" + + if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then + for x in ${SPARC64_CPUS}; do + CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}" + done + else + for x in ${SPARC64_CPUS}; do + CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}" + done + fi + + if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then + for x in ${SPARC64_CPUS}; do + CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}" + done + else + for x in ${SPARC64_CPUS}; do + CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}" + done + fi + + export CFLAGS CXXFLAGS +} + +# @FUNCTION: append-libs +# @USAGE: <libs> +# @DESCRIPTION: +# Add extra <libs> to the current LIBS. All arguments should be prefixed with +# either -l or -L. For compatibility, if arguments are not prefixed as +# options, they are given a -l prefix automatically. +append-libs() { + [[ $# -eq 0 ]] && return 0 + local flag + for flag in "$@"; do + if [[ -z "${flag// }" ]]; then + eqawarn "Appending an empty argument to LIBS is invalid! Skipping." + continue + fi + case $flag in + -[lL]*) + export LIBS="${LIBS} ${flag}" + ;; + -*) + eqawarn "Appending non-library to LIBS (${flag}); Other linker flags should be passed via LDFLAGS" + export LIBS="${LIBS} ${flag}" + ;; + *) + export LIBS="${LIBS} -l${flag}" + esac + done + + return 0 +} + +# @FUNCTION: raw-ldflags +# @USAGE: [flags] +# @DESCRIPTION: +# Turn C style ldflags (-Wl,-foo) into straight ldflags - the results +# are suitable for passing directly to 'ld'; note LDFLAGS is usually passed +# to gcc where it needs the '-Wl,'. +# +# If no flags are specified, then default to ${LDFLAGS}. +raw-ldflags() { + local x input="$@" + [[ -z ${input} ]] && input=${LDFLAGS} + set -- + for x in ${input} ; do + case ${x} in + -Wl,*) + x=${x#-Wl,} + set -- "$@" ${x//,/ } + ;; + *) # Assume it's a compiler driver flag, so throw it away #441808 + ;; + esac + done + echo "$@" +} + +# @FUNCTION: no-as-needed +# @RETURN: Flag to disable asneeded behavior for use with append-ldflags. +no-as-needed() { + [[ $# -ne 0 ]] && die "no-as-needed takes no arguments" + case $($(tc-getLD) -v 2>&1 </dev/null) in + *GNU*) # GNU ld + echo "-Wl,--no-as-needed" ;; + esac +} + +fi diff --git a/eclass/meson-multilib.eclass b/eclass/meson-multilib.eclass new file mode 100644 index 0000000..49c6441 --- /dev/null +++ b/eclass/meson-multilib.eclass @@ -0,0 +1,132 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: meson-multilib.eclass +# @MAINTAINER: +# Matt Turner <mattst88@gentoo.org> +# @AUTHOR: +# Michał Górny <mgorny@gentoo.org> +# Matt Turner <mattst88@gentoo.org> +# @SUPPORTED_EAPIS: 7 8 +# @PROVIDES: meson multilib-minimal +# @BLURB: meson wrapper for multilib builds +# @DESCRIPTION: +# The meson-multilib.eclass provides a glue between meson.eclass(5) +# and multilib-minimal.eclass(5), aiming to provide a convenient way +# to build packages using meson for multiple ABIs. +# +# Inheriting this eclass sets IUSE and exports default multilib_src_*() +# sub-phases that call meson phase functions for each ABI enabled. +# The multilib_src_*() functions can be defined in ebuild just like +# in multilib-minimal, yet they ought to call appropriate meson +# phase rather than 'default'. + +case ${EAPI} in + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ -z ${_MESON_MULTILIB_ECLASS} ]] ; then +_MESON_MULTILIB_ECLASS=1 + +inherit meson multilib-minimal + +EXPORT_FUNCTIONS src_configure src_compile src_test src_install + +# @FUNCTION: meson_native_use_bool +# @USAGE: <USE flag> [option name] +# @DESCRIPTION: +# Given a USE flag and a meson project option, output a string like: +# +# -Doption=true +# -Doption=false +# +# if building for the native ABI (multilib_is_native_abi is true). Otherwise, +# output -Doption=false. If the project option is unspecified, it defaults +# to the USE flag. +meson_native_use_bool() { + multilib_native_usex "${1}" "-D${2-${1}}=true" "-D${2-${1}}=false" +} + +# @FUNCTION: meson_native_use_feature +# @USAGE: <USE flag> [option name] +# @DESCRIPTION: +# Given a USE flag and a meson project option, output a string like: +# +# -Doption=enabled +# -Doption=disabled +# +# if building for the native ABI (multilib_is_native_abi is true). Otherwise, +# output -Doption=disabled. If the project option is unspecified, it defaults +# to the USE flag. +meson_native_use_feature() { + multilib_native_usex "${1}" "-D${2-${1}}=enabled" "-D${2-${1}}=disabled" +} + +# @FUNCTION: meson_native_enabled +# @USAGE: <option name> +# @DESCRIPTION: +# Output -Doption=enabled option if executables are being built +# (multilib_is_native_abi is true). Otherwise, output -Doption=disabled option. +meson_native_enabled() { + if multilib_is_native_abi; then + echo "-D${1}=enabled" + else + echo "-D${1}=disabled" + fi +} + +# @FUNCTION: meson_native_true +# @USAGE: <option name> +# @DESCRIPTION: +# Output -Doption=true option if executables are being built +# (multilib_is_native_abi is true). Otherwise, output -Doption=false option. +meson_native_true() { + if multilib_is_native_abi; then + echo "-D${1}=true" + else + echo "-D${1}=false" + fi +} + +meson-multilib_src_configure() { + local _meson_args=( "${@}" ) + + multilib-minimal_src_configure +} + +multilib_src_configure() { + meson_src_configure "${_meson_args[@]}" +} + +meson-multilib_src_compile() { + local _meson_args=( "${@}" ) + + multilib-minimal_src_compile +} + +multilib_src_compile() { + meson_src_compile "${_meson_args[@]}" +} + +meson-multilib_src_test() { + local _meson_args=( "${@}" ) + + multilib-minimal_src_test +} + +multilib_src_test() { + meson_src_test "${_meson_args[@]}" +} + +meson-multilib_src_install() { + local _meson_args=( "${@}" ) + + multilib-minimal_src_install +} + +multilib_src_install() { + meson_install "${_meson_args[@]}" +} + +fi diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass new file mode 100644 index 0000000..c32bfaa --- /dev/null +++ b/eclass/multiprocessing.eclass @@ -0,0 +1,109 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: multiprocessing.eclass +# @MAINTAINER: +# base-system@gentoo.org +# @AUTHOR: +# Brian Harring <ferringb@gentoo.org> +# Mike Frysinger <vapier@gentoo.org> +# @SUPPORTED_EAPIS: 5 6 7 8 +# @BLURB: multiprocessing helper functions +# @DESCRIPTION: +# The multiprocessing eclass contains a suite of utility functions +# that could be helpful to controlling parallel multiple job execution. +# The most common use is processing MAKEOPTS in order to obtain job +# count. +# +# @EXAMPLE: +# +# @CODE +# src_compile() { +# # custom build system that does not support most of MAKEOPTS +# ./mybs -j$(makeopts_jobs) +# } +# @CODE + +case ${EAPI:-0} in + [5678]) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ -z ${_MULTIPROCESSING_ECLASS} ]]; then +_MULTIPROCESSING_ECLASS=1 + +# @FUNCTION: get_nproc +# @USAGE: [${fallback:-1}] +# @DESCRIPTION: +# Attempt to figure out the number of processing units available. +# If the value can not be determined, prints the provided fallback +# instead. If no fallback is provided, defaults to 1. +get_nproc() { + local nproc + + # GNU + if type -P nproc &>/dev/null; then + nproc=$(nproc) + fi + + # BSD + if [[ -z ${nproc} ]] && type -P sysctl &>/dev/null; then + nproc=$(sysctl -n hw.ncpu 2>/dev/null) + fi + + # fallback to python2.6+ + # note: this may fail (raise NotImplementedError) + if [[ -z ${nproc} ]] && type -P python &>/dev/null; then + nproc=$(python -c 'import multiprocessing; print(multiprocessing.cpu_count());' 2>/dev/null) + fi + + if [[ -n ${nproc} ]]; then + echo "${nproc}" + else + echo "${1:-1}" + fi +} + +# @FUNCTION: makeopts_jobs +# @USAGE: [${MAKEOPTS}] [${inf:-999}] +# @DESCRIPTION: +# Searches the arguments (defaults to ${MAKEOPTS}) and extracts the jobs number +# specified therein. Useful for running non-make tools in parallel too. +# i.e. if the user has MAKEOPTS=-j9, this will echo "9" -- we can't return the +# number as bash normalizes it to [0, 255]. If the flags haven't specified a +# -j flag, then "1" is shown as that is the default `make` uses. Since there's +# no way to represent infinity, we return ${inf} (defaults to 999) if the user +# has -j without a number. +makeopts_jobs() { + [[ $# -eq 0 ]] && set -- "${MAKEOPTS}" + # This assumes the first .* will be more greedy than the second .* + # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). + local jobs=$(echo " $* " | sed -r -n \ + -e 's:.*[[:space:]](-[a-z]*j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ + -e "s:.*[[:space:]](-[a-z]*j|--jobs)[[:space:]].*:${2:-999}:p") + echo ${jobs:-1} +} + +# @FUNCTION: makeopts_loadavg +# @USAGE: [${MAKEOPTS}] [${inf:-999}] +# @DESCRIPTION: +# Searches the arguments (defaults to ${MAKEOPTS}) and extracts the value set +# for load-average. For make and ninja based builds this will mean new jobs are +# not only limited by the jobs-value, but also by the current load - which might +# get excessive due to I/O and not just due to CPU load. +# Be aware that the returned number might be a floating-point number. Test +# whether your software supports that. +# If no limit is specified or --load-average is used without a number, ${inf} +# (defaults to 999) is returned. +makeopts_loadavg() { + [[ $# -eq 0 ]] && set -- "${MAKEOPTS}" + # This assumes the first .* will be more greedy than the second .* + # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). + local lavg=$(echo " $* " | sed -r -n \ + -e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+(\.[0-9]+)?)[[:space:]].*:\3:p' \ + -e "s:.*[[:space:]](-[a-z]*l|--(load-average|max-load))[[:space:]].*:${2:-999}:p") + # Default to ${inf} since the default is to not use a load limit. + echo ${lavg:-${2:-999}} +} + +fi diff --git a/eclass/pax-utils.eclass b/eclass/pax-utils.eclass new file mode 100644 index 0000000..f48dcda --- /dev/null +++ b/eclass/pax-utils.eclass @@ -0,0 +1,200 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: pax-utils.eclass +# @MAINTAINER: +# The Gentoo Linux Hardened Team <hardened@gentoo.org> +# @AUTHOR: +# Author: Kevin F. Quinn <kevquinn@gentoo.org> +# Author: Anthony G. Basile <blueness@gentoo.org> +# @SUPPORTED_EAPIS: 5 6 7 8 +# @BLURB: functions to provide PaX markings for hardened kernels +# @DESCRIPTION: +# +# This eclass provides support for manipulating PaX markings on ELF binaries, +# whether the system is using legacy PT_PAX markings or the newer XATTR_PAX. +# The eclass wraps the use of paxctl-ng, paxctl, set/getattr and scanelf utilities, +# deciding which to use depending on what's installed on the build host, and +# whether we're working with PT_PAX, XATTR_PAX or both. +# Legacy PT_PAX markings no longer supported. +# +# To control what markings are made, set PAX_MARKINGS in /etc/portage/make.conf +# to contain either "PT", "XT" or "none". The default is none + +case ${EAPI:-0} in + 5|6|7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ -z ${_PAX_UTILS_ECLASS} ]]; then +_PAX_UTILS_ECLASS=1 + +# @ECLASS-VARIABLE: PAX_MARKINGS +# @DESCRIPTION: +# Control which markings are made: +# PT = PT_PAX markings, XT = XATTR_PAX markings +# Default to none markings. +PAX_MARKINGS=${PAX_MARKINGS:="none"} + +# @FUNCTION: pax-mark +# @USAGE: <flags> <ELF files> +# @RETURN: Shell true if we succeed, shell false otherwise +# @DESCRIPTION: +# Marks <ELF files> with provided PaX <flags> +# +# Flags are passed directly to the utilities unchanged. +# +# @CODE +# p: disable PAGEEXEC P: enable PAGEEXEC +# e: disable EMUTRAMP E: enable EMUTRAMP +# m: disable MPROTECT M: enable MPROTECT +# r: disable RANDMMAP R: enable RANDMMAP +# s: disable SEGMEXEC S: enable SEGMEXEC +# @CODE +# +# Default flags are 'PeMRS', which are the most restrictive settings. Refer +# to https://pax.grsecurity.net/ for details on what these flags are all about. +# +# Please confirm any relaxation of restrictions with the Gentoo Hardened team. +# Either ask on the gentoo-hardened mailing list, or CC/assign +# hardened@gentoo.org on the bug report. +pax-mark() { + local f # loop over paxables + local flags # pax flags + local ret=0 # overall return code of this function + + # Only the actual PaX flags and z are accepted + # 1. The leading '-' is optional + # 2. -C -c only make sense for paxctl, but are unnecessary + # because we progressively do -q -qc -qC + # 3. z is allowed for the default + + flags="${1//[!zPpEeMmRrSs]}" + [[ "${flags}" ]] || return 0 + shift + + # z = default. For XATTR_PAX, the default is no xattr field at all + local dodefault="" + [[ "${flags//[!z]}" ]] && dodefault="yes" + + if has PT ${PAX_MARKINGS}; then + # Uncomment to list all files to be marked + # _pax_list_files einfo "$@" + for f in "$@"; do + + # First try paxctl + if type -p paxctl >/dev/null; then + einfo "PT_PAX marking -${flags} ${f} with paxctl" + # We try modifying the existing PT_PAX_FLAGS header. + paxctl -q${flags} "${f}" >/dev/null 2>&1 && continue + # We no longer try to create/convert a PT_PAX_FLAGS header, bug #590422 + # paxctl -qC${flags} "${f}" >/dev/null 2>&1 && continue + # paxctl -qc${flags} "${f}" >/dev/null 2>&1 && continue + fi + + # Next try paxctl-ng -> this will not create/convert any program headers. + if type -p paxctl-ng >/dev/null && paxctl-ng -L ; then + einfo "PT_PAX marking -${flags} ${f} with paxctl-ng" + flags="${flags//z}" + [[ ${dodefault} == "yes" ]] && paxctl-ng -L -z "${f}" >/dev/null 2>&1 + [[ "${flags}" ]] || continue + paxctl-ng -L -${flags} "${f}" >/dev/null 2>&1 && continue + fi + + # Finally fall back on scanelf. + if type -p scanelf >/dev/null && [[ ${PAX_MARKINGS} != "none" ]]; then + einfo "PT_PAX marking -${flags} ${f} with scanelf" + scanelf -Xxz ${flags} "$f" >/dev/null 2>&1 + # We failed to set PT_PAX flags. + elif [[ ${PAX_MARKINGS} != "none" ]]; then + elog "Failed to set PT_PAX markings -${flags} ${f}." + ret=1 + fi + done + fi + + if has XT ${PAX_MARKINGS}; then + # Uncomment to list all files to be marked + # _pax_list_files einfo "$@" + flags="${flags//z}" + for f in "$@"; do + + # First try paxctl-ng. + if type -p paxctl-ng >/dev/null && paxctl-ng -l ; then + einfo "XATTR_PAX marking -${flags} ${f} with paxctl-ng" + [[ ${dodefault} == "yes" ]] && paxctl-ng -d "${f}" >/dev/null 2>&1 + [[ "${flags}" ]] || continue + paxctl-ng -l -${flags} "${f}" >/dev/null 2>&1 && continue + fi + + # Next try setfattr. + if type -p setfattr >/dev/null; then + [[ "${flags//[!Ee]}" ]] || flags+="e" # bug 447150 + einfo "XATTR_PAX marking -${flags} ${f} with setfattr" + [[ ${dodefault} == "yes" ]] && setfattr -x "user.pax.flags" "${f}" >/dev/null 2>&1 + setfattr -n "user.pax.flags" -v "${flags}" "${f}" >/dev/null 2>&1 && continue + fi + + # We failed to set XATTR_PAX flags. + if [[ ${PAX_MARKINGS} != "none" ]]; then + elog "Failed to set XATTR_PAX markings -${flags} ${f}." + ret=1 + fi + done + fi + + # [[ ${ret} == 1 ]] && elog "Executables may be killed by PaX kernels." + + return ${ret} +} + +# @FUNCTION: list-paxables +# @USAGE: <files> +# @RETURN: Subset of <files> which are ELF executables or shared objects +# @DESCRIPTION: +# Print to stdout all of the <files> that are suitable to have PaX flag +# markings, i.e., filter out the ELF executables or shared objects from a list +# of files. This is useful for passing wild-card lists to pax-mark, although +# in general it is preferable for ebuilds to list precisely which ELFS are to +# be marked. Often not all the ELF installed by a package need remarking. +# @EXAMPLE: +# pax-mark -m $(list-paxables ${S}/{,usr/}bin/*) +list-paxables() { + file "$@" 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//' +} + +# @FUNCTION: host-is-pax +# @RETURN: Shell true if the build process is PaX enabled, shell false otherwise +# @DESCRIPTION: +# This is intended for use where the build process must be modified conditionally +# depending on whether the host is PaX enabled or not. It is not indented to +# determine whether the final binaries need PaX markings. Note: if procfs is +# not mounted on /proc, this returns shell false (e.g. Gentoo/FreeBSD). +host-is-pax() { + grep -qs ^PaX: /proc/self/status +} + + +# INTERNAL FUNCTIONS +# ------------------ +# +# These functions are for use internally by the eclass - do not use +# them elsewhere as they are not supported (i.e. they may be removed +# or their function may change arbitrarily). + +# @FUNCTION: _pax_list_files +# @INTERNAL +# @USAGE: <command to display items> [items] +# @DESCRIPTION: +# Display a list of things, one per line, indented a bit, using the +# display command in $1. +_pax_list_files() { + local f cmd + cmd=$1 + shift + for f in "$@"; do + ${cmd} " ${f}" + done +} + +fi diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass new file mode 100644 index 0000000..7af9474 --- /dev/null +++ b/eclass/python-any-r1.eclass @@ -0,0 +1,380 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: python-any-r1.eclass +# @MAINTAINER: +# Python team <python@gentoo.org> +# @AUTHOR: +# Author: Michał Górny <mgorny@gentoo.org> +# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org> +# @SUPPORTED_EAPIS: 6 7 8 +# @PROVIDES: python-utils-r1 +# @BLURB: An eclass for packages having build-time dependency on Python. +# @DESCRIPTION: +# A minimal eclass for packages which need any Python interpreter +# installed without a need for explicit choice and invariability. +# This usually involves packages requiring Python at build-time +# but having no other relevance to it. +# +# This eclass provides a minimal PYTHON_DEPS variable with a dependency +# string on any of the supported Python implementations. It also exports +# pkg_setup() which finds the best supported implementation and sets it +# as the active one. +# +# Optionally, you can define a python_check_deps() function. It will +# be called by the eclass with EPYTHON set to each matching Python +# implementation and it is expected to check whether the implementation +# fulfills the package requirements. You can use the locally exported +# PYTHON_USEDEP or PYTHON_SINGLE_USEDEP to check USE-dependencies +# of relevant packages. It should return a true value (0) if the Python +# implementation fulfills the requirements, a false value (non-zero) +# otherwise. +# +# Please note that python-any-r1 will always inherit python-utils-r1 +# as well. Thus, all the functions defined there can be used in the +# packages using python-any-r1, and there is no need ever to inherit +# both. +# +# For more information, please see the Python Guide: +# https://dev.gentoo.org/~mgorny/python-guide/ + +case "${EAPI:-0}" in + [0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;; + [6-8]) ;; + *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;; +esac + +if [[ ! ${_PYTHON_ANY_R1} ]]; then + +if [[ ${_PYTHON_R1} ]]; then + die 'python-any-r1.eclass can not be used with python-r1.eclass.' +elif [[ ${_PYTHON_SINGLE_R1} ]]; then + die 'python-any-r1.eclass can not be used with python-single-r1.eclass.' +fi + +inherit python-utils-r1 + +fi + +EXPORT_FUNCTIONS pkg_setup + +# @ECLASS-VARIABLE: PYTHON_COMPAT +# @REQUIRED +# @DESCRIPTION: +# This variable contains a list of Python implementations the package +# supports. It must be set before the `inherit' call. It has to be +# an array. +# +# Example: +# @CODE +# PYTHON_COMPAT=( python{2_5,2_6,2_7} ) +# @CODE + +# @ECLASS-VARIABLE: PYTHON_COMPAT_OVERRIDE +# @USER_VARIABLE +# @DEFAULT_UNSET +# @DESCRIPTION: +# This variable can be used when working with ebuilds to override +# the in-ebuild PYTHON_COMPAT. It is a string naming the implementation +# which will be used to build the package. It needs to be specified +# in the calling environment, and not in ebuilds. +# +# It should be noted that in order to preserve metadata immutability, +# PYTHON_COMPAT_OVERRIDE does not affect dependencies. The value of +# EPYTHON and eselect-python preferences are ignored. Dependencies need +# to be satisfied manually. +# +# Example: +# @CODE +# PYTHON_COMPAT_OVERRIDE='pypy' emerge -1v dev-python/bar +# @CODE + +# @ECLASS-VARIABLE: PYTHON_REQ_USE +# @DEFAULT_UNSET +# @DESCRIPTION: +# The list of USEflags required to be enabled on the Python +# implementations, formed as a USE-dependency string. It should be valid +# for all implementations in PYTHON_COMPAT, so it may be necessary to +# use USE defaults. +# +# Example: +# @CODE +# PYTHON_REQ_USE="gdbm,ncurses(-)?" +# @CODE +# +# It will cause the Python dependencies to look like: +# @CODE +# || ( dev-lang/python:X.Y[gdbm,ncurses(-)?] ... ) +# @CODE + +# @ECLASS-VARIABLE: PYTHON_DEPS +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# This is an eclass-generated Python dependency string for all +# implementations listed in PYTHON_COMPAT. +# +# Any of the supported interpreters will satisfy the dependency. +# +# Example use: +# @CODE +# BDEPEND="${PYTHON_DEPS}" +# @CODE +# +# Example value: +# @CODE +# || ( dev-lang/python:2.7[gdbm] +# dev-lang/python:2.6[gdbm] ) +# @CODE + +# @ECLASS-VARIABLE: PYTHON_USEDEP +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# An eclass-generated USE-dependency string for the currently tested +# implementation. It is set locally for python_check_deps() call. +# +# The generated USE-flag list is compatible with packages using +# python-r1 eclass. For python-single-r1 dependencies, +# use PYTHON_SINGLE_USEDEP. +# +# Example use: +# @CODE +# python_check_deps() { +# has_version "dev-python/foo[${PYTHON_USEDEP}]" +# } +# @CODE +# +# Example value: +# @CODE +# python_targets_python3_7(-) +# @CODE + +# @ECLASS-VARIABLE: PYTHON_SINGLE_USEDEP +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# An eclass-generated USE-dependency string for the currently tested +# implementation. It is set locally for python_check_deps() call. +# +# The generated USE-flag list is compatible with packages using +# python-single-r1 eclass. For python-r1 dependencies, +# use PYTHON_USEDEP. +# +# Example use: +# @CODE +# python_check_deps() { +# has_version "dev-python/bar[${PYTHON_SINGLE_USEDEP}]" +# } +# @CODE +# +# Example value: +# @CODE +# python_single_target_python3_7(-) +# @CODE + +_python_any_set_globals() { + local usestr deps i PYTHON_PKG_DEP + [[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]" + + _PYTHON_ALLOW_PY27=1 \ + _python_set_impls + + for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do + _python_export "${i}" PYTHON_PKG_DEP + + # note: need to strip '=' slot operator for || deps + deps="${PYTHON_PKG_DEP/:0=/:0} ${deps}" + done + deps="|| ( ${deps})" + + if [[ ${PYTHON_DEPS+1} ]]; then + if [[ ${PYTHON_DEPS} != "${deps}" ]]; then + eerror "PYTHON_DEPS have changed between inherits (PYTHON_REQ_USE?)!" + eerror "Before: ${PYTHON_DEPS}" + eerror "Now : ${deps}" + die "PYTHON_DEPS integrity check failed" + fi + else + PYTHON_DEPS=${deps} + readonly PYTHON_DEPS + fi + + if [[ ! ${PYTHON_REQUIRED_USE+1} ]]; then + # fake var to catch mistaken usage + PYTHON_REQUIRED_USE='I-DO-NOT-EXIST-IN-PYTHON-ANY-R1' + readonly PYTHON_REQUIRED_USE + fi +} +_python_any_set_globals +unset -f _python_any_set_globals + +if [[ ! ${_PYTHON_ANY_R1} ]]; then + +# @FUNCTION: python_gen_any_dep +# @USAGE: <dependency-block> +# @DESCRIPTION: +# Generate an any-of dependency that enforces a version match between +# the Python interpreter and Python packages. <dependency-block> needs +# to list one or more dependencies with verbatim '${PYTHON_USEDEP}' +# or '${PYTHON_SINGLE_USEDEP}' references (quoted!) that will get +# expanded inside the function. +# +# This should be used along with an appropriate python_check_deps() +# that checks which of the any-of blocks were matched. +# +# Example use: +# @CODE +# BDEPEND="$(python_gen_any_dep ' +# dev-python/foo[${PYTHON_SINGLE_USEDEP}] +# || ( dev-python/bar[${PYTHON_USEDEP}] +# dev-python/baz[${PYTHON_USEDEP}] )')" +# +# python_check_deps() { +# has_version "dev-python/foo[${PYTHON_SINGLE_USEDEP}]" \ +# && { has_version "dev-python/bar[${PYTHON_USEDEP}]" \ +# || has_version "dev-python/baz[${PYTHON_USEDEP}]"; } +# } +# @CODE +# +# Example value: +# @CODE +# || ( +# ( +# dev-lang/python:3.7 +# dev-python/foo[python_single_target_python3_7(-)] +# || ( dev-python/bar[python_targets_python3_7(-) +# dev-python/baz[python_targets_python3_7(-) ) +# ) +# ( +# dev-lang/python:3.8 +# dev-python/foo[python_single_target_python3_8(-)] +# || ( dev-python/bar[python_targets_python3_8(-)] +# dev-python/baz[python_targets_python3_8(-)] ) +# ) +# ) +# @CODE +python_gen_any_dep() { + debug-print-function ${FUNCNAME} "${@}" + + local depstr=${1} + [[ ${depstr} ]] || die "No dependency string provided" + + local i PYTHON_PKG_DEP out= + for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do + local PYTHON_USEDEP="python_targets_${i}(-)" + local PYTHON_SINGLE_USEDEP="python_single_target_${i}(-)" + _python_export "${i}" PYTHON_PKG_DEP + + local i_depstr=${depstr//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}} + i_depstr=${i_depstr//\$\{PYTHON_SINGLE_USEDEP\}/${PYTHON_SINGLE_USEDEP}} + # note: need to strip '=' slot operator for || deps + out="( ${PYTHON_PKG_DEP%=} ${i_depstr} ) ${out}" + done + echo "|| ( ${out})" +} + +# @FUNCTION: _python_EPYTHON_supported +# @USAGE: <epython> +# @INTERNAL +# @DESCRIPTION: +# Check whether the specified implementation is supported by package +# (specified in PYTHON_COMPAT). Calls python_check_deps() if declared. +_python_EPYTHON_supported() { + debug-print-function ${FUNCNAME} "${@}" + + local EPYTHON=${1} + local i=${EPYTHON/./_} + + case "${i}" in + python*|jython*|pypy*) + ;; + *) + ewarn "Invalid EPYTHON: ${EPYTHON}" + return 1 + ;; + esac + + if has "${i}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then + if python_is_installed "${i}"; then + if declare -f python_check_deps >/dev/null; then + local PYTHON_USEDEP="python_targets_${i}(-)" + local PYTHON_SINGLE_USEDEP="python_single_target_${i}(-)" + python_check_deps + return ${?} + fi + + return 0 + fi + elif ! has "${i}" "${_PYTHON_ALL_IMPLS[@]}"; then + ewarn "Invalid EPYTHON: ${EPYTHON}" + fi + return 1 +} + +# @FUNCTION: python_setup +# @DESCRIPTION: +# Determine what the best installed (and supported) Python +# implementation is, and set the Python build environment up for it. +# +# This function will call python_check_deps() if defined. +python_setup() { + debug-print-function ${FUNCNAME} "${@}" + + # support developer override + if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then + local impls=( ${PYTHON_COMPAT_OVERRIDE} ) + [[ ${#impls[@]} -eq 1 ]] || die "PYTHON_COMPAT_OVERRIDE must name exactly one implementation for python-any-r1" + + ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python" + ewarn "implementation will be used:" + ewarn + ewarn " ${PYTHON_COMPAT_OVERRIDE}" + ewarn + ewarn "Dependencies won't be satisfied, and EPYTHON/eselect-python will be ignored." + + _python_export "${impls[0]}" EPYTHON PYTHON + _python_wrapper_setup + einfo "Using ${EPYTHON} to build" + return + fi + + # first, try ${EPYTHON}... maybe it's good enough for us. + if [[ ${EPYTHON} ]]; then + if _python_EPYTHON_supported "${EPYTHON}"; then + _python_export EPYTHON PYTHON + _python_wrapper_setup + einfo "Using ${EPYTHON} to build" + return + fi + fi + + # fallback to best installed impl. + # (reverse iteration over _PYTHON_SUPPORTED_IMPLS) + for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do + _python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON + if _python_EPYTHON_supported "${EPYTHON}"; then + _python_wrapper_setup + einfo "Using ${EPYTHON} to build" + return + fi + done + + eerror "No Python implementation found for the build. This is usually" + eerror "a bug in the ebuild. Please report it to bugs.gentoo.org" + eerror "along with the build log." + echo + die "No supported Python implementation installed." +} + +# @FUNCTION: python-any-r1_pkg_setup +# @DESCRIPTION: +# Runs python_setup during from-source installs. +# +# In a binary package installs is a no-op. If you need Python in pkg_* +# phases of a binary package, call python_setup directly. +python-any-r1_pkg_setup() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${MERGE_TYPE} != binary ]] && python_setup +} + +_PYTHON_ANY_R1=1 +fi diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass new file mode 100644 index 0000000..ff5b350 --- /dev/null +++ b/eclass/python-utils-r1.eclass @@ -0,0 +1,1351 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: python-utils-r1.eclass +# @MAINTAINER: +# Python team <python@gentoo.org> +# @AUTHOR: +# Author: Michał Górny <mgorny@gentoo.org> +# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org> +# @SUPPORTED_EAPIS: 6 7 8 +# @BLURB: Utility functions for packages with Python parts. +# @DESCRIPTION: +# A utility eclass providing functions to query Python implementations, +# install Python modules and scripts. +# +# This eclass does not set any metadata variables nor export any phase +# functions. It can be inherited safely. +# +# For more information, please see the Python Guide: +# https://dev.gentoo.org/~mgorny/python-guide/ + +# NOTE: When dropping support for EAPIs here, we need to update +# metadata/install-qa-check.d/60python-pyc +# See bug #704286, bug #781878 +case "${EAPI:-0}" in + [0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;; + [6-8]) ;; + *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;; +esac + +if [[ ${_PYTHON_ECLASS_INHERITED} ]]; then + die 'python-r1 suite eclasses can not be used with python.eclass.' +fi + +if [[ ! ${_PYTHON_UTILS_R1} ]]; then + +[[ ${EAPI} == [67] ]] && inherit eapi8-dosym +inherit multiprocessing toolchain-funcs + +# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS +# @INTERNAL +# @DESCRIPTION: +# All supported Python implementations, most preferred last. +_PYTHON_ALL_IMPLS=( + pypy3 + python3_{8..10} +) +readonly _PYTHON_ALL_IMPLS + +# @ECLASS-VARIABLE: _PYTHON_HISTORICAL_IMPLS +# @INTERNAL +# @DESCRIPTION: +# All historical Python implementations that are no longer supported. +_PYTHON_HISTORICAL_IMPLS=( + jython2_7 + pypy pypy1_{8,9} pypy2_0 + python2_{5..7} + python3_{1..7} +) +readonly _PYTHON_HISTORICAL_IMPLS + +# @ECLASS-VARIABLE: PYTHON_COMPAT_NO_STRICT +# @INTERNAL +# @DESCRIPTION: +# Set to a non-empty value in order to make eclass tolerate (ignore) +# unknown implementations in PYTHON_COMPAT. +# +# This is intended to be set by the user when using ebuilds that may +# have unknown (newer) implementations in PYTHON_COMPAT. The assumption +# is that the ebuilds are intended to be used within multiple contexts +# which can involve revisions of this eclass that support a different +# set of Python implementations. + +# @FUNCTION: _python_verify_patterns +# @USAGE: <pattern>... +# @INTERNAL +# @DESCRIPTION: +# Verify whether the patterns passed to the eclass function are correct +# (i.e. can match any valid implementation). Dies on wrong pattern. +_python_verify_patterns() { + debug-print-function ${FUNCNAME} "${@}" + + local impl pattern + for pattern; do + [[ ${pattern} == -[23] ]] && continue + + for impl in "${_PYTHON_ALL_IMPLS[@]}" "${_PYTHON_HISTORICAL_IMPLS[@]}" + do + [[ ${impl} == ${pattern/./_} ]] && continue 2 + done + + die "Invalid implementation pattern: ${pattern}" + done +} + +# @FUNCTION: _python_set_impls +# @INTERNAL +# @DESCRIPTION: +# Check PYTHON_COMPAT for well-formedness and validity, then set +# two global variables: +# +# - _PYTHON_SUPPORTED_IMPLS containing valid implementations supported +# by the ebuild (PYTHON_COMPAT - dead implementations), +# +# - and _PYTHON_UNSUPPORTED_IMPLS containing valid implementations that +# are not supported by the ebuild. +# +# Implementations in both variables are ordered using the pre-defined +# eclass implementation ordering. +# +# This function must be called once in global scope by an eclass +# utilizing PYTHON_COMPAT. +_python_set_impls() { + local i + + if ! declare -p PYTHON_COMPAT &>/dev/null; then + die 'PYTHON_COMPAT not declared.' + fi + if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then + die 'PYTHON_COMPAT must be an array.' + fi + if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then + for i in "${PYTHON_COMPAT[@]}"; do + # check for incorrect implementations + # we're using pattern matching as an optimization + # please keep them in sync with _PYTHON_ALL_IMPLS + # and _PYTHON_HISTORICAL_IMPLS + case ${i} in + jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]|python3_10) + ;; + *) + if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \ + "${_PYTHON_HISTORICAL_IMPLS[@]}" + then + die "Mis-synced patterns in _python_set_impls: missing ${i}" + else + die "Invalid implementation in PYTHON_COMPAT: ${i}" + fi + esac + done + fi + + local supp=() unsupp=() + + for i in "${_PYTHON_ALL_IMPLS[@]}"; do + if has "${i}" "${PYTHON_COMPAT[@]}"; then + supp+=( "${i}" ) + else + unsupp+=( "${i}" ) + fi + done + + if [[ ! ${supp[@]} ]]; then + # special-case python2_7 for python-any-r1 + if [[ ${_PYTHON_ALLOW_PY27} ]] && has python2_7 "${PYTHON_COMPAT[@]}" + then + supp+=( python2_7 ) + else + die "No supported implementation in PYTHON_COMPAT." + fi + fi + + if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then + # set once already, verify integrity + if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} != ${supp[@]} ]]; then + eerror "Supported impls (PYTHON_COMPAT) changed between inherits!" + eerror "Before: ${_PYTHON_SUPPORTED_IMPLS[*]}" + eerror "Now : ${supp[*]}" + die "_PYTHON_SUPPORTED_IMPLS integrity check failed" + fi + if [[ ${_PYTHON_UNSUPPORTED_IMPLS[@]} != ${unsupp[@]} ]]; then + eerror "Unsupported impls changed between inherits!" + eerror "Before: ${_PYTHON_UNSUPPORTED_IMPLS[*]}" + eerror "Now : ${unsupp[*]}" + die "_PYTHON_UNSUPPORTED_IMPLS integrity check failed" + fi + else + _PYTHON_SUPPORTED_IMPLS=( "${supp[@]}" ) + _PYTHON_UNSUPPORTED_IMPLS=( "${unsupp[@]}" ) + readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS + fi +} + +# @FUNCTION: _python_impl_matches +# @USAGE: <impl> [<pattern>...] +# @INTERNAL +# @DESCRIPTION: +# Check whether the specified <impl> matches at least one +# of the patterns following it. Return 0 if it does, 1 otherwise. +# Matches if no patterns are provided. +# +# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns +# are fnmatch-style. +_python_impl_matches() { + [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter" + [[ ${#} -eq 1 ]] && return 0 + + local impl=${1} pattern + shift + + for pattern; do + case ${pattern} in + -2|python2*|pypy) + if [[ ${EAPI} != [67] ]]; then + eerror + eerror "Python 2 is no longer supported in Gentoo, please remove Python 2" + eerror "${FUNCNAME[1]} calls." + die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}" + fi + ;; + -3) + # NB: "python3*" is fine, as "not pypy3" + if [[ ${EAPI} != [67] ]]; then + eerror + eerror "Python 2 is no longer supported in Gentoo, please remove Python 2" + eerror "${FUNCNAME[1]} calls." + die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}" + fi + return 0 + ;; + *) + # unify value style to allow lax matching + [[ ${impl/./_} == ${pattern/./_} ]] && return 0 + ;; + esac + done + + return 1 +} + +# @ECLASS-VARIABLE: PYTHON +# @DEFAULT_UNSET +# @DESCRIPTION: +# The absolute path to the current Python interpreter. +# +# This variable is set automatically in the following contexts: +# +# python-r1: Set in functions called by python_foreach_impl() or after +# calling python_setup(). +# +# python-single-r1: Set after calling python-single-r1_pkg_setup(). +# +# distutils-r1: Set within any of the python sub-phase functions. +# +# Example value: +# @CODE +# /usr/bin/python2.7 +# @CODE + +# @ECLASS-VARIABLE: EPYTHON +# @DEFAULT_UNSET +# @DESCRIPTION: +# The executable name of the current Python interpreter. +# +# This variable is set automatically in the following contexts: +# +# python-r1: Set in functions called by python_foreach_impl() or after +# calling python_setup(). +# +# python-single-r1: Set after calling python-single-r1_pkg_setup(). +# +# distutils-r1: Set within any of the python sub-phase functions. +# +# Example value: +# @CODE +# python2.7 +# @CODE + +# @FUNCTION: python_export +# @USAGE: [<impl>] <variables>... +# @INTERNAL +# @DESCRIPTION: +# Backwards compatibility function. The relevant API is now considered +# private, please use python_get* instead. +python_export() { + debug-print-function ${FUNCNAME} "${@}" + + eqawarn "python_export() is part of private eclass API." + eqawarn "Please call python_get*() instead." + + [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}" + + _python_export "${@}" +} + +# @FUNCTION: _python_export +# @USAGE: [<impl>] <variables>... +# @INTERNAL +# @DESCRIPTION: +# Set and export the Python implementation-relevant variables passed +# as parameters. +# +# The optional first parameter may specify the requested Python +# implementation (either as PYTHON_TARGETS value, e.g. python2_7, +# or an EPYTHON one, e.g. python2.7). If no implementation passed, +# the current one will be obtained from ${EPYTHON}. +# +# The variables which can be exported are: PYTHON, EPYTHON, +# PYTHON_SITEDIR. They are described more completely in the eclass +# variable documentation. +_python_export() { + debug-print-function ${FUNCNAME} "${@}" + + local impl var + + case "${1}" in + python*|jython*) + impl=${1/_/.} + shift + ;; + pypy|pypy3) + impl=${1} + shift + ;; + *) + impl=${EPYTHON} + if [[ -z ${impl} ]]; then + die "_python_export called without a python implementation and EPYTHON is unset" + fi + ;; + esac + debug-print "${FUNCNAME}: implementation: ${impl}" + + for var; do + case "${var}" in + EPYTHON) + export EPYTHON=${impl} + debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}" + ;; + PYTHON) + export PYTHON=${EPREFIX}/usr/bin/${impl} + debug-print "${FUNCNAME}: PYTHON = ${PYTHON}" + ;; + PYTHON_SITEDIR) + [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" + PYTHON_SITEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("purelib"))') || die + export PYTHON_SITEDIR + debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}" + ;; + PYTHON_INCLUDEDIR) + [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" + PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("platinclude"))') || die + export PYTHON_INCLUDEDIR + debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}" + + # Jython gives a non-existing directory + if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then + die "${impl} does not install any header files!" + fi + ;; + PYTHON_LIBPATH) + [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" + PYTHON_LIBPATH=$("${PYTHON}" -c 'import os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else "")') || die + export PYTHON_LIBPATH + debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}" + + if [[ ! ${PYTHON_LIBPATH} ]]; then + die "${impl} lacks a (usable) dynamic library" + fi + ;; + PYTHON_CFLAGS) + local val + + case "${impl}" in + python*) + # python-2.7, python-3.2, etc. + val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) || die + ;; + *) + die "${impl}: obtaining ${var} not supported" + ;; + esac + + export PYTHON_CFLAGS=${val} + debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}" + ;; + PYTHON_LIBS) + local val + + case "${impl}" in + python2*|python3.6|python3.7*) + # python* up to 3.7 + val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die + ;; + python*) + # python3.8+ + val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}-embed) || die + ;; + *) + die "${impl}: obtaining ${var} not supported" + ;; + esac + + export PYTHON_LIBS=${val} + debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}" + ;; + PYTHON_CONFIG) + local flags val + + case "${impl}" in + python*) + [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" + flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die + val=${PYTHON}${flags}-config + ;; + *) + die "${impl}: obtaining ${var} not supported" + ;; + esac + + export PYTHON_CONFIG=${val} + debug-print "${FUNCNAME}: PYTHON_CONFIG = ${PYTHON_CONFIG}" + ;; + PYTHON_PKG_DEP) + local d + case ${impl} in + python2.7) + PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';; + python3.8) + PYTHON_PKG_DEP=">=dev-lang/python-3.8.12_p1-r1:3.8";; + python3.9) + PYTHON_PKG_DEP=">=dev-lang/python-3.9.9-r1:3.9";; + python3.10) + PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";; + python*) + PYTHON_PKG_DEP="dev-lang/python:${impl#python}";; + pypy) + PYTHON_PKG_DEP='>=dev-python/pypy-7.3.0:0=';; + pypy3) + PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.7-r1:0=';; + *) + die "Invalid implementation: ${impl}" + esac + + # use-dep + if [[ ${PYTHON_REQ_USE} ]]; then + PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}] + fi + + export PYTHON_PKG_DEP + debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}" + ;; + PYTHON_SCRIPTDIR) + local dir + export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl} + debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}" + ;; + *) + die "_python_export: unknown variable ${var}" + esac + done +} + +# @FUNCTION: python_get_sitedir +# @USAGE: [<impl>] +# @DESCRIPTION: +# Obtain and print the 'site-packages' path for the given +# implementation. If no implementation is provided, ${EPYTHON} will +# be used. +python_get_sitedir() { + debug-print-function ${FUNCNAME} "${@}" + + _python_export "${@}" PYTHON_SITEDIR + echo "${PYTHON_SITEDIR}" +} + +# @FUNCTION: python_get_includedir +# @USAGE: [<impl>] +# @DESCRIPTION: +# Obtain and print the include path for the given implementation. If no +# implementation is provided, ${EPYTHON} will be used. +python_get_includedir() { + debug-print-function ${FUNCNAME} "${@}" + + _python_export "${@}" PYTHON_INCLUDEDIR + echo "${PYTHON_INCLUDEDIR}" +} + +# @FUNCTION: python_get_library_path +# @USAGE: [<impl>] +# @DESCRIPTION: +# Obtain and print the Python library path for the given implementation. +# If no implementation is provided, ${EPYTHON} will be used. +# +# Please note that this function can be used with CPython only. Use +# in another implementation will result in a fatal failure. +python_get_library_path() { + debug-print-function ${FUNCNAME} "${@}" + + _python_export "${@}" PYTHON_LIBPATH + echo "${PYTHON_LIBPATH}" +} + +# @FUNCTION: python_get_CFLAGS +# @USAGE: [<impl>] +# @DESCRIPTION: +# Obtain and print the compiler flags for building against Python, +# for the given implementation. If no implementation is provided, +# ${EPYTHON} will be used. +# +# Please note that this function can be used with CPython only. +# It requires Python and pkg-config installed, and therefore proper +# build-time dependencies need be added to the ebuild. +python_get_CFLAGS() { + debug-print-function ${FUNCNAME} "${@}" + + _python_export "${@}" PYTHON_CFLAGS + echo "${PYTHON_CFLAGS}" +} + +# @FUNCTION: python_get_LIBS +# @USAGE: [<impl>] +# @DESCRIPTION: +# Obtain and print the compiler flags for linking against Python, +# for the given implementation. If no implementation is provided, +# ${EPYTHON} will be used. +# +# Please note that this function can be used with CPython only. +# It requires Python and pkg-config installed, and therefore proper +# build-time dependencies need be added to the ebuild. +python_get_LIBS() { + debug-print-function ${FUNCNAME} "${@}" + + _python_export "${@}" PYTHON_LIBS + echo "${PYTHON_LIBS}" +} + +# @FUNCTION: python_get_PYTHON_CONFIG +# @USAGE: [<impl>] +# @DESCRIPTION: +# Obtain and print the PYTHON_CONFIG location for the given +# implementation. If no implementation is provided, ${EPYTHON} will be +# used. +# +# Please note that this function can be used with CPython only. +# It requires Python installed, and therefore proper build-time +# dependencies need be added to the ebuild. +python_get_PYTHON_CONFIG() { + debug-print-function ${FUNCNAME} "${@}" + + _python_export "${@}" PYTHON_CONFIG + echo "${PYTHON_CONFIG}" +} + +# @FUNCTION: python_get_scriptdir +# @USAGE: [<impl>] +# @DESCRIPTION: +# Obtain and print the script install path for the given +# implementation. If no implementation is provided, ${EPYTHON} will +# be used. +python_get_scriptdir() { + debug-print-function ${FUNCNAME} "${@}" + + _python_export "${@}" PYTHON_SCRIPTDIR + echo "${PYTHON_SCRIPTDIR}" +} + +# @FUNCTION: python_optimize +# @USAGE: [<directory>...] +# @DESCRIPTION: +# Compile and optimize Python modules in specified directories (absolute +# paths). If no directories are provided, the default system paths +# are used (prepended with ${D}). +python_optimize() { + debug-print-function ${FUNCNAME} "${@}" + + if [[ ${EBUILD_PHASE} == pre* || ${EBUILD_PHASE} == post* ]]; then + eerror "The new Python eclasses expect the compiled Python files to" + eerror "be controlled by the Package Manager. For this reason," + eerror "the python_optimize function can be used only during src_* phases" + eerror "(src_install most commonly) and not during pkg_* phases." + echo + die "python_optimize is not to be used in pre/post* phases" + fi + + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + + local PYTHON=${PYTHON} + [[ ${PYTHON} ]] || _python_export PYTHON + [[ -x ${PYTHON} ]] || die "PYTHON (${PYTHON}) is not executable" + + # default to sys.path + if [[ ${#} -eq 0 ]]; then + local f + while IFS= read -r -d '' f; do + # 1) accept only absolute paths + # (i.e. skip '', '.' or anything like that) + # 2) skip paths which do not exist + # (python2.6 complains about them verbosely) + + if [[ ${f} == /* && -d ${D%/}${f} ]]; then + set -- "${D%/}${f}" "${@}" + fi + done < <("${PYTHON}" -c 'import sys; print("".join(x + "\0" for x in sys.path))' || die) + + debug-print "${FUNCNAME}: using sys.path: ${*/%/;}" + fi + + local jobs=$(makeopts_jobs "${MAKEOPTS}" INF) + [[ ${jobs} == INF ]] && jobs=$(get_nproc) + + local d + for d; do + # make sure to get a nice path without // + local instpath=${d#${D%/}} + instpath=/${instpath##/} + + case "${EPYTHON}" in + python2.7|python3.[34]) + "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" + "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}" + ;; + python3.[5678]|pypy3) + # both levels of optimization are separate since 3.5 + "${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" + "${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" + "${PYTHON}" -OO -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" + ;; + python*) + "${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}" + ;; + *) + "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" + ;; + esac + done +} + +# @FUNCTION: python_scriptinto +# @USAGE: <new-path> +# @DESCRIPTION: +# Set the directory to which files passed to python_doexe(), +# python_doscript(), python_newexe() and python_newscript() +# are going to be installed. The new value needs to be relative +# to the installation root (${ED}). +# +# If not set explicitly, the directory defaults to /usr/bin. +# +# Example: +# @CODE +# src_install() { +# python_scriptinto /usr/sbin +# python_foreach_impl python_doscript foo +# } +# @CODE +python_scriptinto() { + debug-print-function ${FUNCNAME} "${@}" + + _PYTHON_SCRIPTROOT=${1} +} + +# @FUNCTION: python_doexe +# @USAGE: <files>... +# @DESCRIPTION: +# Install the given executables into the executable install directory, +# for the current Python implementation (${EPYTHON}). +# +# The executable will be wrapped properly for the Python implementation, +# though no shebang mangling will be performed. +python_doexe() { + debug-print-function ${FUNCNAME} "${@}" + + local f + for f; do + python_newexe "${f}" "${f##*/}" + done +} + +# @FUNCTION: python_newexe +# @USAGE: <path> <new-name> +# @DESCRIPTION: +# Install the given executable into the executable install directory, +# for the current Python implementation (${EPYTHON}). +# +# The executable will be wrapped properly for the Python implementation, +# though no shebang mangling will be performed. It will be renamed +# to <new-name>. +python_newexe() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>" + + local wrapd=${_PYTHON_SCRIPTROOT:-/usr/bin} + + local f=${1} + local newfn=${2} + + local scriptdir=$(python_get_scriptdir) + local d=${scriptdir#${EPREFIX}} + + ( + dodir "${wrapd}" + exeopts -m 0755 + exeinto "${d}" + newexe "${f}" "${newfn}" || return ${?} + ) + + # install the wrapper + local dosym=dosym + [[ ${EAPI} == [67] ]] && dosym=dosym8 + "${dosym}" -r /usr/lib/python-exec/python-exec2 "${wrapd}/${newfn}" + + # don't use this at home, just call python_doscript() instead + if [[ ${_PYTHON_REWRITE_SHEBANG} ]]; then + python_fix_shebang -q "${ED%/}/${d}/${newfn}" + fi +} + +# @FUNCTION: python_doscript +# @USAGE: <files>... +# @DESCRIPTION: +# Install the given scripts into the executable install directory, +# for the current Python implementation (${EPYTHON}). +# +# All specified files must start with a 'python' shebang. The shebang +# will be converted, and the files will be wrapped properly +# for the Python implementation. +# +# Example: +# @CODE +# src_install() { +# python_foreach_impl python_doscript ${PN} +# } +# @CODE +python_doscript() { + debug-print-function ${FUNCNAME} "${@}" + + local _PYTHON_REWRITE_SHEBANG=1 + python_doexe "${@}" +} + +# @FUNCTION: python_newscript +# @USAGE: <path> <new-name> +# @DESCRIPTION: +# Install the given script into the executable install directory +# for the current Python implementation (${EPYTHON}), and name it +# <new-name>. +# +# The file must start with a 'python' shebang. The shebang will be +# converted, and the file will be wrapped properly for the Python +# implementation. It will be renamed to <new-name>. +# +# Example: +# @CODE +# src_install() { +# python_foreach_impl python_newscript foo.py foo +# } +# @CODE +python_newscript() { + debug-print-function ${FUNCNAME} "${@}" + + local _PYTHON_REWRITE_SHEBANG=1 + python_newexe "${@}" +} + +# @FUNCTION: python_moduleinto +# @USAGE: <new-path> +# @DESCRIPTION: +# Set the Python module install directory for python_domodule(). +# The <new-path> can either be an absolute target system path (in which +# case it needs to start with a slash, and ${ED} will be prepended to +# it) or relative to the implementation's site-packages directory +# (then it must not start with a slash). The relative path can be +# specified either using the Python package notation (separated by dots) +# or the directory notation (using slashes). +# +# When not set explicitly, the modules are installed to the top +# site-packages directory. +# +# In the relative case, the exact path is determined directly +# by each python_doscript/python_newscript function. Therefore, +# python_moduleinto can be safely called before establishing the Python +# interpreter and/or a single call can be used to set the path correctly +# for multiple implementations, as can be seen in the following example. +# +# Example: +# @CODE +# src_install() { +# python_moduleinto bar +# # installs ${PYTHON_SITEDIR}/bar/baz.py +# python_foreach_impl python_domodule baz.py +# } +# @CODE +python_moduleinto() { + debug-print-function ${FUNCNAME} "${@}" + + _PYTHON_MODULEROOT=${1} +} + +# @FUNCTION: python_domodule +# @USAGE: <files>... +# @DESCRIPTION: +# Install the given modules (or packages) into the current Python module +# installation directory. The list can mention both modules (files) +# and packages (directories). All listed files will be installed +# for all enabled implementations, and compiled afterwards. +# +# Example: +# @CODE +# src_install() { +# # (${PN} being a directory) +# python_foreach_impl python_domodule ${PN} +# } +# @CODE +python_domodule() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + + local d + if [[ ${_PYTHON_MODULEROOT} == /* ]]; then + # absolute path + d=${_PYTHON_MODULEROOT} + else + # relative to site-packages + local sitedir=$(python_get_sitedir) + d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//} + fi + + ( + insopts -m 0644 + insinto "${d}" + doins -r "${@}" || return ${?} + ) + + python_optimize "${ED%/}/${d}" +} + +# @FUNCTION: python_doheader +# @USAGE: <files>... +# @DESCRIPTION: +# Install the given headers into the implementation-specific include +# directory. This function is unconditionally recursive, i.e. you can +# pass directories instead of files. +# +# Example: +# @CODE +# src_install() { +# python_foreach_impl python_doheader foo.h bar.h +# } +# @CODE +python_doheader() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + + local includedir=$(python_get_includedir) + local d=${includedir#${EPREFIX}} + + ( + insopts -m 0644 + insinto "${d}" + doins -r "${@}" || return ${?} + ) +} + +# @FUNCTION: python_wrapper_setup +# @USAGE: [<path> [<impl>]] +# @DESCRIPTION: +# Backwards compatibility function. The relevant API is now considered +# private, please use python_setup instead. +python_wrapper_setup() { + debug-print-function ${FUNCNAME} "${@}" + + eqawarn "python_wrapper_setup() is part of private eclass API." + eqawarn "Please call python_setup() instead." + + [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}" + + _python_wrapper_setup "${@}" +} + +# @FUNCTION: _python_wrapper_setup +# @USAGE: [<path> [<impl>]] +# @INTERNAL +# @DESCRIPTION: +# Create proper 'python' executable and pkg-config wrappers +# (if available) in the directory named by <path>. Set up PATH +# and PKG_CONFIG_PATH appropriately. <path> defaults to ${T}/${EPYTHON}. +# +# The wrappers will be created for implementation named by <impl>, +# or for one named by ${EPYTHON} if no <impl> passed. +# +# If the named directory contains a python symlink already, it will +# be assumed to contain proper wrappers already and only environment +# setup will be done. If wrapper update is requested, the directory +# shall be removed first. +_python_wrapper_setup() { + debug-print-function ${FUNCNAME} "${@}" + + local workdir=${1:-${T}/${EPYTHON}} + local impl=${2:-${EPYTHON}} + + [[ ${workdir} ]] || die "${FUNCNAME}: no workdir specified." + [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON specified." + + if [[ ! -x ${workdir}/bin/python ]]; then + mkdir -p "${workdir}"/{bin,pkgconfig} || die + + # Clean up, in case we were supposed to do a cheap update. + rm -f "${workdir}"/bin/python{,2,3}{,-config} || die + rm -f "${workdir}"/bin/2to3 || die + rm -f "${workdir}"/pkgconfig/python{2,3}{,-embed}.pc || die + + local EPYTHON PYTHON + _python_export "${impl}" EPYTHON PYTHON + + local pyver pyother + if [[ ${EPYTHON} != python2* ]]; then + pyver=3 + pyother=2 + else + pyver=2 + pyother=3 + fi + + # Python interpreter + # note: we don't use symlinks because python likes to do some + # symlink reading magic that breaks stuff + # https://bugs.gentoo.org/show_bug.cgi?id=555752 + cat > "${workdir}/bin/python" <<-_EOF_ || die + #!/bin/sh + exec "${PYTHON}" "\${@}" + _EOF_ + cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die + chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die + + local nonsupp=( "python${pyother}" "python${pyother}-config" ) + + # CPython-specific + if [[ ${EPYTHON} == python* ]]; then + cat > "${workdir}/bin/python-config" <<-_EOF_ || die + #!/bin/sh + exec "${PYTHON}-config" "\${@}" + _EOF_ + cp "${workdir}/bin/python-config" \ + "${workdir}/bin/python${pyver}-config" || die + chmod +x "${workdir}/bin/python-config" \ + "${workdir}/bin/python${pyver}-config" || die + + # Python 2.6+. + ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die + + # Python 2.7+. + ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc \ + "${workdir}"/pkgconfig/python${pyver}.pc || die + + # Python 3.8+. + if [[ ${EPYTHON} != python[23].[67] ]]; then + ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \ + "${workdir}"/pkgconfig/python${pyver}-embed.pc || die + fi + else + nonsupp+=( 2to3 python-config "python${pyver}-config" ) + fi + + local x + for x in "${nonsupp[@]}"; do + cat >"${workdir}"/bin/${x} <<-_EOF_ || die + #!/bin/sh + echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${EPYTHON} (PYTHON_COMPAT)" >&2 + exit 127 + _EOF_ + chmod +x "${workdir}"/bin/${x} || die + done + fi + + # Now, set the environment. + # But note that ${workdir} may be shared with something else, + # and thus already on top of PATH. + if [[ ${PATH##:*} != ${workdir}/bin ]]; then + PATH=${workdir}/bin${PATH:+:${PATH}} + fi + if [[ ${PKG_CONFIG_PATH##:*} != ${workdir}/pkgconfig ]]; then + PKG_CONFIG_PATH=${workdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} + fi + export PATH PKG_CONFIG_PATH +} + +# @FUNCTION: python_is_python3 +# @USAGE: [<impl>] +# @DESCRIPTION: +# Check whether <impl> (or ${EPYTHON}) is a Python3k variant +# (i.e. uses syntax and stdlib of Python 3.*). +# +# Returns 0 (true) if it is, 1 (false) otherwise. +python_is_python3() { + eqawarn "${FUNCNAME} is deprecated, as Python 2 is not supported anymore" + [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}" + + local impl=${1:-${EPYTHON}} + [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON" + + [[ ${impl} == python3* || ${impl} == pypy3 ]] +} + +# @FUNCTION: python_is_installed +# @USAGE: [<impl>] +# @DESCRIPTION: +# Check whether the interpreter for <impl> (or ${EPYTHON}) is installed. +# Uses has_version with a proper dependency string. +# +# Returns 0 (true) if it is, 1 (false) otherwise. +python_is_installed() { + local impl=${1:-${EPYTHON}} + [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON" + local hasv_args=( -b ) + [[ ${EAPI} == 6 ]] && hasv_args=( --host-root ) + + local PYTHON_PKG_DEP + _python_export "${impl}" PYTHON_PKG_DEP + has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}" +} + +# @FUNCTION: python_fix_shebang +# @USAGE: [-f|--force] [-q|--quiet] <path>... +# @DESCRIPTION: +# Replace the shebang in Python scripts with the current Python +# implementation (EPYTHON). If a directory is passed, works recursively +# on all Python scripts. +# +# Only files having a 'python*' shebang will be modified. Files with +# other shebang will either be skipped when working recursively +# on a directory or treated as error when specified explicitly. +# +# Shebangs matching explicitly current Python version will be left +# unmodified. Shebangs requesting another Python version will be treated +# as fatal error, unless --force is given. +# +# --force causes the function to replace even shebangs that require +# incompatible Python version. --quiet causes the function not to list +# modified files verbosely. +python_fix_shebang() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)" + + local force quiet + while [[ ${@} ]]; do + case "${1}" in + -f|--force) force=1; shift;; + -q|--quiet) quiet=1; shift;; + --) shift; break;; + *) break;; + esac + done + + [[ ${1} ]] || die "${FUNCNAME}: no paths given" + + local path f + for path; do + local any_correct any_fixed is_recursive + + [[ -d ${path} ]] && is_recursive=1 + + while IFS= read -r -d '' f; do + local shebang i + local error= from= + + # note: we can't ||die here since read will fail if file + # has no newline characters + IFS= read -r shebang <"${f}" + + # First, check if it's shebang at all... + if [[ ${shebang} == '#!'* ]]; then + local split_shebang=() + read -r -a split_shebang <<<${shebang} || die + + # Match left-to-right in a loop, to avoid matching random + # repetitions like 'python2.7 python2'. + for i in "${split_shebang[@]}"; do + case "${i}" in + *"${EPYTHON}") + debug-print "${FUNCNAME}: in file ${f#${D%/}}" + debug-print "${FUNCNAME}: shebang matches EPYTHON: ${shebang}" + + # Nothing to do, move along. + any_correct=1 + from=${EPYTHON} + break + ;; + *python|*python[23]) + debug-print "${FUNCNAME}: in file ${f#${D%/}}" + debug-print "${FUNCNAME}: rewriting shebang: ${shebang}" + + if [[ ${i} == *python2 ]]; then + from=python2 + if [[ ! ${force} ]]; then + error=1 + fi + elif [[ ${i} == *python3 ]]; then + from=python3 + else + from=python + fi + break + ;; + *python[23].[0-9]|*python3.[1-9][0-9]|*pypy|*pypy3|*jython[23].[0-9]) + # Explicit mismatch. + if [[ ! ${force} ]]; then + error=1 + else + case "${i}" in + *python[23].[0-9]) + from="python[23].[0-9]";; + *python3.[1-9][0-9]) + from="python3.[1-9][0-9]";; + *pypy) + from="pypy";; + *pypy3) + from="pypy3";; + *jython[23].[0-9]) + from="jython[23].[0-9]";; + *) + die "${FUNCNAME}: internal error in 2nd pattern match";; + esac + fi + break + ;; + esac + done + fi + + if [[ ! ${error} && ! ${from} ]]; then + # Non-Python shebang. Allowed in recursive mode, + # disallowed when specifying file explicitly. + [[ ${is_recursive} ]] && continue + error=1 + fi + + if [[ ! ${quiet} ]]; then + einfo "Fixing shebang in ${f#${D%/}}." + fi + + if [[ ! ${error} ]]; then + # We either want to match ${from} followed by space + # or at end-of-string. + if [[ ${shebang} == *${from}" "* ]]; then + sed -i -e "1s:${from} :${EPYTHON} :" "${f}" || die + else + sed -i -e "1s:${from}$:${EPYTHON}:" "${f}" || die + fi + any_fixed=1 + else + eerror "The file has incompatible shebang:" + eerror " file: ${f#${D%/}}" + eerror " current shebang: ${shebang}" + eerror " requested impl: ${EPYTHON}" + die "${FUNCNAME}: conversion of incompatible shebang requested" + fi + done < <(find -H "${path}" -type f -print0 || die) + + if [[ ! ${any_fixed} ]]; then + eerror "QA error: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files." + if [[ ${any_correct} ]]; then + eerror "All files have ${EPYTHON} shebang already." + else + eerror "There are no Python files in specified directory." + fi + + die "${FUNCNAME} did not match any fixable files" + fi + done +} + +# @FUNCTION: _python_check_locale_sanity +# @USAGE: <locale> +# @RETURN: 0 if sane, 1 otherwise +# @INTERNAL +# @DESCRIPTION: +# Check whether the specified locale sanely maps between lowercase +# and uppercase ASCII characters. +_python_check_locale_sanity() { + local -x LC_ALL=${1} + local IFS= + + local lc=( {a..z} ) + local uc=( {A..Z} ) + local input="${lc[*]}${uc[*]}" + + local output=$(tr '[:lower:][:upper:]' '[:upper:][:lower:]' <<<"${input}") + [[ ${output} == "${uc[*]}${lc[*]}" ]] +} + +# @FUNCTION: python_export_utf8_locale +# @RETURN: 0 on success, 1 on failure. +# @DESCRIPTION: +# Attempts to export a usable UTF-8 locale in the LC_CTYPE variable. Does +# nothing if LC_ALL is defined, or if the current locale uses a UTF-8 charmap. +# This may be used to work around the quirky open() behavior of python3. +python_export_utf8_locale() { + debug-print-function ${FUNCNAME} "${@}" + + # If the locale program isn't available, just return. + type locale >/dev/null || return 0 + + if [[ $(locale charmap) != UTF-8 ]]; then + # Try English first, then everything else. + local lang locales="C.UTF-8 en_US.UTF-8 en_GB.UTF-8 $(locale -a)" + + for lang in ${locales}; do + if [[ $(LC_ALL=${lang} locale charmap 2>/dev/null) == UTF-8 ]]; then + if _python_check_locale_sanity "${lang}"; then + export LC_CTYPE=${lang} + if [[ -n ${LC_ALL} ]]; then + export LC_NUMERIC=${LC_ALL} + export LC_TIME=${LC_ALL} + export LC_COLLATE=${LC_ALL} + export LC_MONETARY=${LC_ALL} + export LC_MESSAGES=${LC_ALL} + export LC_PAPER=${LC_ALL} + export LC_NAME=${LC_ALL} + export LC_ADDRESS=${LC_ALL} + export LC_TELEPHONE=${LC_ALL} + export LC_MEASUREMENT=${LC_ALL} + export LC_IDENTIFICATION=${LC_ALL} + export LC_ALL= + fi + return 0 + fi + fi + done + + ewarn "Could not find a UTF-8 locale. This may trigger build failures in" + ewarn "some python packages. Please ensure that a UTF-8 locale is listed in" + ewarn "/etc/locale.gen and run locale-gen." + return 1 + fi + + return 0 +} + +# @FUNCTION: build_sphinx +# @USAGE: <directory> +# @DESCRIPTION: +# Build HTML documentation using dev-python/sphinx in the specified +# <directory>. Takes care of disabling Intersphinx and appending +# to HTML_DOCS. +# +# If <directory> is relative to the current directory, care needs +# to be taken to run einstalldocs from the same directory +# (usually ${S}). +build_sphinx() { + debug-print-function ${FUNCNAME} "${@}" + [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: <directory>" + + local dir=${1} + + sed -i -e 's:^intersphinx_mapping:disabled_&:' \ + "${dir}"/conf.py || die + # not all packages include the Makefile in pypi tarball + sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \ + "${dir}"/_build/html || die + + HTML_DOCS+=( "${dir}/_build/html/." ) +} + +# @FUNCTION: _python_check_EPYTHON +# @INTERNAL +# @DESCRIPTION: +# Check if EPYTHON is set, die if not. +_python_check_EPYTHON() { + if [[ -z ${EPYTHON} ]]; then + die "EPYTHON unset, invalid call context" + fi +} + +# @VARIABLE: EPYTEST_DESELECT +# @DEFAULT_UNSET +# @DESCRIPTION: +# Specifies an array of tests to be deselected via pytest's --deselect +# parameter, when calling epytest. The list can include file paths, +# specific test functions or parametrized test invocations. +# +# Note that the listed files will still be subject to collection, +# i.e. modules imported in global scope will need to be available. +# If this is undesirable, EPYTEST_IGNORE can be used instead. + +# @VARIABLE: EPYTEST_IGNORE +# @DEFAULT_UNSET +# @DESCRIPTION: +# Specifies an array of paths to be ignored via pytest's --ignore +# parameter, when calling epytest. The listed files will be entirely +# skipped from test collection. + +# @FUNCTION: epytest +# @USAGE: [<args>...] +# @DESCRIPTION: +# Run pytest, passing the standard set of pytest options, then +# --deselect and --ignore options based on EPYTEST_DESELECT +# and EPYTEST_IGNORE, then user-specified options. +# +# This command dies on failure and respects nonfatal. +epytest() { + debug-print-function ${FUNCNAME} "${@}" + + _python_check_EPYTHON + + local args=( + # verbose progress reporting and tracebacks + -vv + # list all non-passed tests in the summary for convenience + # (includes failures, skips, xfails...) + -ra + # print local variables in tracebacks, useful for debugging + -l + # override filterwarnings=error, we do not really want -Werror + # for end users, as it tends to fail on new warnings from deps + -Wdefault + ) + local x + for x in "${EPYTEST_DESELECT[@]}"; do + args+=( --deselect "${x}" ) + done + for x in "${EPYTEST_IGNORE[@]}"; do + args+=( --ignore "${x}" ) + done + set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}" + + echo "${@}" >&2 + "${@}" || die -n "pytest failed with ${EPYTHON}" + local ret=${?} + + # remove common temporary directories left over by pytest plugins + rm -rf .hypothesis .pytest_cache || die + + return ${ret} +} + +# @FUNCTION: eunittest +# @USAGE: [<args>...] +# @DESCRIPTION: +# Run unit tests using dev-python/unittest-or-fail, passing the standard +# set of options, followed by user-specified options. +# +# This command dies on failure and respects nonfatal. +eunittest() { + debug-print-function ${FUNCNAME} "${@}" + + _python_check_EPYTHON + + set -- "${EPYTHON}" -m unittest_or_fail discover -v "${@}" + + echo "${@}" >&2 + "${@}" || die -n "Tests failed with ${EPYTHON}" + return ${?} +} + +_PYTHON_UTILS_R1=1 +fi diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass new file mode 100644 index 0000000..77fb304 --- /dev/null +++ b/eclass/toolchain-funcs.eclass @@ -0,0 +1,1147 @@ +# Copyright 2002-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: toolchain-funcs.eclass +# @MAINTAINER: +# Toolchain Ninjas <toolchain@gentoo.org> +# @SUPPORTED_EAPIS: 5 6 7 8 +# @BLURB: functions to query common info about the toolchain +# @DESCRIPTION: +# The toolchain-funcs aims to provide a complete suite of functions +# for gleaning useful information about the toolchain and to simplify +# ugly things like cross-compiling and multilib. All of this is done +# in such a way that you can rely on the function always returning +# something sane. + +case ${EAPI:-0} in + # EAPI=0 is still used by crossdev, bug #797367 + 0|5|6|7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ -z ${_TOOLCHAIN_FUNCS_ECLASS} ]]; then +_TOOLCHAIN_FUNCS_ECLASS=1 + +inherit multilib + +# tc-getPROG <VAR [search vars]> <default> [tuple] +_tc-getPROG() { + local tuple=$1 + local v var vars=$2 + local prog=( $3 ) + + var=${vars%% *} + for v in ${vars} ; do + if [[ -n ${!v} ]] ; then + export ${var}="${!v}" + echo "${!v}" + return 0 + fi + done + + local search= + [[ -n $4 ]] && search=$(type -p $4-${prog[0]}) + [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]}) + [[ -n ${search} ]] && prog[0]=${search##*/} + + export ${var}="${prog[*]}" + echo "${!var}" +} +tc-getBUILD_PROG() { + local vars="BUILD_$1 $1_FOR_BUILD HOST$1" + # respect host vars if not cross-compiling + # https://bugs.gentoo.org/630282 + tc-is-cross-compiler || vars+=" $1" + _tc-getPROG CBUILD "${vars}" "${@:2}" +} +tc-getPROG() { _tc-getPROG CHOST "$@"; } + +# @FUNCTION: tc-getAR +# @USAGE: [toolchain prefix] +# @RETURN: name of the archiver +tc-getAR() { tc-getPROG AR ar "$@"; } +# @FUNCTION: tc-getAS +# @USAGE: [toolchain prefix] +# @RETURN: name of the assembler +tc-getAS() { tc-getPROG AS as "$@"; } +# @FUNCTION: tc-getCC +# @USAGE: [toolchain prefix] +# @RETURN: name of the C compiler +tc-getCC() { tc-getPROG CC gcc "$@"; } +# @FUNCTION: tc-getCPP +# @USAGE: [toolchain prefix] +# @RETURN: name of the C preprocessor +tc-getCPP() { tc-getPROG CPP "${CC:-gcc} -E" "$@"; } +# @FUNCTION: tc-getCXX +# @USAGE: [toolchain prefix] +# @RETURN: name of the C++ compiler +tc-getCXX() { tc-getPROG CXX g++ "$@"; } +# @FUNCTION: tc-getLD +# @USAGE: [toolchain prefix] +# @RETURN: name of the linker +tc-getLD() { tc-getPROG LD ld "$@"; } +# @FUNCTION: tc-getSTRINGS +# @USAGE: [toolchain prefix] +# @RETURN: name of the strings program +tc-getSTRINGS() { tc-getPROG STRINGS strings "$@"; } +# @FUNCTION: tc-getSTRIP +# @USAGE: [toolchain prefix] +# @RETURN: name of the strip program +tc-getSTRIP() { tc-getPROG STRIP strip "$@"; } +# @FUNCTION: tc-getNM +# @USAGE: [toolchain prefix] +# @RETURN: name of the symbol/object thingy +tc-getNM() { tc-getPROG NM nm "$@"; } +# @FUNCTION: tc-getRANLIB +# @USAGE: [toolchain prefix] +# @RETURN: name of the archive indexer +tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; } +# @FUNCTION: tc-getREADELF +# @USAGE: [toolchain prefix] +# @RETURN: name of the ELF reader +tc-getREADELF() { tc-getPROG READELF readelf "$@"; } +# @FUNCTION: tc-getOBJCOPY +# @USAGE: [toolchain prefix] +# @RETURN: name of the object copier +tc-getOBJCOPY() { tc-getPROG OBJCOPY objcopy "$@"; } +# @FUNCTION: tc-getOBJDUMP +# @USAGE: [toolchain prefix] +# @RETURN: name of the object dumper +tc-getOBJDUMP() { tc-getPROG OBJDUMP objdump "$@"; } +# @FUNCTION: tc-getF77 +# @USAGE: [toolchain prefix] +# @RETURN: name of the Fortran 77 compiler +tc-getF77() { tc-getPROG F77 gfortran "$@"; } +# @FUNCTION: tc-getFC +# @USAGE: [toolchain prefix] +# @RETURN: name of the Fortran 90 compiler +tc-getFC() { tc-getPROG FC gfortran "$@"; } +# @FUNCTION: tc-getGCJ +# @USAGE: [toolchain prefix] +# @RETURN: name of the java compiler +tc-getGCJ() { tc-getPROG GCJ gcj "$@"; } +# @FUNCTION: tc-getGO +# @USAGE: [toolchain prefix] +# @RETURN: name of the Go compiler +tc-getGO() { tc-getPROG GO gccgo "$@"; } +# @FUNCTION: tc-getPKG_CONFIG +# @USAGE: [toolchain prefix] +# @RETURN: name of the pkg-config tool +tc-getPKG_CONFIG() { tc-getPROG PKG_CONFIG pkg-config "$@"; } +# @FUNCTION: tc-getRC +# @USAGE: [toolchain prefix] +# @RETURN: name of the Windows resource compiler +tc-getRC() { tc-getPROG RC windres "$@"; } +# @FUNCTION: tc-getDLLWRAP +# @USAGE: [toolchain prefix] +# @RETURN: name of the Windows dllwrap utility +tc-getDLLWRAP() { tc-getPROG DLLWRAP dllwrap "$@"; } + +# @FUNCTION: tc-getBUILD_AR +# @USAGE: [toolchain prefix] +# @RETURN: name of the archiver for building binaries to run on the build machine +tc-getBUILD_AR() { tc-getBUILD_PROG AR ar "$@"; } +# @FUNCTION: tc-getBUILD_AS +# @USAGE: [toolchain prefix] +# @RETURN: name of the assembler for building binaries to run on the build machine +tc-getBUILD_AS() { tc-getBUILD_PROG AS as "$@"; } +# @FUNCTION: tc-getBUILD_CC +# @USAGE: [toolchain prefix] +# @RETURN: name of the C compiler for building binaries to run on the build machine +tc-getBUILD_CC() { tc-getBUILD_PROG CC gcc "$@"; } +# @FUNCTION: tc-getBUILD_CPP +# @USAGE: [toolchain prefix] +# @RETURN: name of the C preprocessor for building binaries to run on the build machine +tc-getBUILD_CPP() { tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"; } +# @FUNCTION: tc-getBUILD_CXX +# @USAGE: [toolchain prefix] +# @RETURN: name of the C++ compiler for building binaries to run on the build machine +tc-getBUILD_CXX() { tc-getBUILD_PROG CXX g++ "$@"; } +# @FUNCTION: tc-getBUILD_LD +# @USAGE: [toolchain prefix] +# @RETURN: name of the linker for building binaries to run on the build machine +tc-getBUILD_LD() { tc-getBUILD_PROG LD ld "$@"; } +# @FUNCTION: tc-getBUILD_STRINGS +# @USAGE: [toolchain prefix] +# @RETURN: name of the strings program for building binaries to run on the build machine +tc-getBUILD_STRINGS() { tc-getBUILD_PROG STRINGS strings "$@"; } +# @FUNCTION: tc-getBUILD_STRIP +# @USAGE: [toolchain prefix] +# @RETURN: name of the strip program for building binaries to run on the build machine +tc-getBUILD_STRIP() { tc-getBUILD_PROG STRIP strip "$@"; } +# @FUNCTION: tc-getBUILD_NM +# @USAGE: [toolchain prefix] +# @RETURN: name of the symbol/object thingy for building binaries to run on the build machine +tc-getBUILD_NM() { tc-getBUILD_PROG NM nm "$@"; } +# @FUNCTION: tc-getBUILD_RANLIB +# @USAGE: [toolchain prefix] +# @RETURN: name of the archive indexer for building binaries to run on the build machine +tc-getBUILD_RANLIB() { tc-getBUILD_PROG RANLIB ranlib "$@"; } +# @FUNCTION: tc-getBUILD_READELF +# @USAGE: [toolchain prefix] +# @RETURN: name of the ELF reader for building binaries to run on the build machine +tc-getBUILD_READELF() { tc-getBUILD_PROG READELF readelf "$@"; } +# @FUNCTION: tc-getBUILD_OBJCOPY +# @USAGE: [toolchain prefix] +# @RETURN: name of the object copier for building binaries to run on the build machine +tc-getBUILD_OBJCOPY() { tc-getBUILD_PROG OBJCOPY objcopy "$@"; } +# @FUNCTION: tc-getBUILD_PKG_CONFIG +# @USAGE: [toolchain prefix] +# @RETURN: name of the pkg-config tool for building binaries to run on the build machine +tc-getBUILD_PKG_CONFIG() { tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"; } + +# @FUNCTION: tc-getTARGET_CPP +# @USAGE: [toolchain prefix] +# @RETURN: name of the C preprocessor for the toolchain being built (or used) +tc-getTARGET_CPP() { + if [[ -n ${CTARGET} ]]; then + _tc-getPROG CTARGET TARGET_CPP "gcc -E" "$@" + else + tc-getCPP "$@" + fi +} + +# @FUNCTION: tc-export +# @USAGE: <list of toolchain variables> +# @DESCRIPTION: +# Quick way to export a bunch of compiler vars at once. +tc-export() { + local var + for var in "$@" ; do + [[ $(type -t "tc-get${var}") != "function" ]] && die "tc-export: invalid export variable '${var}'" + "tc-get${var}" > /dev/null + done +} + +# @FUNCTION: tc-is-cross-compiler +# @RETURN: Shell true if we are using a cross-compiler, shell false otherwise +tc-is-cross-compiler() { + [[ ${CBUILD:-${CHOST}} != ${CHOST} ]] +} + +# @FUNCTION: tc-cpp-is-true +# @USAGE: <condition> [cpp flags] +# @RETURN: Shell true if the condition is true, shell false otherwise. +# @DESCRIPTION: +# Evaluate the given condition using the C preprocessor for CTARGET, if +# defined, or CHOST. Additional arguments are passed through to the cpp +# command. A typical condition would be in the form defined(__FOO__). +tc-cpp-is-true() { + local CONDITION=${1} + shift + + $(tc-getTARGET_CPP) "${@}" -P - <<-EOF >/dev/null 2>&1 + #if ${CONDITION} + true + #else + #error false + #endif + EOF +} + +# @FUNCTION: tc-detect-is-softfloat +# @RETURN: Shell true if detection was possible, shell false otherwise +# @DESCRIPTION: +# Detect whether the CTARGET (or CHOST) toolchain is a softfloat based +# one by examining the toolchain's output, if possible. Outputs a value +# alike tc-is-softfloat if detection was possible. +tc-detect-is-softfloat() { + # If fetching CPP falls back to the default (gcc -E) then fail + # detection as this may not be the correct toolchain. + [[ $(tc-getTARGET_CPP) == "gcc -E" ]] && return 1 + + case ${CTARGET:-${CHOST}} in + # Avoid autodetection for bare-metal targets. bug #666896 + *-newlib|*-elf|*-eabi) + return 1 ;; + + # arm-unknown-linux-gnueabi is ambiguous. We used to treat it as + # hardfloat but we now treat it as softfloat like most everyone + # else. Check existing toolchains to respect existing systems. + arm*) + if tc-cpp-is-true "defined(__ARM_PCS_VFP)"; then + echo "no" + else + # Confusingly __SOFTFP__ is defined only when + # -mfloat-abi is soft, not softfp. + if tc-cpp-is-true "defined(__SOFTFP__)"; then + echo "yes" + else + echo "softfp" + fi + fi + + return 0 ;; + *) + return 1 ;; + esac +} + +# @FUNCTION: tc-tuple-is-softfloat +# @RETURN: See tc-is-softfloat for the possible values. +# @DESCRIPTION: +# Determine whether the CTARGET (or CHOST) toolchain is a softfloat +# based one solely from the tuple. +tc-tuple-is-softfloat() { + local CTARGET=${CTARGET:-${CHOST}} + case ${CTARGET//_/-} in + bfin*|h8300*) + echo "only" ;; + *-softfloat-*) + echo "yes" ;; + *-softfp-*) + echo "softfp" ;; + arm*-hardfloat-*|arm*eabihf) + echo "no" ;; + # bare-metal targets have their defaults. bug #666896 + *-newlib|*-elf|*-eabi) + echo "no" ;; + arm*) + echo "yes" ;; + *) + echo "no" ;; + esac +} + +# @FUNCTION: tc-is-softfloat +# @DESCRIPTION: +# See if this toolchain is a softfloat based one. +# @CODE +# The possible return values: +# - only: the target is always softfloat (never had fpu) +# - yes: the target should support softfloat +# - softfp: (arm specific) the target should use hardfloat insns, but softfloat calling convention +# - no: the target doesn't support softfloat +# @CODE +# This allows us to react differently where packages accept +# softfloat flags in the case where support is optional, but +# rejects softfloat flags where the target always lacks an fpu. +tc-is-softfloat() { + tc-detect-is-softfloat || tc-tuple-is-softfloat +} + +# @FUNCTION: tc-is-static-only +# @DESCRIPTION: +# Return shell true if the target does not support shared libs, shell false +# otherwise. +tc-is-static-only() { + local host=${CTARGET:-${CHOST}} + + # *MiNT doesn't have shared libraries, only platform so far + [[ ${host} == *-mint* ]] +} + +# @FUNCTION: tc-stack-grows-down +# @DESCRIPTION: +# Return shell true if the stack grows down. This is the default behavior +# for the vast majority of systems out there and usually projects shouldn't +# care about such internal details. +tc-stack-grows-down() { + # List the few that grow up. + case ${ARCH} in + hppa|metag) return 1 ;; + esac + + # Assume all others grow down. + return 0 +} + +# @FUNCTION: tc-export_build_env +# @USAGE: [compiler variables] +# @DESCRIPTION: +# Export common build related compiler settings. +tc-export_build_env() { + tc-export "$@" + if tc-is-cross-compiler; then + # Some build envs will initialize vars like: + # : ${BUILD_LDFLAGS:-${LDFLAGS}} + # So make sure all variables are non-empty. #526734 + : ${BUILD_CFLAGS:=-O1 -pipe} + : ${BUILD_CXXFLAGS:=-O1 -pipe} + : ${BUILD_CPPFLAGS:= } + : ${BUILD_LDFLAGS:= } + else + # https://bugs.gentoo.org/654424 + : ${BUILD_CFLAGS:=${CFLAGS}} + : ${BUILD_CXXFLAGS:=${CXXFLAGS}} + : ${BUILD_CPPFLAGS:=${CPPFLAGS}} + : ${BUILD_LDFLAGS:=${LDFLAGS}} + fi + export BUILD_{C,CXX,CPP,LD}FLAGS + + # Some packages use XXX_FOR_BUILD. + local v + for v in BUILD_{C,CXX,CPP,LD}FLAGS ; do + export ${v#BUILD_}_FOR_BUILD="${!v}" + done +} + +# @FUNCTION: tc-env_build +# @USAGE: <command> [command args] +# @INTERNAL +# @DESCRIPTION: +# Setup the compile environment to the build tools and then execute the +# specified command. We use tc-getBUILD_XX here so that we work with +# all of the semi-[non-]standard env vars like $BUILD_CC which often +# the target build system does not check. +tc-env_build() { + tc-export_build_env + CFLAGS=${BUILD_CFLAGS} \ + CXXFLAGS=${BUILD_CXXFLAGS} \ + CPPFLAGS=${BUILD_CPPFLAGS} \ + LDFLAGS=${BUILD_LDFLAGS} \ + AR=$(tc-getBUILD_AR) \ + AS=$(tc-getBUILD_AS) \ + CC=$(tc-getBUILD_CC) \ + CPP=$(tc-getBUILD_CPP) \ + CXX=$(tc-getBUILD_CXX) \ + LD=$(tc-getBUILD_LD) \ + NM=$(tc-getBUILD_NM) \ + PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) \ + RANLIB=$(tc-getBUILD_RANLIB) \ + READELF=$(tc-getBUILD_READELF) \ + "$@" +} + +# @FUNCTION: econf_build +# @USAGE: [econf flags] +# @DESCRIPTION: +# Sometimes we need to locally build up some tools to run on CBUILD because +# the package has helper utils which are compiled+executed when compiling. +# This won't work when cross-compiling as the CHOST is set to a target which +# we cannot natively execute. +# +# For example, the python package will build up a local python binary using +# a portable build system (configure+make), but then use that binary to run +# local python scripts to build up other components of the overall python. +# We cannot rely on the python binary in $PATH as that often times will be +# a different version, or not even installed in the first place. Instead, +# we compile the code in a different directory to run on CBUILD, and then +# use that binary when compiling the main package to run on CHOST. +# +# For example, with newer EAPIs, you'd do something like: +# @CODE +# src_configure() { +# ECONF_SOURCE=${S} +# if tc-is-cross-compiler ; then +# mkdir "${WORKDIR}"/${CBUILD} +# pushd "${WORKDIR}"/${CBUILD} >/dev/null +# econf_build --disable-some-unused-stuff +# popd >/dev/null +# fi +# ... normal build paths ... +# } +# src_compile() { +# if tc-is-cross-compiler ; then +# pushd "${WORKDIR}"/${CBUILD} >/dev/null +# emake one-or-two-build-tools +# ln/mv build-tools to normal build paths in ${S}/ +# popd >/dev/null +# fi +# ... normal build paths ... +# } +# @CODE +econf_build() { + local CBUILD=${CBUILD:-${CHOST}} + tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@" +} + +# @FUNCTION: tc-ld-is-gold +# @USAGE: [toolchain prefix] +# @DESCRIPTION: +# Return true if the current linker is set to gold. +tc-ld-is-gold() { + local out + + # First check the linker directly. + out=$($(tc-getLD "$@") --version 2>&1) + if [[ ${out} == *"GNU gold"* ]] ; then + return 0 + fi + + # Then see if they're selecting gold via compiler flags. + # Note: We're assuming they're using LDFLAGS to hold the + # options and not CFLAGS/CXXFLAGS. + local base="${T}/test-tc-gold" + cat <<-EOF > "${base}.c" + int main() { return 0; } + EOF + out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1) + rm -f "${base}"* + if [[ ${out} == *"GNU gold"* ]] ; then + return 0 + fi + + # No gold here! + return 1 +} + +# @FUNCTION: tc-ld-is-lld +# @USAGE: [toolchain prefix] +# @DESCRIPTION: +# Return true if the current linker is set to lld. +tc-ld-is-lld() { + local out + + # First check the linker directly. + out=$($(tc-getLD "$@") --version 2>&1) + if [[ ${out} == *"LLD"* ]] ; then + return 0 + fi + + # Then see if they're selecting lld via compiler flags. + # Note: We're assuming they're using LDFLAGS to hold the + # options and not CFLAGS/CXXFLAGS. + local base="${T}/test-tc-lld" + cat <<-EOF > "${base}.c" + int main() { return 0; } + EOF + out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1) + rm -f "${base}"* + if [[ ${out} == *"LLD"* ]] ; then + return 0 + fi + + # No lld here! + return 1 +} + +# @FUNCTION: tc-ld-disable-gold +# @USAGE: [toolchain prefix] +# @DESCRIPTION: +# If the gold linker is currently selected, configure the compilation +# settings so that we use the older bfd linker instead. +tc-ld-disable-gold() { + tc-ld-is-gold "$@" && tc-ld-force-bfd "$@" +} + +# @FUNCTION: tc-ld-force-bfd +# @USAGE: [toolchain prefix] +# @DESCRIPTION: +# If the gold or lld linker is currently selected, configure the compilation +# settings so that we use the bfd linker instead. +tc-ld-force-bfd() { + if ! tc-ld-is-gold "$@" && ! tc-ld-is-lld "$@" ; then + # They aren't using gold or lld, so nothing to do! + return + fi + + ewarn "Forcing usage of the BFD linker" + + # Set up LD to point directly to bfd if it's available. + # We need to extract the first word in case there are flags appended + # to its value (like multilib). #545218 + local ld=$(tc-getLD "$@") + local bfd_ld="${ld%% *}.bfd" + local path_ld=$(which "${bfd_ld}" 2>/dev/null) + [[ -e ${path_ld} ]] && export LD=${bfd_ld} + + # Set up LDFLAGS to select bfd based on the gcc / clang version. + local fallback="true" + if tc-is-gcc; then + local major=$(gcc-major-version "$@") + local minor=$(gcc-minor-version "$@") + if [[ ${major} -gt 4 ]] || [[ ${major} -eq 4 && ${minor} -ge 8 ]]; then + # gcc-4.8+ supports -fuse-ld directly. + export LDFLAGS="${LDFLAGS} -fuse-ld=bfd" + fallback="false" + fi + elif tc-is-clang; then + local major=$(clang-major-version "$@") + local minor=$(clang-minor-version "$@") + if [[ ${major} -gt 3 ]] || [[ ${major} -eq 3 && ${minor} -ge 5 ]]; then + # clang-3.5+ supports -fuse-ld directly. + export LDFLAGS="${LDFLAGS} -fuse-ld=bfd" + fallback="false" + fi + fi + if [[ ${fallback} == "true" ]] ; then + # <=gcc-4.7 and <=clang-3.4 require some coercion. + # Only works if bfd exists. + if [[ -e ${path_ld} ]] ; then + local d="${T}/bfd-linker" + mkdir -p "${d}" + ln -sf "${path_ld}" "${d}"/ld + export LDFLAGS="${LDFLAGS} -B${d}" + else + die "unable to locate a BFD linker" + fi + fi +} + +# @FUNCTION: tc-has-openmp +# @USAGE: [toolchain prefix] +# @DESCRIPTION: +# See if the toolchain supports OpenMP. +tc-has-openmp() { + local base="${T}/test-tc-openmp" + cat <<-EOF > "${base}.c" + #include <omp.h> + int main() { + int nthreads, tid, ret = 0; + #pragma omp parallel private(nthreads, tid) + { + tid = omp_get_thread_num(); + nthreads = omp_get_num_threads(); ret += tid + nthreads; + } + return ret; + } + EOF + $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" >&/dev/null + local ret=$? + rm -f "${base}"* + return ${ret} +} + +# @FUNCTION: tc-check-openmp +# @DESCRIPTION: +# Test for OpenMP support with the current compiler and error out with +# a clear error message, telling the user how to rectify the missing +# OpenMP support that has been requested by the ebuild. Using this function +# to test for OpenMP support should be preferred over tc-has-openmp and +# printing a custom message, as it presents a uniform interface to the user. +tc-check-openmp() { + if ! tc-has-openmp; then + eerror "Your current compiler does not support OpenMP!" + + if tc-is-gcc; then + eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\"." + elif tc-is-clang; then + eerror "OpenMP support in sys-devel/clang is provided by sys-libs/libomp." + fi + + die "Active compiler does not have required support for OpenMP" + fi +} + +# @FUNCTION: tc-has-tls +# @USAGE: [-s|-c|-l] [toolchain prefix] +# @DESCRIPTION: +# See if the toolchain supports thread local storage (TLS). Use -s to test the +# compiler, -c to also test the assembler, and -l to also test the C library +# (the default). +tc-has-tls() { + local base="${T}/test-tc-tls" + cat <<-EOF > "${base}.c" + int foo(int *i) { + static __thread int j = 0; + return *i ? j : *i; + } + EOF + local flags + case $1 in + -s) flags="-S";; + -c) flags="-c";; + -l) ;; + -*) die "Usage: tc-has-tls [-c|-l] [toolchain prefix]";; + esac + : ${flags:=-fPIC -shared -Wl,-z,defs} + [[ $1 == -* ]] && shift + $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" >&/dev/null + local ret=$? + rm -f "${base}"* + return ${ret} +} + + +# Parse information from CBUILD/CHOST/CTARGET rather than +# use external variables from the profile. +tc-ninja_magic_to_arch() { +ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } + + local type=$1 + local host=$2 + [[ -z ${host} ]] && host=${CTARGET:-${CHOST}} + + case ${host} in + aarch64*) echo arm64;; + alpha*) echo alpha;; + arm*) echo arm;; + avr*) ninj avr32 avr;; + bfin*) ninj blackfin bfin;; + c6x*) echo c6x;; + cris*) echo cris;; + frv*) echo frv;; + hexagon*) echo hexagon;; + hppa*) ninj parisc hppa;; + i?86*) + # Starting with linux-2.6.24, the 'x86_64' and 'i386' + # trees have been unified into 'x86'. + # FreeBSD still uses i386 + if [[ ${type} == "kern" && ${host} == *freebsd* ]] ; then + echo i386 + else + echo x86 + fi + ;; + ia64*) echo ia64;; + loongarch*) ninj loongarch loong;; + m68*) echo m68k;; + metag*) echo metag;; + microblaze*) echo microblaze;; + mips*) echo mips;; + nios2*) echo nios2;; + nios*) echo nios;; + or1k*|or32*) echo openrisc;; + powerpc*) + # Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees + # have been unified into simply 'powerpc', but until 2.6.16, + # ppc32 is still using ARCH="ppc" as default + if [[ ${type} == "kern" ]] ; then + echo powerpc + elif [[ ${host} == powerpc64* ]] ; then + echo ppc64 + else + echo ppc + fi + ;; + riscv*) echo riscv;; + s390*) echo s390;; + score*) echo score;; + sh64*) ninj sh64 sh;; + sh*) echo sh;; + sparc64*) ninj sparc64 sparc;; + sparc*) [[ ${PROFILE_ARCH} == "sparc64" ]] \ + && ninj sparc64 sparc \ + || echo sparc + ;; + tile*) echo tile;; + vax*) echo vax;; + x86_64*freebsd*) echo amd64;; + x86_64*) + # Starting with linux-2.6.24, the 'x86_64' and 'i386' + # trees have been unified into 'x86'. + if [[ ${type} == "kern" ]] ; then + echo x86 + else + echo amd64 + fi + ;; + xtensa*) echo xtensa;; + + # since our usage of tc-arch is largely concerned with + # normalizing inputs for testing ${CTARGET}, let's filter + # other cross targets (mingw and such) into the unknown. + *) echo unknown;; + esac +} +# @FUNCTION: tc-arch-kernel +# @USAGE: [toolchain prefix] +# @RETURN: name of the kernel arch according to the compiler target +tc-arch-kernel() { + tc-ninja_magic_to_arch kern "$@" +} +# @FUNCTION: tc-arch +# @USAGE: [toolchain prefix] +# @RETURN: name of the portage arch according to the compiler target +tc-arch() { + tc-ninja_magic_to_arch portage "$@" +} + +tc-endian() { + local host=$1 + [[ -z ${host} ]] && host=${CTARGET:-${CHOST}} + host=${host%%-*} + + case ${host} in + aarch64*be) echo big;; + aarch64) echo little;; + alpha*) echo little;; + arm*b*) echo big;; + arm*) echo little;; + cris*) echo little;; + hppa*) echo big;; + i?86*) echo little;; + ia64*) echo little;; + loongarch*) echo little;; + m68*) echo big;; + mips*l*) echo little;; + mips*) echo big;; + powerpc*le) echo little;; + powerpc*) echo big;; + riscv*) echo little;; + s390*) echo big;; + sh*b*) echo big;; + sh*) echo little;; + sparc*) echo big;; + x86_64*) echo little;; + *) echo wtf;; + esac +} + +# @FUNCTION: tc-get-compiler-type +# @RETURN: keyword identifying the compiler: gcc, clang, pathcc, unknown +tc-get-compiler-type() { + local code=' +#if defined(__PATHSCALE__) + HAVE_PATHCC +#elif defined(__clang__) + HAVE_CLANG +#elif defined(__GNUC__) + HAVE_GCC +#endif +' + local res=$($(tc-getCPP "$@") -E -P - <<<"${code}") + + case ${res} in + *HAVE_PATHCC*) echo pathcc;; + *HAVE_CLANG*) echo clang;; + *HAVE_GCC*) echo gcc;; + *) echo unknown;; + esac +} + +# @FUNCTION: tc-is-gcc +# @RETURN: Shell true if the current compiler is GCC, false otherwise. +tc-is-gcc() { + [[ $(tc-get-compiler-type) == gcc ]] +} + +# @FUNCTION: tc-is-clang +# @RETURN: Shell true if the current compiler is clang, false otherwise. +tc-is-clang() { + [[ $(tc-get-compiler-type) == clang ]] +} + +# Internal func. The first argument is the version info to expand. +# Query the preprocessor to improve compatibility across different +# compilers rather than maintaining a --version flag matrix. #335943 +_gcc_fullversion() { + local ver="$1"; shift + set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__") + eval echo "$ver" +} + +# @FUNCTION: gcc-fullversion +# @RETURN: compiler version (major.minor.micro: [3.4.6]) +gcc-fullversion() { + _gcc_fullversion '$1.$2.$3' "$@" +} +# @FUNCTION: gcc-version +# @RETURN: compiler version (major.minor: [3.4].6) +gcc-version() { + _gcc_fullversion '$1.$2' "$@" +} +# @FUNCTION: gcc-major-version +# @RETURN: major compiler version (major: [3].4.6) +gcc-major-version() { + _gcc_fullversion '$1' "$@" +} +# @FUNCTION: gcc-minor-version +# @RETURN: minor compiler version (minor: 3.[4].6) +gcc-minor-version() { + _gcc_fullversion '$2' "$@" +} +# @FUNCTION: gcc-micro-version +# @RETURN: micro compiler version (micro: 3.4.[6]) +gcc-micro-version() { + _gcc_fullversion '$3' "$@" +} + +# Internal func. Based on _gcc_fullversion() above. +_clang_fullversion() { + local ver="$1"; shift + set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__") + eval echo "$ver" +} + +# @FUNCTION: clang-fullversion +# @RETURN: compiler version (major.minor.micro: [3.4.6]) +clang-fullversion() { + _clang_fullversion '$1.$2.$3' "$@" +} +# @FUNCTION: clang-version +# @RETURN: compiler version (major.minor: [3.4].6) +clang-version() { + _clang_fullversion '$1.$2' "$@" +} +# @FUNCTION: clang-major-version +# @RETURN: major compiler version (major: [3].4.6) +clang-major-version() { + _clang_fullversion '$1' "$@" +} +# @FUNCTION: clang-minor-version +# @RETURN: minor compiler version (minor: 3.[4].6) +clang-minor-version() { + _clang_fullversion '$2' "$@" +} +# @FUNCTION: clang-micro-version +# @RETURN: micro compiler version (micro: 3.4.[6]) +clang-micro-version() { + _clang_fullversion '$3' "$@" +} + +# Returns the installation directory - internal toolchain +# function for use by _gcc-specs-exists (for flag-o-matic). +_gcc-install-dir() { + echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null |\ + awk '$1=="install:" {print $2}')" +} +# Returns true if the indicated specs file exists - internal toolchain +# function for use by flag-o-matic. +_gcc-specs-exists() { + [[ -f $(_gcc-install-dir)/$1 ]] +} + +# Returns requested gcc specs directive unprocessed - for used by +# gcc-specs-directive() +# Note; later specs normally overwrite earlier ones; however if a later +# spec starts with '+' then it appends. +# gcc -dumpspecs is parsed first, followed by files listed by "gcc -v" +# as "Reading <file>", in order. Strictly speaking, if there's a +# $(gcc_install_dir)/specs, the built-in specs aren't read, however by +# the same token anything from 'gcc -dumpspecs' is overridden by +# the contents of $(gcc_install_dir)/specs so the result is the +# same either way. +_gcc-specs-directive_raw() { + local cc=$(tc-getCC) + local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}') + ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 \ +'BEGIN { pspec=""; spec=""; outside=1 } +$1=="*"directive":" { pspec=spec; spec=""; outside=0; next } + outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next } + spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next } + { spec=spec $0 } +END { print spec }' + return 0 +} + +# Return the requested gcc specs directive, with all included +# specs expanded. +# Note, it does not check for inclusion loops, which cause it +# to never finish - but such loops are invalid for gcc and we're +# assuming gcc is operational. +gcc-specs-directive() { + local directive subdname subdirective + directive="$(_gcc-specs-directive_raw $1)" + while [[ ${directive} == *%\(*\)* ]]; do + subdname=${directive/*%\(} + subdname=${subdname/\)*} + subdirective="$(_gcc-specs-directive_raw ${subdname})" + directive="${directive//\%(${subdname})/${subdirective}}" + done + echo "${directive}" + return 0 +} + +# Returns true if gcc sets relro +gcc-specs-relro() { + local directive + directive=$(gcc-specs-directive link_command) + [[ "${directive/\{!norelro:}" != "${directive}" ]] +} +# Returns true if gcc sets now +gcc-specs-now() { + local directive + directive=$(gcc-specs-directive link_command) + [[ "${directive/\{!nonow:}" != "${directive}" ]] +} +# Returns true if gcc builds PIEs +gcc-specs-pie() { + local directive + directive=$(gcc-specs-directive cc1) + [[ "${directive/\{!nopie:}" != "${directive}" ]] +} +# Returns true if gcc builds with the stack protector +gcc-specs-ssp() { + local directive + directive=$(gcc-specs-directive cc1) + [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]] +} +# Returns true if gcc upgrades fstack-protector to fstack-protector-all +gcc-specs-ssp-to-all() { + local directive + directive=$(gcc-specs-directive cc1) + [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]] +} +# Returns true if gcc builds with fno-strict-overflow +gcc-specs-nostrict() { + local directive + directive=$(gcc-specs-directive cc1) + [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]] +} +# Returns true if gcc builds with fstack-check +gcc-specs-stack-check() { + local directive + directive=$(gcc-specs-directive cc1) + [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]] +} + + +# @FUNCTION: tc-enables-pie +# @RETURN: Truth if the current compiler generates position-independent code (PIC) which can be linked into executables +# @DESCRIPTION: +# Return truth if the current compiler generates position-independent code (PIC) +# which can be linked into executables. +tc-enables-pie() { + tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS} +} + +# @FUNCTION: tc-enables-ssp +# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on at least minimal level +# @DESCRIPTION: +# Return truth if the current compiler enables stack smashing protection (SSP) +# on level corresponding to any of the following options: +# -fstack-protector +# -fstack-protector-strong +# -fstack-protector-all +tc-enables-ssp() { + tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} +} + +# @FUNCTION: tc-enables-ssp-strong +# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on at least middle level +# @DESCRIPTION: +# Return truth if the current compiler enables stack smashing protection (SSP) +# on level corresponding to any of the following options: +# -fstack-protector-strong +# -fstack-protector-all +tc-enables-ssp-strong() { + tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} +} + +# @FUNCTION: tc-enables-ssp-all +# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on maximal level +# @DESCRIPTION: +# Return truth if the current compiler enables stack smashing protection (SSP) +# on level corresponding to any of the following options: +# -fstack-protector-all +tc-enables-ssp-all() { + tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} +} + + +# @FUNCTION: gen_usr_ldscript +# @USAGE: [-a] <list of libs to create linker scripts for> +# @DESCRIPTION: +# This function is deprecated. Use the version from +# usr-ldscript.eclass instead. +gen_usr_ldscript() { + ewarn "${FUNCNAME}: Please migrate to usr-ldscript.eclass" + + local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname) + [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/ + + tc-is-static-only && return + + # We only care about stuffing / for the native ABI. #479448 + if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then + multilib_is_native_abi || return 0 + fi + + # Eventually we'd like to get rid of this func completely #417451 + case ${CTARGET:-${CHOST}} in + *-darwin*) ;; + *-android*) return 0 ;; + *linux*|*-freebsd*|*-openbsd*|*-netbsd*) + use prefix && return 0 ;; + *) return 0 ;; + esac + + # Just make sure it exists + dodir /usr/${libdir} + + if [[ $1 == "-a" ]] ; then + auto=true + shift + dodir /${libdir} + fi + + # OUTPUT_FORMAT gives hints to the linker as to what binary format + # is referenced ... makes multilib saner + local flags=( ${CFLAGS} ${LDFLAGS} -Wl,--verbose ) + if $(tc-getLD) --version | grep -q 'GNU gold' ; then + # If they're using gold, manually invoke the old bfd. #487696 + local d="${T}/bfd-linker" + mkdir -p "${d}" + ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld + flags+=( -B"${d}" ) + fi + output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + for lib in "$@" ; do + local tlib + if ${auto} ; then + lib="lib${lib}${suffix}" + else + # Ensure /lib/${lib} exists to avoid dangling scripts/symlinks. + # This especially is for AIX where $(get_libname) can return ".a", + # so /lib/${lib} might be moved to /usr/lib/${lib} (by accident). + [[ -r ${ED}/${libdir}/${lib} ]] || continue + #TODO: better die here? + fi + + case ${CTARGET:-${CHOST}} in + *-darwin*) + if ${auto} ; then + tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib}) + else + tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib}) + fi + [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}" + tlib=${tlib##*/} + + if ${auto} ; then + mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die + # some install_names are funky: they encode a version + if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]] ; then + mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die + fi + rm -f "${ED}"/${libdir}/${lib} + fi + + # Mach-O files have an id, which is like a soname, it tells how + # another object linking against this lib should reference it. + # Since we moved the lib from usr/lib into lib this reference is + # wrong. Hence, we update it here. We don't configure with + # libdir=/lib because that messes up libtool files. + # Make sure we don't lose the specific version, so just modify the + # existing install_name + if [[ ! -w "${ED}/${libdir}/${tlib}" ]] ; then + chmod u+w "${ED}${libdir}/${tlib}" # needed to write to it + local nowrite=yes + fi + install_name_tool \ + -id "${EPREFIX}"/${libdir}/${tlib} \ + "${ED}"/${libdir}/${tlib} || die "install_name_tool failed" + [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}" + # Now as we don't use GNU binutils and our linker doesn't + # understand linker scripts, just create a symlink. + pushd "${ED}/usr/${libdir}" > /dev/null + ln -snf "../../${libdir}/${tlib}" "${lib}" + popd > /dev/null + ;; + *) + if ${auto} ; then + tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib}) + [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}" + mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die + # some SONAMEs are funky: they encode a version before the .so + if [[ ${tlib} != ${lib}* ]] ; then + mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die + fi + rm -f "${ED}"/${libdir}/${lib} + else + tlib=${lib} + fi + cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT + /* GNU ld script + Since Gentoo has critical dynamic libraries in /lib, and the static versions + in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we + run into linking problems. This "fake" dynamic lib is a linker script that + redirects the linker to the real lib. And yes, this works in the cross- + compiling scenario as the sysroot-ed linker will prepend the real path. + + See bug https://bugs.gentoo.org/4411 for more info. + */ + ${output_format} + GROUP ( ${EPREFIX}/${libdir}/${tlib} ) + END_LDSCRIPT + ;; + esac + fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}" + done +} + +fi diff --git a/eclass/verify-sig.eclass b/eclass/verify-sig.eclass new file mode 100644 index 0000000..3693eb1 --- /dev/null +++ b/eclass/verify-sig.eclass @@ -0,0 +1,346 @@ +# Copyright 2020-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: verify-sig.eclass +# @MAINTAINER: +# Michał Górny <mgorny@gentoo.org> +# @SUPPORTED_EAPIS: 7 8 +# @BLURB: Eclass to verify upstream signatures on distfiles +# @DESCRIPTION: +# verify-sig eclass provides a streamlined approach to verifying +# upstream signatures on distfiles. Its primary purpose is to permit +# developers to easily verify signatures while bumping packages. +# The eclass removes the risk of developer forgetting to perform +# the verification, or performing it incorrectly, e.g. due to additional +# keys in the local keyring. It also permits users to verify +# the developer's work. +# +# To use the eclass, start by packaging the upstream's key +# as app-crypt/openpgp-keys-*. Then inherit the eclass, add detached +# signatures to SRC_URI and set VERIFY_SIG_OPENPGP_KEY_PATH. The eclass +# provides verify-sig USE flag to toggle the verification. +# +# If you need to use signify, you may want to copy distfiles into WORKDIR to +# work around "Too many levels of symbolic links" error. +# @EXAMPLE: +# Example use: +# +# @CODE +# inherit verify-sig +# +# SRC_URI="https://example.org/${P}.tar.gz +# verify-sig? ( https://example.org/${P}.tar.gz.sig )" +# BDEPEND=" +# verify-sig? ( app-crypt/openpgp-keys-example )" +# +# VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/example.asc +# @CODE + +case ${EAPI} in + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +EXPORT_FUNCTIONS src_unpack + +if [[ ! ${_VERIFY_SIG_ECLASS} ]]; then + +IUSE="verify-sig" + +# @ECLASS-VARIABLE: VERIFY_SIG_METHOD +# @PRE_INHERIT +# @DESCRIPTION: +# Signature verification method to use. The allowed value are: +# +# - openpgp -- verify PGP signatures using app-crypt/gnupg (the default) +# - signify -- verify signatures with Ed25519 public key using app-crypt/signify +: ${VERIFY_SIG_METHOD:=openpgp} + +case ${VERIFY_SIG_METHOD} in + openpgp) + BDEPEND=" + verify-sig? ( + app-crypt/gnupg + >=app-portage/gemato-16 + )" + ;; + signify) + BDEPEND="verify-sig? ( app-crypt/signify )" + ;; + *) + die "${ECLASS}: unknown method '${VERIFY_SIG_METHOD}'" + ;; +esac + +# @ECLASS-VARIABLE: VERIFY_SIG_OPENPGP_KEY_PATH +# @DEFAULT_UNSET +# @DESCRIPTION: +# Path to key bundle used to perform the verification. This is required +# when using default src_unpack. Alternatively, the key path can be +# passed directly to the verification functions. +# +# NB: this variable is also used for non-OpenPGP signatures. The name +# contains "OPENPGP" for historical reasons. + +# @ECLASS-VARIABLE: VERIFY_SIG_OPENPGP_KEYSERVER +# @DEFAULT_UNSET +# @DESCRIPTION: +# Keyserver used to refresh keys. If not specified, the keyserver +# preference from the key will be respected. If no preference +# is specified by the key, the GnuPG default will be used. +# +# Supported for OpenPGP only. + +# @ECLASS-VARIABLE: VERIFY_SIG_OPENPGP_KEY_REFRESH +# @USER_VARIABLE +# @DESCRIPTION: +# Attempt to refresh keys via WKD/keyserver. Set it to "yes" +# in make.conf to enable. Note that this requires working Internet +# connection. +# +# Supported for OpenPGP only. +: ${VERIFY_SIG_OPENPGP_KEY_REFRESH:=no} + +# @FUNCTION: verify-sig_verify_detached +# @USAGE: <file> <sig-file> [<key-file>] +# @DESCRIPTION: +# Read the detached signature from <sig-file> and verify <file> against +# it. <key-file> can either be passed directly, or it defaults +# to VERIFY_SIG_OPENPGP_KEY_PATH. The function dies if verification +# fails. +verify-sig_verify_detached() { + local file=${1} + local sig=${2} + local key=${3:-${VERIFY_SIG_OPENPGP_KEY_PATH}} + + [[ -n ${key} ]] || + die "${FUNCNAME}: no key passed and VERIFY_SIG_OPENPGP_KEY_PATH unset" + + local extra_args=() + [[ ${VERIFY_SIG_OPENPGP_KEY_REFRESH} == yes ]] || extra_args+=( -R ) + if [[ -n ${VERIFY_SIG_OPENPGP_KEYSERVER+1} ]]; then + [[ ${VERIFY_SIG_METHOD} == openpgp ]] || + die "${FUNCNAME}: VERIFY_SIG_OPENPGP_KEYSERVER is not supported" + + extra_args+=( + --keyserver "${VERIFY_SIG_OPENPGP_KEYSERVER}" + ) + fi + + # GPG upstream knows better than to follow the spec, so we can't + # override this directory. However, there is a clean fallback + # to GNUPGHOME. + addpredict /run/user + + local filename=${file##*/} + [[ ${file} == - ]] && filename='(stdin)' + einfo "Verifying ${filename} ..." + case ${VERIFY_SIG_METHOD} in + openpgp) + gemato gpg-wrap -K "${key}" "${extra_args[@]}" -- \ + gpg --verify "${sig}" "${file}" || + die "PGP signature verification failed" + ;; + signify) + signify -V -p "${key}" -m "${file}" -x "${sig}" || + die "Signify signature verification failed" + ;; + esac +} + +# @FUNCTION: verify-sig_verify_message +# @USAGE: <file> <output-file> [<key-file>] +# @DESCRIPTION: +# Verify that the file ('-' for stdin) contains a valid, signed PGP +# message and write the message into <output-file> ('-' for stdout). +# <key-file> can either be passed directly, or it defaults +# to VERIFY_SIG_OPENPGP_KEY_PATH. The function dies if verification +# fails. Note that using output from <output-file> is important as it +# prevents the injection of unsigned data. +verify-sig_verify_message() { + local file=${1} + local output_file=${2} + local key=${3:-${VERIFY_SIG_OPENPGP_KEY_PATH}} + + [[ -n ${key} ]] || + die "${FUNCNAME}: no key passed and VERIFY_SIG_OPENPGP_KEY_PATH unset" + + local extra_args=() + [[ ${VERIFY_SIG_OPENPGP_KEY_REFRESH} == yes ]] || extra_args+=( -R ) + if [[ -n ${VERIFY_SIG_OPENPGP_KEYSERVER+1} ]]; then + [[ ${VERIFY_SIG_METHOD} == openpgp ]] || + die "${FUNCNAME}: VERIFY_SIG_OPENPGP_KEYSERVER is not supported" + + extra_args+=( + --keyserver "${VERIFY_SIG_OPENPGP_KEYSERVER}" + ) + fi + + # GPG upstream knows better than to follow the spec, so we can't + # override this directory. However, there is a clean fallback + # to GNUPGHOME. + addpredict /run/user + + local filename=${file##*/} + [[ ${file} == - ]] && filename='(stdin)' + einfo "Verifying ${filename} ..." + case ${VERIFY_SIG_METHOD} in + openpgp) + gemato gpg-wrap -K "${key}" "${extra_args[@]}" -- \ + gpg --verify --output="${output_file}" "${file}" || + die "PGP signature verification failed" + ;; + signify) + signify -V -e -p "${key}" -m "${output_file}" -x "${file}" || + die "Signify signature verification failed" + ;; + esac +} + +# @FUNCTION: _gpg_verify_signed_checksums +# @INTERNAL +# @USAGE: <checksum-file> <algo> <files> [<key-file>] +# @DESCRIPTION: +# GnuPG-specific function to verify a signed checksums list. +_gpg_verify_signed_checksums() { + local checksum_file=${1} + local algo=${2} + local files=() + read -r -d '' -a files <<<"${3}" + local key=${4:-${VERIFY_SIG_OPENPGP_KEY_PATH}} + local chksum_prog chksum_len + + case ${algo} in + sha256) + chksum_prog=sha256sum + chksum_len=64 + ;; + *) + die "${FUNCNAME}: unknown checksum algo ${algo}" + ;; + esac + + local checksum filename junk ret=0 count=0 + while read -r checksum filename junk; do + [[ ${#checksum} -eq ${chksum_len} ]] || continue + [[ -z ${checksum//[0-9a-f]} ]] || continue + has "${filename}" "${files[@]}" || continue + [[ -z ${junk} ]] || continue + + "${chksum_prog}" -c --strict - <<<"${checksum} ${filename}" + if [[ ${?} -eq 0 ]]; then + (( count++ )) + else + ret=1 + fi + done < <(verify-sig_verify_message "${checksum_file}" - "${key}") + + [[ ${ret} -eq 0 ]] || + die "${FUNCNAME}: at least one file did not verify successfully" + [[ ${count} -eq ${#files[@]} ]] || + die "${FUNCNAME}: checksums for some of the specified files were missing" +} + +# @FUNCTION: verify-sig_verify_signed_checksums +# @USAGE: <checksum-file> <algo> <files> [<key-file>] +# @DESCRIPTION: +# Verify the checksums for all files listed in the space-separated list +# <files> (akin to ${A}) using a signed <checksum-file>. <algo> specifies +# the checksum algorithm (e.g. sha256). <key-file> can either be passed +# directly, or it defaults to VERIFY_SIG_OPENPGP_KEY_PATH. +# +# The function dies if signature verification fails, the checksum file +# contains unsigned data, one of the files do not match checksums or +# are missing from the checksum file. +verify-sig_verify_signed_checksums() { + local checksum_file=${1} + local algo=${2} + local files=() + read -r -d '' -a files <<<"${3}" + local key=${4:-${VERIFY_SIG_OPENPGP_KEY_PATH}} + + [[ -n ${key} ]] || + die "${FUNCNAME}: no key passed and VERIFY_SIG_OPENPGP_KEY_PATH unset" + + case ${VERIFY_SIG_METHOD} in + openpgp) + _gpg_verify_signed_checksums \ + "${checksum_file}" "${algo}" "${files[@]}" "${key}" + ;; + signify) + signify -C -p "${key}" \ + -x "${checksum_file}" "${files[@]}" || + die "Signify signature verification failed" + ;; + esac +} + +# @FUNCTION: verify-sig_src_unpack +# @DESCRIPTION: +# Default src_unpack override that verifies signatures for all +# distfiles if 'verify-sig' flag is enabled. The function dies if any +# of the signatures fails to verify or if any distfiles are not signed. +# Please write src_unpack() yourself if you need to perform partial +# verification. +verify-sig_src_unpack() { + if use verify-sig; then + local f suffix found + local distfiles=() signatures=() nosigfound=() straysigs=() + + # find all distfiles and signatures, and combine them + for f in ${A}; do + found= + for suffix in .asc .sig; do + if [[ ${f} == *${suffix} ]]; then + signatures+=( "${f}" ) + found=sig + break + else + if has "${f}${suffix}" ${A}; then + distfiles+=( "${f}" ) + found=dist+sig + break + fi + fi + done + if [[ ! ${found} ]]; then + nosigfound+=( "${f}" ) + fi + done + + # check if all distfiles are signed + if [[ ${#nosigfound[@]} -gt 0 ]]; then + eerror "The following distfiles lack detached signatures:" + for f in "${nosigfound[@]}"; do + eerror " ${f}" + done + die "Unsigned distfiles found" + fi + + # check if there are no stray signatures + for f in "${signatures[@]}"; do + if ! has "${f%.*}" "${distfiles[@]}"; then + straysigs+=( "${f}" ) + fi + done + if [[ ${#straysigs[@]} -gt 0 ]]; then + eerror "The following signatures do not match any distfiles:" + for f in "${straysigs[@]}"; do + eerror " ${f}" + done + die "Unused signatures found" + fi + + # now perform the verification + for f in "${signatures[@]}"; do + verify-sig_verify_detached \ + "${DISTDIR}/${f%.*}" "${DISTDIR}/${f}" + done + fi + + # finally, unpack the distfiles + default_src_unpack +} + +_VERIFY_SIG_ECLASS=1 +fi diff --git a/media-libs/libplacebo/Manifest b/media-libs/libplacebo/Manifest new file mode 100644 index 0000000..bb1a83e --- /dev/null +++ b/media-libs/libplacebo/Manifest @@ -0,0 +1,3 @@ +DIST libplacebo-v3.120.3.tar.gz 523749 BLAKE2B 6192570dba8de6e0bb98ccf3f0e4f13c01a27c5f97873ff0e5e3212d9b7cdebd98cce3d5ee5364ca8a585ec2a16d0bafc5a863ed35f6f225d86a4410b92edfd3 SHA512 6a2d3c6c053edc3a912a46f9c16d226d83c6f8880714f0b20a8b9417889616e4c1d4d41b8935b898cc580dc3b480ce974bb3921162165f0774ea91be1dfff520 +EBUILD libplacebo-3.120.3.ebuild 2031 BLAKE2B e3baa1ed9a8ab3baa5e1577687030c289b9afe4c7cc244be59ca6e9c13848ae341838a1687fe5f357c668be5325ef4e48c6a801a58036183ef8c44619e510570 SHA512 9196702b9c256a7a1530d0e7a9bf9b64837fe7a37cc43efcd2625f06ae126549eecebfeba843174feea463fc8e1fb5f06855bffd1519cb74c63e621d3288e333 +MISC metadata.xml 600 BLAKE2B 64be4c9fc7d6f967c7439d374ab5a8cb499066d9a6216ee14161db98359e69d6cfe4a57eafc18ac3f7e414234d4987ef0cb812e01552810ea4c6f29e06e42498 SHA512 2b62cdec3e8ca9ddc669cd0dad10888ec394dba889f4547b81e8a48603ae3657828f4d62a6aa45d3f8bf53c360b0870c76b259e93f0242c0d332e978091bd5b4 diff --git a/media-libs/libplacebo/libplacebo-3.120.3.ebuild b/media-libs/libplacebo/libplacebo-3.120.3.ebuild new file mode 100644 index 0000000..61eab11 --- /dev/null +++ b/media-libs/libplacebo/libplacebo-3.120.3.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_REQ_USE="xml" +PYTHON_COMPAT=( python3_{7,8,9} ) + +if [[ "${PV}" == "9999" ]]; then + EGIT_REPO_URI="https://code.videolan.org/videolan/libplacebo.git" + inherit git-r3 +else + KEYWORDS="~amd64 ~ppc64 ~x86" + SRC_URI="https://code.videolan.org/videolan/libplacebo/-/archive/v${PV}/libplacebo-v${PV}.tar.gz" + S="${WORKDIR}/${PN}-v${PV}" +fi + +inherit meson-multilib python-any-r1 + +DESCRIPTION="Reusable library for GPU-accelerated image processing primitives" +HOMEPAGE="https://code.videolan.org/videolan/libplacebo" + +LICENSE="LGPL-2.1+" +SLOT="0/$(ver_cut 2)" # libplacebo.so version +IUSE="glslang lcms +opengl +shaderc test +vulkan" +REQUIRED_USE="vulkan? ( || ( glslang shaderc ) )" +RESTRICT="!test? ( test )" + +RDEPEND="glslang? ( dev-util/glslang[${MULTILIB_USEDEP}] ) + lcms? ( media-libs/lcms:2[${MULTILIB_USEDEP}] ) + opengl? ( media-libs/libepoxy[${MULTILIB_USEDEP}] ) + shaderc? ( >=media-libs/shaderc-2017.2[${MULTILIB_USEDEP}] ) + vulkan? ( + dev-util/vulkan-headers + media-libs/vulkan-loader[${MULTILIB_USEDEP}] + )" +DEPEND="${RDEPEND}" + +BDEPEND="virtual/pkgconfig + vulkan? ( + ${PYTHON_DEPS} + $(python_gen_any_dep 'dev-python/mako[${PYTHON_USEDEP}]') + )" + +python_check_deps() { + has_version -b "dev-python/mako[${PYTHON_USEDEP}]" +} + +pkg_setup() { + use vulkan && python-any-r1_pkg_setup +} + +multilib_src_configure() { + local emesonargs=( + $(meson_feature glslang) + $(meson_feature lcms) + $(meson_feature opengl) + $(meson_feature shaderc) + $(meson_feature vulkan) + $(meson_use test tests) + # hard-code path from dev-util/vulkan-headers + -Dvulkan-registry=/usr/share/vulkan/registry/vk.xml + -Ddemos=false + # ^ useless, and also semi-broken + # (well, actually, looks like it requires some new just-for-demos deps and even with versions restrictions (say, >=glfw-3.3)) + # feel free to patch if you need demos for some strange reason. + ) + meson_src_configure +} + +multilib_src_test() { + meson_src_test -t 10 +} diff --git a/media-libs/libplacebo/metadata.xml b/media-libs/libplacebo/metadata.xml new file mode 100644 index 0000000..9c79fff --- /dev/null +++ b/media-libs/libplacebo/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!-- maintainer-needed --> + <use> + <flag name="glslang">Use <pkg>dev-util/glslang</pkg> to compile GLSL</flag> + <flag name="lcms">Add support for color management via <pkg>media-libs/lcms</pkg></flag> + <flag name="shaderc">Use <pkg>media-libs/shaderc</pkg> to compile GLSL</flag> + <flag name="vulkan">Add support for the vulkan graphics API</flag> + </use> + <upstream> + <bugs-to>https://code.videolan.org/videolan/libplacebo/issues</bugs-to> + </upstream> +</pkgmetadata> diff --git a/metadata/layout.conf b/metadata/layout.conf new file mode 100644 index 0000000..029406e --- /dev/null +++ b/metadata/layout.conf @@ -0,0 +1 @@ +masters = core-kit diff --git a/sys-devel/automake/Manifest b/sys-devel/automake/Manifest new file mode 100644 index 0000000..41a4f54 --- /dev/null +++ b/sys-devel/automake/Manifest @@ -0,0 +1,25 @@ +AUX automake-1.10-perl-5.16.patch 3555 BLAKE2B 8128b27ade89b12445b02532d9837ff469e6d0e1be3ebab6969d8d68c3a57a27e25ff89db82ed8abf3eff6d392bbd3b91a0b5b6b0827e7eec1279bc5345dc024 SHA512 050d66f3f1b4aed6482a234b32bbdbe231ddea0c9f4fb2ff97e963095ad69a487fd65986189fd659fbe8d8d011f3f866e92e506e653fd832d2adaf3263ed33fc +AUX automake-1.11-install-sh-avoid-low-risk-race-in-tmp.patch 3016 BLAKE2B 8dbc2ae72f8d687e785be6dde22429305cdbbb2b441a05ad268d5a7f019b087e090d7b93cb5ff033d004a8344fc9056172f1a16bd0bfa98501e1c55cf6933c54 SHA512 0f6c6ee15c895b64742113156f9864396daa6d7680897e4795909c78cb300df0d96c63091a39e901c2d62e76852fcbb49a5be747cb4b381c4346b81c0c570149 +AUX automake-1.13-dyn-ithreads.patch 2126 BLAKE2B 13fa89641077b7e9e7052441b84b756d7ddbd1ac3b87857028ccb34feb4528d774400fc411bf4fa54bbed697d8be6bf948d774d474f0638611c52f8d98696951 SHA512 7a3795cb8b14b347a296abd410f3a740401e796a06317e52fa1ef8b0866099f71965f7fb12fd85db2ccc7445f310a4dbff6870d8a63e72c49ed6f8ca9da97277 +AUX automake-1.13-hash-order-workaround.patch 529 BLAKE2B 92706c8c87aa1722de4ee4bbffd815720dfbc3d124776f7118ca57d682bbb9475174357412bb7e9f79c98adeb03651087cb095b52e682aa14447ab012945ca6a SHA512 2899c650664ead4c5fb4fdae79605b665cad52c3ecda0f8192e2ca37dbfdb42eb5937f9a24622e6463d4c003d70186b8a4c1404a47bd387de36d9f0db03e5593 +AUX automake-1.13-perl-escape-curly-bracket-r1.patch 1127 BLAKE2B 18664d2af473845f6ae91ab566651a53cbcf16df598adc3812f6d40f774c2c571c20dada4f23193b2b39ddc36c5fe9fea0449f32231540477fbf2260a7052c51 SHA512 25d94503572f70a5f9ab808057ca1ad7080cba89cf98c2b1664da2dc347f8ada1db6a97138a9b3ee12ffa54a37a34307a9fded4c069e1eb20e490556ad4f46d3 +AUX automake-1.14-install-sh-avoid-low-risk-race-in-tmp.patch 3015 BLAKE2B a0a7afb76c8cd8a5dce60bcb0a7a59a7957bcfe2b70f541889d5677005f4c9a295cf0459eaf4626314ce75031716028fe0a91db00f416e2aef8d17d8e31009d0 SHA512 34a061b72993290ac9fbf7957da89d0ed0ded70f304db0983ffff557887434dba01f5ca40cfd13dccfc648af7ade9b94d45895bac33dd560d550e3f1b24b6a55 +AUX automake-1.15-install-sh-avoid-low-risk-race-in-tmp.patch 3672 BLAKE2B e967579e81e3da85c9a5026a829be9dae93fd7d452c67bf94383787a7e7b46b62ba605112f3aaa5b4ee38d06727320ab8df017fc0b3a957e8fe0ba8e91883d52 SHA512 cfb9a11d82641b4f5b8e43d6a97fc20d012ce9ba6c4ab5fa3bae8c33da980867e3bad35229fbd5f2d811cfd849b275e83ecd0b80d25cff78695f700ebfc92cdc +AUX automake-1.16.2-fix-instmany-python.sh-test.patch 676 BLAKE2B b4368612ef22de981e56c633b6993db5bc7fc1c84f9be002018d4dd25c13bbc36ef7378940680b3c73a559100134e2356e7d626cdc24d91497e644e8e27268a1 SHA512 41d0d797cf25f2e080a57f57bee041cc02ea9e0a7f1ee8aa55af112f43e02c58b867d778b79d82b909d13c55ac0326718f1716947c9022e035e4631d7dbe85a0 +AUX automake-1.16.2-fix-py-compile-basedir.sh-test.patch 985 BLAKE2B 9a07629d107316ed765990ef2e1356a16dfb6231829315bab704dc7fdb4716dce9320eef4baaef3ab76db2908b9071c4cb35c6607be8b984896b2cfbcdb8b474 SHA512 22c1db04dcb71a6d1519c0d54e18c40f0ad5d4ada82edf606c8c0da6a3fb6dadcd7ec5289da2373b17c063211cb1ef6c85b5a6a7e355f906ca660bc402ce184b +AUX automake-1.16.2-py3-compile.patch 2412 BLAKE2B 20a3ce66047ad5106f0cafccce19fc8acd47ee0ba01882d1ff18c1a15592ef68b9c3debb61df78a31f238938a93ca4dc281b358b588727864673b09b11167131 SHA512 3bb9769d37b02e89373612752f127c582f948347a6f54e8b24dba262e14ca860e8fa507d96c0d51f0d64587371b9da17eb270dd5b7695091181731e35e5b9c2d +DIST automake-1.11.6.tar.xz 1092908 BLAKE2B 17254d81d6920c32aa877b6c892025de8e4060b8bcbe50fff841ada513dd462ddde8fc6838b4976098a812f8fda047e7186cb62cea8175df615dde75a9959144 SHA512 6e4cdf69f07734954f770fd4a7211a8c9dc69fe25a7746bd3c1e01d3139c94cab2900399e87371548833e99687e0d2b59c5e746ab2fdfbc7d47f2c1d439137ba +DIST automake-1.13.4.tar.xz 1449608 BLAKE2B 03dee42d65362a6f36e81c83d516c85faba1aac59bdc0d941077fde9be7742da0f57b48d678169e7a0e8b652c3ef46c314cdd3efb0fc489c389852fed1c39a02 SHA512 c9b145c1b822a4d83f2899f4280a76ccae932301b273f4c9718dc7f53161aa03dc1be2c1fb1a61083c54186e1908ae2c8284250aa1d8f6dea484767aca1344d3 +DIST automake-1.15.1.tar.xz 1509496 BLAKE2B e6ade31089f969140472004cd9854318470228c64e4f8e829d48c5379f62d2c5f8ef9509131c577653e81868d94544ecf6520f86b5d582ebb6ed65c832039f30 SHA512 02f661b2676f1d44334ce1c7188f9913a6874bf46ba487708ad8090ad57905f14aead80fefed815e21effacfbb925e23b944ea7dd32563dca39c1a4174eda688 +DIST automake-1.16.3.tar.xz 1590708 BLAKE2B ab6001a1b09e171ec83bac07155a77ab0fc29f5185116616aa3080b27e8bbf759472cd0dfb75630b26f7ad8d0741e668662d00b370ef79cf5ef6c62e945c94da SHA512 7265aeb7f82a8a205761d76e6ade7b7e97831c283349fd80f86e511f4b0b3e17f429d1506fca84c76079f63781e5dbf5ca81455d6bf6cda27d2e5c3d23b0d1aa +DIST automake-1.16.4.tar.xz 1599336 BLAKE2B a74bb444e7074e7dd7cf920a94a86756a5e6dec24a9eeb669ee629a1d3ab667efef0005d488fe6d9d8b33a680ada54f098ca334b63da4a739b0fec7c630a65aa SHA512 5a8883657e73b75bfa1ee59ab04af6bf4d43f390ab62fb7a9e8e2ac66159dfe4947b2ac7bc1028afffe6a09d88f388339500e03f6cdfa1226985be45ec033246 +DIST automake-1.16.5.tar.xz 1601740 BLAKE2B 87408abc57e1d4317a2b518fb3606d0f6d156522e7333016dd84747cd8922f27ef7fcc93220b11f794ce52bf8fd9a788d0166a4d1964d7c283905f269977ac7c SHA512 3084ae543aa3fb5a05104ffb2e66cfa9a53080f2343c44809707fd648516869511500dba50dae67ff10f92a1bf3b5a92b2a0fa01cda30adb69b9da03994d9d88 +EBUILD automake-1.11.6-r3.ebuild 2566 BLAKE2B c1e28e5349f89560b320f0fb61d63a18e13c3aac2a1962e6e8d31f2adf5f22136b9e949ff397c05c0781724aa40580f3217e7991fdbe8ac3c3d533f8e1262e7e SHA512 c4290cffa2dd4ce49949ba7e4db2a9ca7e07e22e6c26d814b1876583732ebd31954bbfed95e516125f12083a080209357872af2c7ccdafd4712fb30f922f9da7 +EBUILD automake-1.13.4-r2.ebuild 2643 BLAKE2B cfb0517a6dbee72711d8f25f4a86c8cfd73ba821f3ed58ca86035d380d5b03102f1a56037257515a21247f1e42d74637df2cd71496a74e5bc47c798c72d9699b SHA512 41dd36863935300680001619afe6fa931521bde40e07c1b226899a09a5ed7ed67603074bfeb2dbd1f51dc0d3a3c968e83e4e64c9ab732406a0983e87c95ad79d +EBUILD automake-1.15.1-r2.ebuild 3192 BLAKE2B edd43338af2e12fdc25c419bcf452e014a64f23aac91d57d727d61a4125dcc047406a954b8d3b5d02a6232b528b25dc2b4d210e9caf76814453f9793d1a7ca7c SHA512 6de009d30ad3126f93f1c3b705ef44181a385e042488aa206cdc5a9aa7e518da79e80d5853e8f4f73fb3b3c682882afc48bec625ea7a881c63ca7d675a605c2d +EBUILD automake-1.16.3-r1.ebuild 3518 BLAKE2B fa4a284c5f1564170e2d2ba0dc6f7e414d0a947b05c8b59e53a9622f93827add33d4551de53fff5fefd0e85b2fe7d9ddbe7e9032fee21b7ba6cf6a27cf217c02 SHA512 6c45e29f1304a2d219774359025c23c7a8bd20b99317c6a2c6275ab15eba935ac716da256411d002622574c4a48de9684f6fed2c4e4f6cb9e0bae1d27f8725c0 +EBUILD automake-1.16.4.ebuild 3518 BLAKE2B fa4a284c5f1564170e2d2ba0dc6f7e414d0a947b05c8b59e53a9622f93827add33d4551de53fff5fefd0e85b2fe7d9ddbe7e9032fee21b7ba6cf6a27cf217c02 SHA512 6c45e29f1304a2d219774359025c23c7a8bd20b99317c6a2c6275ab15eba935ac716da256411d002622574c4a48de9684f6fed2c4e4f6cb9e0bae1d27f8725c0 +EBUILD automake-1.16.5.ebuild 3526 BLAKE2B 2983d453d694de228a3206e1e2e95798768c7101af3b59287e16b0bbf2563c12deba911d9dae7a2bb0a62c2f23bb90e571a0788ebe41570d299afb860aed7691 SHA512 859c9074b0be85ffadf4c0791faee51ab4153c31a5ad99bbad0811856011f2218ea2b028f9d3ea5698fc41d7f0d36c08be5357784b75507d470f9fb205fa1091 +EBUILD automake-9999.ebuild 3438 BLAKE2B 120512bd6dafdd2c420159c87ebb547f3fc9fb2fc7614bd6334032a6402e76e3b4dc6a39f9e331ecc5b8eac354af5bf3661697973bbeaa42ee77215dc5f039e8 SHA512 a0c14464bc86c69ca843333db6cb8c154219c1493ec49dfe53cea86b2681962f51a65aea1e80490f81bf04b2d1983fa0322608f7d4d0839b4f883594a2c3eaa9 +MISC automake-1.11.6-r3.ebuild.1 2566 BLAKE2B c1e28e5349f89560b320f0fb61d63a18e13c3aac2a1962e6e8d31f2adf5f22136b9e949ff397c05c0781724aa40580f3217e7991fdbe8ac3c3d533f8e1262e7e SHA512 c4290cffa2dd4ce49949ba7e4db2a9ca7e07e22e6c26d814b1876583732ebd31954bbfed95e516125f12083a080209357872af2c7ccdafd4712fb30f922f9da7 +MISC metadata.xml 332 BLAKE2B d33ce6b379d5d8d44ae9104f3e5c5a0b5b25682072f7222bdd6dd92b97123b3cc011ed078178a8d2cb9e3e3d1da03dde67b3a844374819fdb67b879341a8a5fa SHA512 ad4477b610e680468526c77df5550b44f8d0558237aac887312a463d4da29216a63db372710398d0eb478550550507e81421d1deee272038b3658c38b84e5b06 diff --git a/sys-devel/automake/automake-1.11.6-r3.ebuild b/sys-devel/automake/automake-1.11.6-r3.ebuild new file mode 100644 index 0000000..8b96c4f --- /dev/null +++ b/sys-devel/automake/automake-1.11.6-r3.ebuild @@ -0,0 +1,98 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="Used to generate Makefile.in from Makefile.am" +HOMEPAGE="https://www.gnu.org/software/automake/" +SRC_URI="mirror://gnu/${PN}/${P}.tar.xz" + +LICENSE="GPL-2" +# Use Gentoo versioning for slotting. +SLOT="${PV:0:4}" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" +IUSE="" +RESTRICT="test" + +RDEPEND="dev-lang/perl + >=sys-devel/automake-wrapper-10 + >=sys-devel/autoconf-2.69:* + sys-devel/gnuconfig" +DEPEND="${RDEPEND} + sys-apps/help2man" +BDEPEND="app-arch/gzip" + +PATCHES=( + "${FILESDIR}"/${PN}-1.10-perl-5.16.patch #424453 + "${FILESDIR}"/${PN}-1.11-install-sh-avoid-low-risk-race-in-tmp.patch + "${FILESDIR}"/${PN}-1.13-perl-escape-curly-bracket-r1.patch +) + +src_prepare() { + default + export WANT_AUTOCONF=2.5 + export HELP2MAN=true + sed -i -e "/APIVERSION=/s:=.*:=${SLOT}:" configure || die + export TZ="UTC" #589138 +} + +src_compile() { + default + + local x + for x in aclocal automake; do + help2man "perl -Ilib ${x}" > doc/${x}-${SLOT}.1 + done +} + +# slot the info pages. do this w/out munging the source so we don't have +# to depend on texinfo to regen things. #464146 (among others) +slot_info_pages() { + pushd "${ED}"/usr/share/info >/dev/null || die + rm -f dir || die + + # Rewrite all the references to other pages. + # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4. + # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4. + local p pages=( *.info ) args=() + for p in "${pages[@]/%.info}" ; do + args+=( + -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|" + -e "s:(${p}):(${p}-${SLOT}):g" + ) + done + sed -i "${args[@]}" * || die + + # Rewrite all the file references, and rename them in the process. + local f d + for f in * ; do + d=${f/.info/-${SLOT}.info} + mv "${f}" "${d}" || die + sed -i -e "s:${f}:${d}:g" * || die + done + + popd >/dev/null || die +} + +src_install() { + default + slot_info_pages + + rm \ + "${ED}"/usr/bin/{aclocal,automake} \ + "${ED}"/usr/share/man/man1/{aclocal,automake}.1 || die + + # remove all config.guess and config.sub files replacing them + # w/a symlink to a specific gnuconfig version + local x + for x in guess sub ; do + dosym ../gnuconfig/config.${x} \ + /usr/share/${PN}-${SLOT}/config.${x} + done + + # Avoid QA message about pre-compressed file in docs + local tarfile="${ED}/usr/share/doc/${PF}/amhello-1.0.tar.gz" + if [[ -f "${tarfile}" ]] ; then + gunzip "${tarfile}" || die + fi +} diff --git a/sys-devel/automake/automake-1.11.6-r3.ebuild.1 b/sys-devel/automake/automake-1.11.6-r3.ebuild.1 new file mode 100644 index 0000000..8b96c4f --- /dev/null +++ b/sys-devel/automake/automake-1.11.6-r3.ebuild.1 @@ -0,0 +1,98 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="Used to generate Makefile.in from Makefile.am" +HOMEPAGE="https://www.gnu.org/software/automake/" +SRC_URI="mirror://gnu/${PN}/${P}.tar.xz" + +LICENSE="GPL-2" +# Use Gentoo versioning for slotting. +SLOT="${PV:0:4}" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" +IUSE="" +RESTRICT="test" + +RDEPEND="dev-lang/perl + >=sys-devel/automake-wrapper-10 + >=sys-devel/autoconf-2.69:* + sys-devel/gnuconfig" +DEPEND="${RDEPEND} + sys-apps/help2man" +BDEPEND="app-arch/gzip" + +PATCHES=( + "${FILESDIR}"/${PN}-1.10-perl-5.16.patch #424453 + "${FILESDIR}"/${PN}-1.11-install-sh-avoid-low-risk-race-in-tmp.patch + "${FILESDIR}"/${PN}-1.13-perl-escape-curly-bracket-r1.patch +) + +src_prepare() { + default + export WANT_AUTOCONF=2.5 + export HELP2MAN=true + sed -i -e "/APIVERSION=/s:=.*:=${SLOT}:" configure || die + export TZ="UTC" #589138 +} + +src_compile() { + default + + local x + for x in aclocal automake; do + help2man "perl -Ilib ${x}" > doc/${x}-${SLOT}.1 + done +} + +# slot the info pages. do this w/out munging the source so we don't have +# to depend on texinfo to regen things. #464146 (among others) +slot_info_pages() { + pushd "${ED}"/usr/share/info >/dev/null || die + rm -f dir || die + + # Rewrite all the references to other pages. + # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4. + # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4. + local p pages=( *.info ) args=() + for p in "${pages[@]/%.info}" ; do + args+=( + -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|" + -e "s:(${p}):(${p}-${SLOT}):g" + ) + done + sed -i "${args[@]}" * || die + + # Rewrite all the file references, and rename them in the process. + local f d + for f in * ; do + d=${f/.info/-${SLOT}.info} + mv "${f}" "${d}" || die + sed -i -e "s:${f}:${d}:g" * || die + done + + popd >/dev/null || die +} + +src_install() { + default + slot_info_pages + + rm \ + "${ED}"/usr/bin/{aclocal,automake} \ + "${ED}"/usr/share/man/man1/{aclocal,automake}.1 || die + + # remove all config.guess and config.sub files replacing them + # w/a symlink to a specific gnuconfig version + local x + for x in guess sub ; do + dosym ../gnuconfig/config.${x} \ + /usr/share/${PN}-${SLOT}/config.${x} + done + + # Avoid QA message about pre-compressed file in docs + local tarfile="${ED}/usr/share/doc/${PF}/amhello-1.0.tar.gz" + if [[ -f "${tarfile}" ]] ; then + gunzip "${tarfile}" || die + fi +} diff --git a/sys-devel/automake/automake-1.13.4-r2.ebuild b/sys-devel/automake/automake-1.13.4-r2.ebuild new file mode 100644 index 0000000..2864771 --- /dev/null +++ b/sys-devel/automake/automake-1.13.4-r2.ebuild @@ -0,0 +1,90 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="Used to generate Makefile.in from Makefile.am" +HOMEPAGE="https://www.gnu.org/software/automake/" +SRC_URI="mirror://gnu/${PN}/${P}.tar.xz" + +LICENSE="GPL-2" +# Use Gentoo versioning for slotting. +SLOT="${PV:0:4}" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="" +RESTRICT="test" + +RDEPEND="dev-lang/perl + >=sys-devel/automake-wrapper-10 + >=sys-devel/autoconf-2.69:* + sys-devel/gnuconfig" +DEPEND="${RDEPEND} + sys-apps/help2man" +BDEPEND="app-arch/gzip" + +PATCHES=( + "${FILESDIR}"/${PN}-1.13-dyn-ithreads.patch + "${FILESDIR}"/${PN}-1.13-perl-escape-curly-bracket-r1.patch + "${FILESDIR}"/${PN}-1.13-hash-order-workaround.patch + "${FILESDIR}"/${PN}-1.14-install-sh-avoid-low-risk-race-in-tmp.patch +) + +src_prepare() { + default + export WANT_AUTOCONF=2.5 + sed -i -e "/APIVERSION=/s:=.*:=${SLOT}:" configure || die +} + +# slot the info pages. do this w/out munging the source so we don't have +# to depend on texinfo to regen things. #464146 (among others) +slot_info_pages() { + pushd "${ED}"/usr/share/info >/dev/null || die + rm -f dir || die + + # Rewrite all the references to other pages. + # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4. + # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4. + local p pages=( *.info ) args=() + for p in "${pages[@]/%.info}" ; do + args+=( + -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|" + -e "s:(${p}):(${p}-${SLOT}):g" + ) + done + sed -i "${args[@]}" * || die + + # Rewrite all the file references, and rename them in the process. + local f d + for f in * ; do + d=${f/.info/-${SLOT}.info} + mv "${f}" "${d}" || die + sed -i -e "s:${f}:${d}:g" * || die + done + + popd >/dev/null || die +} + +src_install() { + default + + slot_info_pages + rm "${ED}"/usr/share/aclocal/README || die + rmdir "${ED}"/usr/share/aclocal || die + rm \ + "${ED}"/usr/bin/{aclocal,automake} \ + "${ED}"/usr/share/man/man1/{aclocal,automake}.1 || die + + # remove all config.guess and config.sub files replacing them + # w/a symlink to a specific gnuconfig version + local x + for x in guess sub ; do + dosym ../gnuconfig/config.${x} \ + /usr/share/${PN}-${SLOT}/config.${x} + done + + # Avoid QA message about pre-compressed file in docs + local tarfile="${ED}/usr/share/doc/${PF}/amhello-1.0.tar.gz" + if [[ -f "${tarfile}" ]] ; then + gunzip "${tarfile}" || die + fi +} diff --git a/sys-devel/automake/automake-1.15.1-r2.ebuild b/sys-devel/automake/automake-1.15.1-r2.ebuild new file mode 100644 index 0000000..6162630 --- /dev/null +++ b/sys-devel/automake/automake-1.15.1-r2.ebuild @@ -0,0 +1,111 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.savannah.gnu.org/r/${PN}.git" + + inherit git-r3 +else + KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + if [[ ${PV/_beta} == ${PV} ]]; then + MY_P=${P} + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz + https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + else + MY_PV="$(ver_cut 1).$(($(ver_cut 2)-1))b" + MY_P="${PN}-${MY_PV}" + + # Alpha/beta releases are not distributed on the usual mirrors. + SRC_URI="https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + fi + S="${WORKDIR}/${MY_P}" +fi + +DESCRIPTION="Used to generate Makefile.in from Makefile.am" +HOMEPAGE="https://www.gnu.org/software/automake/" + +LICENSE="GPL-2" +# Use Gentoo versioning for slotting. +SLOT="${PV:0:4}" +IUSE="" +RESTRICT="test" + +RDEPEND="dev-lang/perl + >=sys-devel/automake-wrapper-10 + >=sys-devel/autoconf-2.69:* + sys-devel/gnuconfig" +DEPEND="${RDEPEND} + sys-apps/help2man" +BDEPEND="app-arch/gzip" + +PATCHES=( "${FILESDIR}"/${PN}-1.15-install-sh-avoid-low-risk-race-in-tmp.patch ) + +src_prepare() { + default + export WANT_AUTOCONF=2.5 + # Don't try wrapping the autotools this thing runs as it tends + # to be a bit esoteric, and the script does `set -e` itself. + ./bootstrap || die + sed -i -e "/APIVERSION=/s:=.*:=${SLOT}:" configure || die + + # Bug 628912 + if ! has_version sys-apps/texinfo ; then + touch doc/{stamp-vti,version.texi,automake.info} || die + fi +} + +# slot the info pages. do this w/out munging the source so we don't have +# to depend on texinfo to regen things. #464146 (among others) +slot_info_pages() { + pushd "${ED}"/usr/share/info >/dev/null || die + rm -f dir || die + + # Rewrite all the references to other pages. + # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4. + # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4. + local p pages=( *.info ) args=() + for p in "${pages[@]/%.info}" ; do + args+=( + -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|" + -e "s:(${p}):(${p}-${SLOT}):g" + ) + done + sed -i "${args[@]}" * || die + + # Rewrite all the file references, and rename them in the process. + local f d + for f in * ; do + d=${f/.info/-${SLOT}.info} + mv "${f}" "${d}" || die + sed -i -e "s:${f}:${d}:g" * || die + done + + popd >/dev/null || die +} + +src_install() { + default + + slot_info_pages + rm "${ED}"/usr/share/aclocal/README || die + rmdir "${ED}"/usr/share/aclocal || die + rm \ + "${ED}"/usr/bin/{aclocal,automake} \ + "${ED}"/usr/share/man/man1/{aclocal,automake}.1 || die + + # remove all config.guess and config.sub files replacing them + # w/a symlink to a specific gnuconfig version + local x + for x in guess sub ; do + dosym ../gnuconfig/config.${x} \ + /usr/share/${PN}-${SLOT}/config.${x} + done + + # Avoid QA message about pre-compressed file in docs + local tarfile="${ED}/usr/share/doc/${PF}/amhello-1.0.tar.gz" + if [[ -f "${tarfile}" ]] ; then + gunzip "${tarfile}" || die + fi +} diff --git a/sys-devel/automake/automake-1.16.3-r1.ebuild b/sys-devel/automake/automake-1.16.3-r1.ebuild new file mode 100644 index 0000000..6908170 --- /dev/null +++ b/sys-devel/automake/automake-1.16.3-r1.ebuild @@ -0,0 +1,131 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python3_{8,9,10} ) + +inherit python-any-r1 + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.savannah.gnu.org/r/${PN}.git" + + inherit git-r3 +else + KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + if [[ ${PV/_beta} == ${PV} ]]; then + MY_P="${P}" + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz + https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + else + MY_PV="$(ver_cut 1).$(($(ver_cut 2)-1))b" + MY_P="${PN}-${MY_PV}" + + # Alpha/beta releases are not distributed on the usual mirrors. + SRC_URI="https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + fi + S="${WORKDIR}/${MY_P}" +fi + +DESCRIPTION="Used to generate Makefile.in from Makefile.am" +HOMEPAGE="https://www.gnu.org/software/automake/" + +LICENSE="GPL-2" +# Use Gentoo versioning for slotting. +SLOT="${PV:0:4}" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND="dev-lang/perl + >=sys-devel/automake-wrapper-11 + >=sys-devel/autoconf-2.69:* + sys-devel/gnuconfig" +DEPEND="${RDEPEND}" +BDEPEND=" + app-arch/gzip + sys-apps/help2man + test? ( ${PYTHON_DEPS} ) +" + +PATCHES=( + "${FILESDIR}"/automake-1.16.2-py3-compile.patch + "${FILESDIR}"/automake-1.16.2-fix-instmany-python.sh-test.patch + "${FILESDIR}"/automake-1.16.2-fix-py-compile-basedir.sh-test.patch +) + +pkg_setup() { + # Avoid python-any-r1_pkg_setup + : +} + +src_prepare() { + default + export WANT_AUTOCONF=2.5 + # Don't try wrapping the autotools this thing runs as it tends + # to be a bit esoteric, and the script does `set -e` itself. + ./bootstrap || die + sed -i -e "/APIVERSION=/s:=.*:=${SLOT}:" configure || die + + # Bug 628912 + if ! has_version sys-apps/texinfo ; then + touch doc/{stamp-vti,version.texi,automake.info} || die + fi +} + +src_configure() { + use test && python_setup + default +} + +# slot the info pages. do this w/out munging the source so we don't have +# to depend on texinfo to regen things. #464146 (among others) +slot_info_pages() { + pushd "${ED}"/usr/share/info >/dev/null || die + rm -f dir + + # Rewrite all the references to other pages. + # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4. + # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4. + local p pages=( *.info ) args=() + for p in "${pages[@]/%.info}" ; do + args+=( + -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|" + -e "s:(${p}):(${p}-${SLOT}):g" + ) + done + sed -i "${args[@]}" * || die + + # Rewrite all the file references, and rename them in the process. + local f d + for f in * ; do + d=${f/.info/-${SLOT}.info} + mv "${f}" "${d}" || die + sed -i -e "s:${f}:${d}:g" * || die + done + + popd >/dev/null || die +} + +src_install() { + default + + slot_info_pages + rm "${ED}"/usr/share/aclocal/README || die + rmdir "${ED}"/usr/share/aclocal || die + rm \ + "${ED}"/usr/bin/{aclocal,automake} \ + "${ED}"/usr/share/man/man1/{aclocal,automake}.1 || die + + # remove all config.guess and config.sub files replacing them + # w/a symlink to a specific gnuconfig version + local x + for x in guess sub ; do + dosym ../gnuconfig/config.${x} \ + /usr/share/${PN}-${SLOT}/config.${x} + done + + # Avoid QA message about pre-compressed file in docs + local tarfile="${ED}/usr/share/doc/${PF}/amhello-1.0.tar.gz" + if [[ -f "${tarfile}" ]] ; then + gunzip "${tarfile}" || die + fi +} diff --git a/sys-devel/automake/automake-1.16.4.ebuild b/sys-devel/automake/automake-1.16.4.ebuild new file mode 100644 index 0000000..6908170 --- /dev/null +++ b/sys-devel/automake/automake-1.16.4.ebuild @@ -0,0 +1,131 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python3_{8,9,10} ) + +inherit python-any-r1 + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.savannah.gnu.org/r/${PN}.git" + + inherit git-r3 +else + KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + if [[ ${PV/_beta} == ${PV} ]]; then + MY_P="${P}" + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz + https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + else + MY_PV="$(ver_cut 1).$(($(ver_cut 2)-1))b" + MY_P="${PN}-${MY_PV}" + + # Alpha/beta releases are not distributed on the usual mirrors. + SRC_URI="https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + fi + S="${WORKDIR}/${MY_P}" +fi + +DESCRIPTION="Used to generate Makefile.in from Makefile.am" +HOMEPAGE="https://www.gnu.org/software/automake/" + +LICENSE="GPL-2" +# Use Gentoo versioning for slotting. +SLOT="${PV:0:4}" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND="dev-lang/perl + >=sys-devel/automake-wrapper-11 + >=sys-devel/autoconf-2.69:* + sys-devel/gnuconfig" +DEPEND="${RDEPEND}" +BDEPEND=" + app-arch/gzip + sys-apps/help2man + test? ( ${PYTHON_DEPS} ) +" + +PATCHES=( + "${FILESDIR}"/automake-1.16.2-py3-compile.patch + "${FILESDIR}"/automake-1.16.2-fix-instmany-python.sh-test.patch + "${FILESDIR}"/automake-1.16.2-fix-py-compile-basedir.sh-test.patch +) + +pkg_setup() { + # Avoid python-any-r1_pkg_setup + : +} + +src_prepare() { + default + export WANT_AUTOCONF=2.5 + # Don't try wrapping the autotools this thing runs as it tends + # to be a bit esoteric, and the script does `set -e` itself. + ./bootstrap || die + sed -i -e "/APIVERSION=/s:=.*:=${SLOT}:" configure || die + + # Bug 628912 + if ! has_version sys-apps/texinfo ; then + touch doc/{stamp-vti,version.texi,automake.info} || die + fi +} + +src_configure() { + use test && python_setup + default +} + +# slot the info pages. do this w/out munging the source so we don't have +# to depend on texinfo to regen things. #464146 (among others) +slot_info_pages() { + pushd "${ED}"/usr/share/info >/dev/null || die + rm -f dir + + # Rewrite all the references to other pages. + # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4. + # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4. + local p pages=( *.info ) args=() + for p in "${pages[@]/%.info}" ; do + args+=( + -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|" + -e "s:(${p}):(${p}-${SLOT}):g" + ) + done + sed -i "${args[@]}" * || die + + # Rewrite all the file references, and rename them in the process. + local f d + for f in * ; do + d=${f/.info/-${SLOT}.info} + mv "${f}" "${d}" || die + sed -i -e "s:${f}:${d}:g" * || die + done + + popd >/dev/null || die +} + +src_install() { + default + + slot_info_pages + rm "${ED}"/usr/share/aclocal/README || die + rmdir "${ED}"/usr/share/aclocal || die + rm \ + "${ED}"/usr/bin/{aclocal,automake} \ + "${ED}"/usr/share/man/man1/{aclocal,automake}.1 || die + + # remove all config.guess and config.sub files replacing them + # w/a symlink to a specific gnuconfig version + local x + for x in guess sub ; do + dosym ../gnuconfig/config.${x} \ + /usr/share/${PN}-${SLOT}/config.${x} + done + + # Avoid QA message about pre-compressed file in docs + local tarfile="${ED}/usr/share/doc/${PF}/amhello-1.0.tar.gz" + if [[ -f "${tarfile}" ]] ; then + gunzip "${tarfile}" || die + fi +} diff --git a/sys-devel/automake/automake-1.16.5.ebuild b/sys-devel/automake/automake-1.16.5.ebuild new file mode 100644 index 0000000..a9dc19e --- /dev/null +++ b/sys-devel/automake/automake-1.16.5.ebuild @@ -0,0 +1,131 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python3_{8,9,10} ) + +inherit python-any-r1 + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.savannah.gnu.org/r/${PN}.git" + + inherit git-r3 +else + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + if [[ ${PV/_beta} == ${PV} ]]; then + MY_P="${P}" + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz + https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + else + MY_PV="$(ver_cut 1).$(($(ver_cut 2)-1))b" + MY_P="${PN}-${MY_PV}" + + # Alpha/beta releases are not distributed on the usual mirrors. + SRC_URI="https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + fi + S="${WORKDIR}/${MY_P}" +fi + +DESCRIPTION="Used to generate Makefile.in from Makefile.am" +HOMEPAGE="https://www.gnu.org/software/automake/" + +LICENSE="GPL-2" +# Use Gentoo versioning for slotting. +SLOT="${PV:0:4}" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND="dev-lang/perl + >=sys-devel/automake-wrapper-11 + >=sys-devel/autoconf-2.69:* + sys-devel/gnuconfig" +DEPEND="${RDEPEND}" +BDEPEND=" + app-arch/gzip + sys-apps/help2man + test? ( ${PYTHON_DEPS} ) +" + +PATCHES=( + "${FILESDIR}"/automake-1.16.2-py3-compile.patch + "${FILESDIR}"/automake-1.16.2-fix-instmany-python.sh-test.patch + "${FILESDIR}"/automake-1.16.2-fix-py-compile-basedir.sh-test.patch +) + +pkg_setup() { + # Avoid python-any-r1_pkg_setup + : +} + +src_prepare() { + default + export WANT_AUTOCONF=2.5 + # Don't try wrapping the autotools this thing runs as it tends + # to be a bit esoteric, and the script does `set -e` itself. + ./bootstrap || die + sed -i -e "/APIVERSION=/s:=.*:=${SLOT}:" configure || die + + # Bug 628912 + if ! has_version sys-apps/texinfo ; then + touch doc/{stamp-vti,version.texi,automake.info} || die + fi +} + +src_configure() { + use test && python_setup + default +} + +# slot the info pages. do this w/out munging the source so we don't have +# to depend on texinfo to regen things. #464146 (among others) +slot_info_pages() { + pushd "${ED}"/usr/share/info >/dev/null || die + rm -f dir + + # Rewrite all the references to other pages. + # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4. + # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4. + local p pages=( *.info ) args=() + for p in "${pages[@]/%.info}" ; do + args+=( + -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|" + -e "s:(${p}):(${p}-${SLOT}):g" + ) + done + sed -i "${args[@]}" * || die + + # Rewrite all the file references, and rename them in the process. + local f d + for f in * ; do + d=${f/.info/-${SLOT}.info} + mv "${f}" "${d}" || die + sed -i -e "s:${f}:${d}:g" * || die + done + + popd >/dev/null || die +} + +src_install() { + default + + slot_info_pages + rm "${ED}"/usr/share/aclocal/README || die + rmdir "${ED}"/usr/share/aclocal || die + rm \ + "${ED}"/usr/bin/{aclocal,automake} \ + "${ED}"/usr/share/man/man1/{aclocal,automake}.1 || die + + # remove all config.guess and config.sub files replacing them + # w/a symlink to a specific gnuconfig version + local x + for x in guess sub ; do + dosym ../gnuconfig/config.${x} \ + /usr/share/${PN}-${SLOT}/config.${x} + done + + # Avoid QA message about pre-compressed file in docs + local tarfile="${ED}/usr/share/doc/${PF}/amhello-1.0.tar.gz" + if [[ -f "${tarfile}" ]] ; then + gunzip "${tarfile}" || die + fi +} diff --git a/sys-devel/automake/automake-9999.ebuild b/sys-devel/automake/automake-9999.ebuild new file mode 100644 index 0000000..d5f4649 --- /dev/null +++ b/sys-devel/automake/automake-9999.ebuild @@ -0,0 +1,130 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8,9,10} ) + +inherit python-any-r1 + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.savannah.gnu.org/r/${PN}.git" + inherit git-r3 +else + if [[ ${PV/_beta} == ${PV} ]]; then + MY_P="${P}" + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz + https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + else + MY_PV="$(ver_cut 1).$(($(ver_cut 2)-1))b" + MY_P="${PN}-${MY_PV}" + + # Alpha/beta releases are not distributed on the usual mirrors. + SRC_URI="https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz" + fi + S="${WORKDIR}/${MY_P}" +fi + +DESCRIPTION="Used to generate Makefile.in from Makefile.am" +HOMEPAGE="https://www.gnu.org/software/automake/" + +LICENSE="GPL-2" +# Use Gentoo versioning for slotting. +SLOT="${PV:0:4}" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND="dev-lang/perl + >=sys-devel/automake-wrapper-11 + >=sys-devel/autoconf-2.69:* + sys-devel/gnuconfig" +DEPEND="${RDEPEND}" +BDEPEND=" + app-arch/gzip + sys-apps/help2man + test? ( ${PYTHON_DEPS} ) +" + +PATCHES=( + "${FILESDIR}"/automake-1.16.2-py3-compile.patch +) +# All patches have been submitted upstream. + +pkg_setup() { + # Avoid python-any-r1_pkg_setup + : +} + +src_prepare() { + default + export WANT_AUTOCONF=2.5 + # Don't try wrapping the autotools this thing runs as it tends + # to be a bit esoteric, and the script does `set -e` itself. + ./bootstrap || die + sed -i -e "/APIVERSION=/s:=.*:=${SLOT}:" configure || die + + # Bug 628912 + if ! has_version sys-apps/texinfo ; then + touch doc/{stamp-vti,version.texi,automake.info} || die + fi +} + +src_configure() { + use test && python_setup + default +} + +# slot the info pages. do this w/out munging the source so we don't have +# to depend on texinfo to regen things. #464146 (among others) +slot_info_pages() { + pushd "${ED}"/usr/share/info >/dev/null || die + rm -f dir + + # Rewrite all the references to other pages. + # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4. + # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4. + local p pages=( *.info ) args=() + for p in "${pages[@]/%.info}" ; do + args+=( + -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|" + -e "s:(${p}):(${p}-${SLOT}):g" + ) + done + sed -i "${args[@]}" * || die + + # Rewrite all the file references, and rename them in the process. + local f d + for f in * ; do + d=${f/.info/-${SLOT}.info} + mv "${f}" "${d}" || die + sed -i -e "s:${f}:${d}:g" * || die + done + + popd >/dev/null || die +} + +src_install() { + default + + slot_info_pages + rm "${ED}"/usr/share/aclocal/README || die + rmdir "${ED}"/usr/share/aclocal || die + rm \ + "${ED}"/usr/bin/{aclocal,automake} \ + "${ED}"/usr/share/man/man1/{aclocal,automake}.1 || die + + # remove all config.guess and config.sub files replacing them + # w/a symlink to a specific gnuconfig version + local x + for x in guess sub ; do + dosym ../gnuconfig/config.${x} \ + /usr/share/${PN}-${SLOT}/config.${x} + done + + # Avoid QA message about pre-compressed file in docs + local tarfile="${ED}/usr/share/doc/${PF}/amhello-1.0.tar.gz" + if [[ -f "${tarfile}" ]] ; then + gunzip "${tarfile}" || die + fi +} diff --git a/sys-devel/automake/files/automake-1.10-perl-5.16.patch b/sys-devel/automake/files/automake-1.10-perl-5.16.patch new file mode 100644 index 0000000..19fe249 --- /dev/null +++ b/sys-devel/automake/files/automake-1.10-perl-5.16.patch @@ -0,0 +1,128 @@ +https://bugs.gentoo.org/424453 + +From 6bf58a59a1f3803e57e3f0378aa9344686707b75 Mon Sep 17 00:00:00 2001 +From: Stefano Lattarini <stefano.lattarini@gmail.com> +Date: Mon, 28 May 2012 13:32:03 +0200 +Subject: [PATCH] aclocal: declare function prototypes, do not use '&' in + function calls + +This change will also fix automake bug#11543 (from a report by Matt +Burgess). + +* aclocal.in: Declare prototypes for almost all functions early, before +any actual function definition (but omit the prototype for the dynamically +generated '&search' function). Add prototypes to any function definition. +Remove '&' from function invocations (i.e., simply use "func(ARGS..)" +instead of "&func(ARGS...)"). +* THANKS, NEWS: Update. + +Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> +--- + NEWS | 4 ++++ + THANKS | 1 + + aclocal.in | 42 ++++++++++++++++++++++++++++++++++-------- + 3 files changed, 39 insertions(+), 8 deletions(-) + +diff --git a/aclocal.in b/aclocal.in +index dfb851b..e8855d5 100644 +--- a/aclocal.in ++++ b/aclocal.in +@@ -152,8 +152,34 @@ my $erase_me; + + ################################################################ + ++# Prototypes for all subroutines. ++ ++sub unlink_tmp (;$); ++sub xmkdir_p ($); ++sub check_acinclude (); ++sub reset_maps (); ++sub install_file ($$); ++sub list_compare (\@\@); ++sub scan_m4_dirs ($@); ++sub scan_m4_files (); ++sub add_macro ($); ++sub scan_configure_dep ($); ++sub add_file ($); ++sub scan_file ($$$); ++sub strip_redundant_includes (%); ++sub trace_used_macros (); ++sub scan_configure (); ++sub write_aclocal ($@); ++sub usage ($); ++sub version (); ++sub handle_acdir_option ($$); ++sub parse_arguments (); ++sub parse_ACLOCAL_PATH (); ++ ++################################################################ ++ + # Erase temporary file ERASE_ME. Handle signals. +-sub unlink_tmp ++sub unlink_tmp (;$) + { + my ($sig) = @_; + +@@ -350,7 +376,7 @@ sub scan_m4_dirs ($@) + next if $file eq 'aclocal.m4'; + + my $fullfile = File::Spec->canonpath ("$m4dir/$file"); +- &scan_file ($type, $fullfile, 'aclocal'); ++ scan_file ($type, $fullfile, 'aclocal'); + } + closedir (DIR); + } +@@ -361,12 +387,12 @@ sub scan_m4_files () + { + # First, scan configure.ac. It may contain macro definitions, + # or may include other files that define macros. +- &scan_file (FT_USER, $configure_ac, 'aclocal'); ++ scan_file (FT_USER, $configure_ac, 'aclocal'); + + # Then, scan acinclude.m4 if it exists. + if (-f 'acinclude.m4') + { +- &scan_file (FT_USER, 'acinclude.m4', 'aclocal'); ++ scan_file (FT_USER, 'acinclude.m4', 'aclocal'); + } + + # Finally, scan all files in our search paths. +@@ -380,7 +406,7 @@ sub scan_m4_files () + my $search = "sub search {\nmy \$found = 0;\n"; + foreach my $key (reverse sort keys %map) + { +- $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { & add_macro ("' . $key ++ $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { add_macro ("' . $key + . '"); $found = 1; }' . "\n"); + } + $search .= "return \$found;\n};\n"; +@@ -403,7 +429,7 @@ sub add_macro ($) + + verb "saw macro $macro"; + $macro_seen{$macro} = 1; +- &add_file ($map{$macro}); ++ add_file ($map{$macro}); + } + + # scan_configure_dep ($file) +@@ -465,7 +491,7 @@ sub scan_configure_dep ($) + } + + add_macro ($_) foreach (@rlist); +- &scan_configure_dep ($_) foreach @ilist; ++ scan_configure_dep ($_) foreach @ilist; + } + + # add_file ($FILE) +@@ -931,7 +957,7 @@ EOF + } + + # Print version and exit. +-sub version() ++sub version () + { + print <<EOF; + aclocal (GNU $PACKAGE) $VERSION +-- +2.1.3 + diff --git a/sys-devel/automake/files/automake-1.11-install-sh-avoid-low-risk-race-in-tmp.patch b/sys-devel/automake/files/automake-1.11-install-sh-avoid-low-risk-race-in-tmp.patch new file mode 100644 index 0000000..c435b90 --- /dev/null +++ b/sys-devel/automake/files/automake-1.11-install-sh-avoid-low-risk-race-in-tmp.patch @@ -0,0 +1,77 @@ +From: Pavel Raiskup <praiskup@redhat.com> +Date: Sat, 15 Aug 2015 04:40:57 -0400 +Subject: install-sh: avoid (low risk) race in /tmp + +Ensure that nobody can cross privilege boundaries by pre-creating +symlink on '$tmpdir' path. + +Just testing 'mkdir -p' by creating '/tmp/ins$RANDOM-$$/d' is not +safe because '/tmp' directory is usually world-writeable and +'/tmp/ins$RANDOM-$$' content could be pretty easily guessed by +attacker (at least for shells where $RANDOM is not supported). +So, as the first step, create the '/tmp/ins$RANDOM-$$' without -p. +This step would fail early if somebody wanted catch us. + +Note that systems that implement (and have enabled) +fs.protected_symlinks kernel feature are not affected even without +this commit. + +References: +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=760455 +https://bugzilla.redhat.com/show_bug.cgi?id=1140725 + +* lib/install-sh: Implement safer 'mkdir -p' test by running +'$mkdirprog $mkdir_mode "$tmpdir"' first. +(scriptversion): Bump. + +--- a/lib/install-sh ++++ b/lib/install-sh +@@ -345,34 +345,41 @@ do + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) ++ # $RANDOM is not portable (e.g. dash); use it when possible to ++ # lower collision chance + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ +- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 ++ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 + ++ # As "mkdir -p" follows symlinks and we work in /tmp possibly; so ++ # create the $tmpdir first (and fail if unsuccessful) to make sure ++ # that nobody tries to guess the $tmpdir name. + if (umask $mkdir_umask && +- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 ++ $mkdirprog $mkdir_mode "$tmpdir" && ++ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. +- ls_ld_tmpdir=`ls -ld "$tmpdir"` ++ test_tmpdir="$tmpdir/a" ++ ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && +- $mkdirprog -m$different_mode -p -- "$tmpdir" && { +- ls_ld_tmpdir_1=`ls -ld "$tmpdir"` ++ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ++ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi +- rmdir "$tmpdir/d" "$tmpdir" ++ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. +- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null ++ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac;; diff --git a/sys-devel/automake/files/automake-1.13-dyn-ithreads.patch b/sys-devel/automake/files/automake-1.13-dyn-ithreads.patch new file mode 100644 index 0000000..f790e77 --- /dev/null +++ b/sys-devel/automake/files/automake-1.13-dyn-ithreads.patch @@ -0,0 +1,59 @@ +https://bugs.gentoo.org/343439 + +From 182626687f2640609f8eb28ad1b04b078342f2c7 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Sat, 12 Jan 2013 00:19:40 -0500 +Subject: [PATCH] ithreads: use runtime (not configure time) detection of perl + threads + +I can't imagine the runtime checks being a big runtime penalty, so there +shouldn't be a need to do the checks at configure check and hardcode the +result in the generated automake. + +With the current system, it means if you change your perl config (build +perl w/threads, build automake, build perl w/out threads), or deploy a +compiled automake package on a different system (build had threads, but +deployed system does not), you get errors when trying to run automake. + +So take the logic from configure.ac and move it to the one place where +PERL_THREADS is used (lib/Automake/Config.in) and do the version/config +checking at runtime. + +* bootstrap.sh (PERL_THREADS): Delete assignment and use in sed. +* configure.ac (am_cv_prog_PERL_ithreads, PERL_THREADS): Delete all code +related to these two variables. +* lib/Automake/Config.in (perl_threads): Initialize to 0, and only set to +1 if the perl version is at least 5.007_002, and useithreads is in Config. + +Copyright-paperwork-exempt: yes +Signed-off-by: Mike Frysinger <vapier@gentoo.org> +Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> +--- + bootstrap.sh | 2 -- + configure.ac | 26 -------------------------- + lib/Automake/Config.in | 9 ++++++++- + 3 files changed, 8 insertions(+), 29 deletions(-) + +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index fe6ef9d..885e74e 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -33,7 +33,14 @@ our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; + our $libdir = '@datadir@/@PACKAGE@-@APIVERSION@'; +-our $perl_threads = @PERL_THREADS@; ++ ++our $perl_threads = 0; ++# We need at least this version for CLONE support. ++if (eval { require 5.007_002; }) ++ { ++ use Config; ++ $perl_threads = $Config{useithreads}; ++ } + + 1; + +-- +1.8.0.2 + diff --git a/sys-devel/automake/files/automake-1.13-hash-order-workaround.patch b/sys-devel/automake/files/automake-1.13-hash-order-workaround.patch new file mode 100644 index 0000000..79b81e6 --- /dev/null +++ b/sys-devel/automake/files/automake-1.13-hash-order-workaround.patch @@ -0,0 +1,14 @@ +--- a/t/primary-prefix-invalid-couples.tap ++++ b/t/primary-prefix-invalid-couples.tap +@@ -186,8 +186,10 @@ grep -v 'dir.* not a legitimate directory' stderr && exit 1 + # Check that the same failures are present without the '--add-missing' + # option. + mv stderr stderr.old ++cat stderr.old | sort > a + AUTOMAKE_fails -d "automake error out on mismatched prefix/primary couples" ++cat stderr | sort > b + command_ok_ "... and with the same diagnostic of 'automake -a'" \ +- diff stderr.old stderr ++ diff a b + + : diff --git a/sys-devel/automake/files/automake-1.13-perl-escape-curly-bracket-r1.patch b/sys-devel/automake/files/automake-1.13-perl-escape-curly-bracket-r1.patch new file mode 100644 index 0000000..bf8819a --- /dev/null +++ b/sys-devel/automake/files/automake-1.13-perl-escape-curly-bracket-r1.patch @@ -0,0 +1,37 @@ +http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21001 + +From 34163794a58b5bd91c5d6bd9adf5437571c7a479 Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup <praiskup@redhat.com> +Date: Tue, 7 Jul 2015 10:54:24 +0200 +Subject: [PATCH] bin/automake: escape '{' in regexp pattern + +Based on perlre(1) documentation: +.. in Perl v5.26, literal uses of a curly bracket will be required +to be escaped, say by preceding them with a backslash ("\{" ) or +enclosing them within square brackets ("[{]") .. + +References: +https://bugzilla.redhat.com/1239379 + +* bin/automake.in (substitute_ac_subst_variables): Escape the +occurrence of '{' character. +--- + bin/automake.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bin/automake.in b/bin/automake.in +index 0c29184..c294ced 100644 +--- a/automake.in ++++ b/automake.in +@@ -3898,7 +3898,7 @@ sub substitute_ac_subst_variables_worker + sub substitute_ac_subst_variables ($) + { + my ($text) = @_; +- $text =~ s/\${([^ \t=:+{}]+)}/&substitute_ac_subst_variables_worker ($1)/ge; ++ $text =~ s/\$\{([^ \t=:+{}]+)}/&substitute_ac_subst_variables_worker ($1)/ge; + return $text; + } + +-- +2.1.0 + diff --git a/sys-devel/automake/files/automake-1.14-install-sh-avoid-low-risk-race-in-tmp.patch b/sys-devel/automake/files/automake-1.14-install-sh-avoid-low-risk-race-in-tmp.patch new file mode 100644 index 0000000..6793706 --- /dev/null +++ b/sys-devel/automake/files/automake-1.14-install-sh-avoid-low-risk-race-in-tmp.patch @@ -0,0 +1,77 @@ +From: Pavel Raiskup <praiskup@redhat.com> +Date: Sat, 15 Aug 2015 04:40:57 -0400 +Subject: install-sh: avoid (low risk) race in /tmp + +Ensure that nobody can cross privilege boundaries by pre-creating +symlink on '$tmpdir' path. + +Just testing 'mkdir -p' by creating '/tmp/ins$RANDOM-$$/d' is not +safe because '/tmp' directory is usually world-writeable and +'/tmp/ins$RANDOM-$$' content could be pretty easily guessed by +attacker (at least for shells where $RANDOM is not supported). +So, as the first step, create the '/tmp/ins$RANDOM-$$' without -p. +This step would fail early if somebody wanted catch us. + +Note that systems that implement (and have enabled) +fs.protected_symlinks kernel feature are not affected even without +this commit. + +References: +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=760455 +https://bugzilla.redhat.com/show_bug.cgi?id=1140725 + +* lib/install-sh: Implement safer 'mkdir -p' test by running +'$mkdirprog $mkdir_mode "$tmpdir"' first. +(scriptversion): Bump. + +--- a/lib/install-sh ++++ b/lib/install-sh +@@ -345,34 +345,41 @@ do + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) ++ # $RANDOM is not portable (e.g. dash); use it when possible to ++ # lower collision chance + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ +- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 ++ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 + ++ # As "mkdir -p" follows symlinks and we work in /tmp possibly; so ++ # create the $tmpdir first (and fail if unsuccessful) to make sure ++ # that nobody tries to guess the $tmpdir name. + if (umask $mkdir_umask && +- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 ++ $mkdirprog $mkdir_mode "$tmpdir" && ++ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. +- ls_ld_tmpdir=`ls -ld "$tmpdir"` ++ test_tmpdir="$tmpdir/a" ++ ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && +- $mkdirprog -m$different_mode -p -- "$tmpdir" && { +- ls_ld_tmpdir_1=`ls -ld "$tmpdir"` ++ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ++ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi +- rmdir "$tmpdir/d" "$tmpdir" ++ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. +- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null ++ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac;; diff --git a/sys-devel/automake/files/automake-1.15-install-sh-avoid-low-risk-race-in-tmp.patch b/sys-devel/automake/files/automake-1.15-install-sh-avoid-low-risk-race-in-tmp.patch new file mode 100644 index 0000000..1fabdd5 --- /dev/null +++ b/sys-devel/automake/files/automake-1.15-install-sh-avoid-low-risk-race-in-tmp.patch @@ -0,0 +1,82 @@ +From: Pavel Raiskup <praiskup@redhat.com> +Date: Sat, 15 Aug 2015 04:40:57 -0400 +Subject: install-sh: avoid (low risk) race in /tmp + +Ensure that nobody can cross privilege boundaries by pre-creating +symlink on '$tmpdir' path. + +Just testing 'mkdir -p' by creating '/tmp/ins$RANDOM-$$/d' is not +safe because '/tmp' directory is usually world-writeable and +'/tmp/ins$RANDOM-$$' content could be pretty easily guessed by +attacker (at least for shells where $RANDOM is not supported). +So, as the first step, create the '/tmp/ins$RANDOM-$$' without -p. +This step would fail early if somebody wanted catch us. + +Note that systems that implement (and have enabled) +fs.protected_symlinks kernel feature are not affected even without +this commit. + +References: +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=760455 +https://bugzilla.redhat.com/show_bug.cgi?id=1140725 + +* lib/install-sh: Implement safer 'mkdir -p' test by running +'$mkdirprog $mkdir_mode "$tmpdir"' first. +(scriptversion): Bump. +--- + lib/install-sh | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/lib/install-sh b/lib/install-sh +index 0b0fdcb..59990a1 100755 +--- a/lib/install-sh ++++ b/lib/install-sh +@@ -324,34 +324,41 @@ do + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) ++ # $RANDOM is not portable (e.g. dash); use it when possible to ++ # lower collision chance + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ +- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 ++ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 + ++ # As "mkdir -p" follows symlinks and we work in /tmp possibly; so ++ # create the $tmpdir first (and fail if unsuccessful) to make sure ++ # that nobody tries to guess the $tmpdir name. + if (umask $mkdir_umask && +- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 ++ $mkdirprog $mkdir_mode "$tmpdir" && ++ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. +- ls_ld_tmpdir=`ls -ld "$tmpdir"` ++ test_tmpdir="$tmpdir/a" ++ ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && +- $mkdirprog -m$different_mode -p -- "$tmpdir" && { +- ls_ld_tmpdir_1=`ls -ld "$tmpdir"` ++ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ++ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi +- rmdir "$tmpdir/d" "$tmpdir" ++ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. +- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null ++ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac;; diff --git a/sys-devel/automake/files/automake-1.16.2-fix-instmany-python.sh-test.patch b/sys-devel/automake/files/automake-1.16.2-fix-instmany-python.sh-test.patch new file mode 100644 index 0000000..5cddb4c --- /dev/null +++ b/sys-devel/automake/files/automake-1.16.2-fix-instmany-python.sh-test.patch @@ -0,0 +1,26 @@ +From 50daac4f15d207b6b69011b9cdde62b56c1c8b10 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Fri, 20 Nov 2020 02:17:31 +0100 +Subject: [PATCH 2/2] tests: fix instmany-python.sh: increase limit + +Still failing with 4500 on Gentoo. Passing with 7000... +--- + t/instmany-python.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/t/instmany-python.sh b/t/instmany-python.sh +index dce3594b5..1c482520d 100644 +--- a/t/instmany-python.sh ++++ b/t/instmany-python.sh +@@ -21,7 +21,7 @@ + required='python' + . test-init.sh + +-limit=4500 ++limit=7000 + subdir=long_subdir_name_with_many_characters + nfiles=81 + list=$(seq_ 1 $nfiles) +-- +2.29.2 + diff --git a/sys-devel/automake/files/automake-1.16.2-fix-py-compile-basedir.sh-test.patch b/sys-devel/automake/files/automake-1.16.2-fix-py-compile-basedir.sh-test.patch new file mode 100644 index 0000000..f49dd25 --- /dev/null +++ b/sys-devel/automake/files/automake-1.16.2-fix-py-compile-basedir.sh-test.patch @@ -0,0 +1,26 @@ +From e3db5b8038a902501a354b6921dcebcb4180f50a Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Fri, 20 Nov 2020 02:13:56 +0100 +Subject: [PATCH 1/2] tests: fix py-compile-basedir.sh: add missing test call + +Fixes: b279a0d46 ("tests: in python tests, do not require .pyo files (for python3)") +--- + t/py-compile-basedir.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/t/py-compile-basedir.sh b/t/py-compile-basedir.sh +index 13a22ff1d..1a16ee2d7 100644 +--- a/t/py-compile-basedir.sh ++++ b/t/py-compile-basedir.sh +@@ -43,7 +43,7 @@ for d in foo foo/bar "$(pwd)/foo" . .. ../foo ''; do + py_installed "$d2/sub/$f.pyc" + files=$(find "$d2" | grep '\.py[co]$') + # with new-enough Python3, there are six files. +- test $(echo "$files" | wc -l) -eq 4 || $(echo "$files" | wc -l) -eq 6 ++ test $(echo "$files" | wc -l) -eq 4 || test $(echo "$files" | wc -l) -eq 6 + case $d2 in + .|..) rm -f $files;; + *) rm -rf "$d2";; +-- +2.29.2 + diff --git a/sys-devel/automake/files/automake-1.16.2-py3-compile.patch b/sys-devel/automake/files/automake-1.16.2-py3-compile.patch new file mode 100644 index 0000000..7924f20 --- /dev/null +++ b/sys-devel/automake/files/automake-1.16.2-py3-compile.patch @@ -0,0 +1,73 @@ +From aa449bd4c836abf0320033c5077259fc760b622d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 3 Nov 2019 11:51:19 +0100 +Subject: [PATCH] py-compile: Support -OO for py3.5+, and -O&-OO for pypy3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Michał Górny <mgorny@gentoo.org> +--- + lib/py-compile | 29 +++++++++++++++++++++++++---- + 1 file changed, 25 insertions(+), 4 deletions(-) + +diff --git a/lib/py-compile b/lib/py-compile +index e56d98d6e..5b9ae5d5d 100755 +--- a/lib/py-compile ++++ b/lib/py-compile +@@ -126,12 +126,10 @@ if test "$python_major" -le 2; then + import_lib=imp + import_test="hasattr(imp, 'get_tag')" + import_call=imp.cache_from_source +- import_arg2=', False' # needed in one call and not the other + else + import_lib=importlib + import_test="hasattr(sys.implementation, 'cache_tag')" + import_call=importlib.util.cache_from_source +- import_arg2= + fi + + $PYTHON -c " +@@ -159,7 +157,7 @@ $PYTHON -O -c " + import sys, os, py_compile, $import_lib + + # pypy does not use .pyo optimization +-if hasattr(sys, 'pypy_translation_info'): ++if hasattr(sys, 'pypy_translation_info') and sys.hexversion < 0x03050000: + sys.exit(0) + + files = '''$files''' +@@ -173,7 +171,30 @@ for file in files.split(): + sys.stdout.write(file) + sys.stdout.flush() + if $import_test: +- py_compile.compile(filepath, $import_call(filepath$import_arg2), path) ++ py_compile.compile(filepath, $import_call(filepath), path) ++ else: ++ py_compile.compile(filepath, filepath + 'o', path) ++sys.stdout.write('\n')" 2>/dev/null || : ++ ++$PYTHON -OO -c " ++import sys, os, py_compile, $import_lib ++ ++# python<3.5 does not have split files for -O and -OO ++if sys.hexversion < 0x03050000: ++ sys.exit(0) ++ ++files = '''$files''' ++sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n') ++for file in files.split(): ++ $pathtrans ++ $filetrans ++ if not os.path.exists(filepath) or not (len(filepath) >= 3 ++ and filepath[-3:] == '.py'): ++ continue ++ sys.stdout.write(file) ++ sys.stdout.flush() ++ if $import_test: ++ py_compile.compile(filepath, $import_call(filepath), path) + else: + py_compile.compile(filepath, filepath + 'o', path) + sys.stdout.write('\n')" 2>/dev/null || : +-- +2.25.2 diff --git a/sys-devel/automake/metadata.xml b/sys-devel/automake/metadata.xml new file mode 100644 index 0000000..f671901 --- /dev/null +++ b/sys-devel/automake/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>base-system@gentoo.org</email> + <name>Gentoo Base System</name> +</maintainer> +<upstream> + <remote-id type="cpe">cpe:/a:gnu:automake</remote-id> +</upstream> +</pkgmetadata> diff --git a/virtual/libcrypt/Manifest b/virtual/libcrypt/Manifest new file mode 100644 index 0000000..61d1ba1 --- /dev/null +++ b/virtual/libcrypt/Manifest @@ -0,0 +1,3 @@ +EBUILD libcrypt-1-r1.ebuild 579 BLAKE2B 81f552f246b22253f40781b459aa36b2351edea935a9dba8126b8cd75aa65276873f0ba259bec75367a1cc764d8dcccaa644fb5e3bbab53c163a793728a47e8c SHA512 6164ec5fa7d4a59534efb58185ca478c0935e7935050cc38571af596de9d081983941b46d47f25cb2c14c14f34866ba239d17b26b82ad4c95a34ae701f7b982b +EBUILD libcrypt-2.ebuild 603 BLAKE2B 56018bde2d71c2aeb27a66b4c7023b410a85e8a578e8f53c1c1dbf3f905d596191cdb0202d7ce44bff47c7eeda7fd3f9b2d2b340afc94c48a8463f08b37ac3be SHA512 f0c36f75bc51ebbc29e43a87e694ac081a9c7563e00b4d712eaa2feafda490d18a3656fd55ac681b5d1c34cf7a4049e5d9da8fadcbb2ceba51f0766268e11ccc +MISC metadata.xml 286 BLAKE2B e2e007d7accebf84a8ce85442aab8f854639e308b3ddbfefa75c26e3b02b92a67526dcd177e619df1030a0f7ac52be3deb62be1c218bf34b01b76ca3cae4d0e7 SHA512 9d65bbb0c878ae150fcc102b1d81810bfc91025a375da3c6905bd56a2cefcc4f939540ca504547642e98d837b63ac4a6674328449547a883a93964a1487503c5 diff --git a/virtual/libcrypt/libcrypt-1-r1.ebuild b/virtual/libcrypt/libcrypt-1-r1.ebuild new file mode 100644 index 0000000..2c8f799 --- /dev/null +++ b/virtual/libcrypt/libcrypt-1-r1.ebuild @@ -0,0 +1,20 @@ +# Copyright 2020-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit multilib-build + +DESCRIPTION="Virtual for libcrypt.so" + +SLOT="0/1" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="static-libs" + +RDEPEND=" + !prefix-guest? ( + elibc_glibc? ( sys-libs/glibc[crypt(+),static-libs(+)?] ) + elibc_musl? ( sys-libs/musl ) + ) + elibc_Cygwin? ( sys-libs/cygwin-crypt ) +" diff --git a/virtual/libcrypt/libcrypt-2.ebuild b/virtual/libcrypt/libcrypt-2.ebuild new file mode 100644 index 0000000..478041c --- /dev/null +++ b/virtual/libcrypt/libcrypt-2.ebuild @@ -0,0 +1,20 @@ +# Copyright 2020-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit multilib-build + +DESCRIPTION="Virtual for libcrypt.so" + +SLOT="0/2" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="static-libs" + +RDEPEND=" + !prefix-guest? ( + elibc_glibc? ( sys-libs/libxcrypt[system(-),static-libs(-)?,${MULTILIB_USEDEP}] ) + elibc_musl? ( sys-libs/musl ) + ) + elibc_Cygwin? ( sys-libs/cygwin-crypt ) +" diff --git a/virtual/libcrypt/metadata.xml b/virtual/libcrypt/metadata.xml new file mode 100644 index 0000000..d65b2df --- /dev/null +++ b/virtual/libcrypt/metadata.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>toolchain@gentoo.org</email> + <name>Gentoo Toolchain Project</name> + </maintainer> + <stabilize-allarches/> +</pkgmetadata> diff --git a/x11-misc/barrier/Manifest b/x11-misc/barrier/Manifest new file mode 100644 index 0000000..7d55ed5 --- /dev/null +++ b/x11-misc/barrier/Manifest @@ -0,0 +1,4 @@ +AUX barrier-2.4.0-includes.patch 879 BLAKE2B 7d9652af91686fc43d76230d898556f4247314dfc72f817e4330c6e81e88f4cb6506b78522e9a1583a5bf7dd425fe88324ea8921ff3e63691e475dc4fefe5510 SHA512 ee1fd991b027bcb942b8785e2d34ec5a56d1e3efa7732e92120da77412a7f0caf8c7cd31a7d4e4d06fc2682a29cf329483693f9448fb66cc357bef47196012fc +DIST barrier-2.4.0.tar.gz 5572043 BLAKE2B e3eee306324a661a655b31e3179b7daf3fb199553a581059c67113f9597fb41d6af00fa3090d20c7d0b1d7420764454a512e91d8180ea663c3f99b89c663417f SHA512 dff8d95c358688952baee0bbbf56b818e40a6c0483d58f6cadd55558ab5d0cefc92a37b0751bfd70868686e1716c729871ae00a30ee9b0ba944f531dfb742449 +EBUILD barrier-2.4.0.ebuild 1553 BLAKE2B b80d2318e2805608b30f7dd011bddc3e5a8f557a55623a9e714db499c722de0a4e241d7d36d7159a7844a8d645ac645b005d7f3c2b6fff93ae24638a2e26f608 SHA512 efe3ac4d80da975c182a6cd75a64409c990c5cc4fa856d00db113c9bccf751b8204da992919d4a8e370a15048c8e0a3183f967da48e4ca7732a63c523c0567c1 +MISC metadata.xml 330 BLAKE2B 1fbe5756c4c15fbab194c7634c20e8736d2339a51d89853939397f12314122a3dec2e7842e58eac9e60b35d49f9dff147e8d022e125935598ce69e74b3fc8439 SHA512 102af001ad78e8da45205b0d2b44c9f9a0843a7a953a9868018821007d0c5e9d166dfe335f1fc9ecde71a200473edacff5643fab9d7c32ea16ceb8eaf9b857d4 diff --git a/x11-misc/barrier/barrier-2.4.0.ebuild b/x11-misc/barrier/barrier-2.4.0.ebuild new file mode 100644 index 0000000..aa93cfd --- /dev/null +++ b/x11-misc/barrier/barrier-2.4.0.ebuild @@ -0,0 +1,82 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit desktop virtualx xdg cmake + +DESCRIPTION="Share a mouse and keyboard between computers (fork of Synergy)" +HOMEPAGE="https://github.com/debauchee/barrier" +SRC_URI="https://github.com/debauchee/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="gui test" +RESTRICT="!test? ( test )" + +RDEPEND=" + net-misc/curl + x11-libs/libICE + x11-libs/libSM + x11-libs/libX11 + x11-libs/libXext + x11-libs/libXi + x11-libs/libXinerama + x11-libs/libXrandr + x11-libs/libXtst + gui? ( + dev-qt/qtcore:5 + dev-qt/qtgui:5 + dev-qt/qtnetwork:5 + dev-qt/qtwidgets:5 + net-dns/avahi[mdnsresponder-compat] + ) + dev-libs/openssl:0= +" +DEPEND=" + ${RDEPEND} + dev-cpp/gtest + dev-cpp/gulrak-filesystem + x11-base/xorg-proto +" + +PATCHES=( + "${FILESDIR}"/${P}-includes.patch +) + +DOCS=( + ChangeLog + README.md + doc/${PN}.conf.example{,-advanced,-basic} +) + +src_configure() { + local mycmakeargs=( + -DBARRIER_BUILD_GUI=$(usex gui) + -DBARRIER_BUILD_INSTALLER=OFF + -DBARRIER_BUILD_TESTS=$(usex test) + -DBARRIER_REVISION=00000000 + -DBARRIER_USE_EXTERNAL_GTEST=ON + -DBARRIER_VERSION_STAGE=gentoo + ) + + cmake_src_configure +} + +src_test() { + "${BUILD_DIR}"/bin/unittests || die + virtx "${BUILD_DIR}"/bin/integtests || die +} + +src_install() { + cmake_src_install + einstalldocs + doman doc/${PN}{c,s}.1 + + if use gui; then + doicon -s scalable res/${PN}.svg + doicon -s 256 res/${PN}.png + make_desktop_entry ${PN} Barrier ${PN} Utility + fi +} diff --git a/x11-misc/barrier/files/barrier-2.4.0-includes.patch b/x11-misc/barrier/files/barrier-2.4.0-includes.patch new file mode 100644 index 0000000..048a3b0 --- /dev/null +++ b/x11-misc/barrier/files/barrier-2.4.0-includes.patch @@ -0,0 +1,39 @@ +From aa0a2998e8894716644ea5fb29fc6f0165add956 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <chewi@gentoo.org> +Date: Tue, 2 Nov 2021 20:59:51 +0000 +Subject: [PATCH] Add missing cstddef includes for NULL + +--- + src/lib/base/Event.cpp | 2 ++ + src/lib/base/Event.h | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/src/lib/base/Event.cpp b/src/lib/base/Event.cpp +index cc548fc6..08c5e98f 100644 +--- a/src/lib/base/Event.cpp ++++ b/src/lib/base/Event.cpp +@@ -19,6 +19,8 @@ + #include "base/Event.h" + #include "base/EventQueue.h" + ++#include <cstddef> ++ + // + // Event + // +diff --git a/src/lib/base/Event.h b/src/lib/base/Event.h +index 38a2cf11..cb00dccb 100644 +--- a/src/lib/base/Event.h ++++ b/src/lib/base/Event.h +@@ -21,6 +21,8 @@ + #include "common/basic_types.h" + #include "common/stdmap.h" + ++#include <cstddef> ++ + class EventData { + public: + EventData() { } +-- +2.32.0 + diff --git a/x11-misc/barrier/metadata.xml b/x11-misc/barrier/metadata.xml new file mode 100644 index 0000000..70be39f --- /dev/null +++ b/x11-misc/barrier/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>chewi@gentoo.org</email> + <name>James Le Cuirot</name> + </maintainer> + <upstream> + <remote-id type="github">debauchee/barrier</remote-id> + </upstream> +</pkgmetadata> |
