# Copyright © 2018-2019 Nicolas Mailhot # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # RPM macros for Go packages. # # Internal utility macros # Direct use in spec file is not supported # # SPDX-License-Identifier: GPL-3.0-or-later %__godevelinstall(-i:v) %{expand: ( %define __godevelinstall_ipath %{-i*} cd "%{gobuilddir}/src/%{__godevelinstall_ipath}" %define listfiles_include %{?currentgosupfiles} %define listfiles_exclude %{?currentgosupfilesex} IFS= gosupfiles=$(%listfiles ) mapfile -t gosupfilesA <<< "${gosupfiles}" go-rpm-integration install -i "%{__godevelinstall_ipath}" \\ -b "%{gobuilddir}/bin" \\ -s "%{gobuilddir}" \\ -o "%{currentgodevelfilelist}" \\ -O "%{goworkdir}" \\ -V "%{version}-%{release}" \\ %{?currenttag: -T "%{?currenttag}"} \\ %{?currentcommit: -C "%{?currentcommit}"} \\ %{?currentbranch: -B "%{?currentbranch}"} \\ -p "%{buildroot}" \\ -g "%{gopath}" \\ %{?currentgoipathsex} \\ %{?currentgoextensions} \\ %{?goinstallflags} \\ %{-v} ${gosupfilesA[@]:+"${gosupfilesA[@]}"} ) } %__goaltinstall() %{expand: install -m 0755 -d "%{buildroot}%{gopath}/src/%(dirname %{currentgoaltipath})" ln -rs "%{buildroot}%{gopath}/src/%{currentgocanonipath}" "%{buildroot}%{gopath}/src/%{currentgoaltipath}" echo "%{gopath}/src/%{currentgoaltipath}" >> "%{goworkdir}/%{currentgoaltfilelist}" } %__godevelinstalldoc() %{expand: ( %define listfiles_include %{?currentgodocs} %define listfiles_exclude %{?currentgodocsex} IFS= godocs=$(%listfiles ) if [[ -n "${godocs}" ]] ; then while IFS= read -r f ; do echo %doc \\""${f}"\\" >> "%{goworkdir}/%{currentgodevelfilelist}" done <<< "${godocs}" fi ) ( %define listfiles_include %{?currentgolicenses} %define listfiles_exclude %{?currentgolicensesex} IFS= golicenses=$(%listfiles ) if [[ -n "${golicenses}" ]] ; then while IFS= read -r f; do echo "%"license \\""${f}"\\" >> "%{goworkdir}/%{currentgodevelfilelist}" done <<< "${golicenses}" fi ) }