ba1169
%global with_check 0
ba1169
ba1169
%global _find_debuginfo_dwz_opts %{nil}
ba1169
%global _dwz_low_mem_die_limit 0
ba1169
ba1169
%if 0%{?rhel} > 7 && ! 0%{?fedora}
ba1169
%define gobuild(o:) \
89394e
go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -linkmode=external -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v %{?**};
89394e
%else
89394e
%if ! 0%{?gobuild:1}
89394e
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -linkmode=external -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v %{?**};
89394e
%endif
ba1169
%endif
ba1169
ba1169
%global provider github
ba1169
%global provider_tld com
ba1169
%global project containers
ba1169
%global repo oci-seccomp-bpf-hook
ba1169
# https://github.com/containers/oci-seccomp-bpf-hook
ba1169
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
ba1169
%global import_path %{provider_prefix}
ba1169
%global git0 https://%{provider}.%{provider_tld}/%{project}/%{repo}
ba1169
ba1169
# bcc is not built for i686
ba1169
ExcludeArch: i686
ba1169
ba1169
Name: oci-seccomp-bpf-hook
0c22e2
Version: 1.2.0
89394e
Release: 2%{?dist}
ba1169
Summary: OCI Hook to generate seccomp json files based on EBF syscalls used by container
ba1169
License: ASL 2.0
ba1169
URL: %{git0}
ba1169
Source0: %{git0}/archive/v%{version}.tar.gz
ba1169
BuildRequires: golang
ba1169
BuildRequires: go-md2man
ba1169
BuildRequires: glib2-devel
ba1169
BuildRequires: glibc-devel
ba1169
BuildRequires: bcc-devel
ba1169
BuildRequires: git
ba1169
BuildRequires: gpgme-devel
ba1169
BuildRequires: libseccomp-devel
ba1169
BuildRequires: make
ba1169
Enhances: podman
ba1169
Enhances: cri-o
ba1169
ba1169
%description
ba1169
%{summary}
ba1169
%{repo} provides a library for applications looking to use
ba1169
the Container Pod concept popularized by Kubernetes.
ba1169
ba1169
%prep
ba1169
%autosetup -Sgit
ba1169
sed -i '/$(MAKE) -C docs install/d' Makefile
ba1169
sed -i 's/HOOK_BIN_DIR/\%{_usr}\/libexec\/oci\/hooks.d/' %{name}.json
ba1169
sed -i '/$(HOOK_DIR)\/%{name}.json/d' Makefile
ba1169
ba1169
%build
ba1169
export GO111MODULE=off
ba1169
export GOPATH=$(pwd):$(pwd)/_build
7d18f9
export CGO_CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
ba1169
ba1169
mkdir _build
ba1169
pushd _build
ba1169
mkdir -p src/%{provider}.%{provider_tld}/%{project}
ba1169
ln -s ../../../../ src/%{import_path}
ba1169
popd
ba1169
ln -s vendor src
ba1169
ba1169
export GOPATH=$(pwd)/_build:$(pwd)
7d18f9
export LDFLAGS="-X main.version=%{version}"
ba1169
%gobuild -o bin/%{name} %{import_path}
ba1169
ba1169
pushd docs
ba1169
go-md2man -in %{name}.md -out %{name}.1
ba1169
popd
ba1169
ba1169
%install
7d18f9
%{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} install-nobuild
7d18f9
%{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} GOMD2MAN=go-md2man -C docs install-nobuild
ba1169
ba1169
%check
89394e
%if 0%{?with_check}
ba1169
# Since we aren't packaging up the vendor directory we need to link
ba1169
# back to it somehow. Hack it up so that we can add the vendor
ba1169
# directory from BUILD dir as a gopath to be searched when executing
ba1169
# tests from the BUILDROOT dir.
ba1169
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor
ba1169
ba1169
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
ba1169
ba1169
%if ! 0%{?gotest:1}
ba1169
%global gotest go test
ba1169
%endif
ba1169
ba1169
%gotest %{import_path}/src/%{name}
ba1169
%endif
ba1169
ba1169
#define license tag if not already defined
ba1169
%{!?_licensedir:%global license %doc}
ba1169
ba1169
%files
ba1169
%license LICENSE
ba1169
%doc README.md
ba1169
%dir %{_libexecdir}/oci/hooks.d
ba1169
%{_libexecdir}/oci/hooks.d/%{name}
ba1169
%{_datadir}/containers/oci/hooks.d/%{name}.json
ba1169
%{_mandir}/man1/%{name}.1*
ba1169
ba1169
%changelog
89394e
* Tue Dec 08 2020 Jindrich Novy <jnovy@redhat.com> - 1.2.0-2
89394e
- sync with RHEL8 devel branch
89394e
- Related: #1883490
89394e
89394e
* Wed Oct 21 2020 Jindrich Novy <jnovy@redhat.com> - 1.2.0-1
89394e
- synchronize with stream-container-tools-rhel8
89394e
- Related: #1883490
0c22e2
7d18f9
* Tue Aug 11 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.2-3
7d18f9
- propagate proper CFLAGS to CGO_CFLAGS to assure code hardening and optimization
7d18f9
- Related: #1821193
7d18f9
7d18f9
* Thu Jul 23 2020 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.2-2
7d18f9
- Resolves: #1857606
7d18f9
7d18f9
* Fri Jul 17 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.2-1
7d18f9
- update to https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.1.2
7d18f9
- Related: #1821193
7d18f9
b89768
* Thu Jun 18 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.1-1
b89768
- update to https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.1.1
b89768
- Related: #1821193
b89768
ba1169
* Tue May 12 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.0-2
ba1169
- exclude i686 arch as bcc, the build dependency is not built
ba1169
  for it
ba1169
- Related: #1821193
ba1169
ba1169
* Tue May 12 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.0-1
ba1169
- initial build for container-tools-rhel8
ba1169
- Related: #1821193