Skip to content

Commit

Permalink
SPECS fixes #1 to support cross compilation
Browse files Browse the repository at this point in the history
This change allows to cross build set of core packages.

Change-Id: I1f5dfefe37501be0b24319c862721053817ec68d
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6189
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Priyesh Padmavilasom <ppadmavilasom@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
  • Loading branch information
Alexey Makhalov committed Dec 17, 2019
1 parent e3eb104 commit 5f9f545
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 75 deletions.
20 changes: 18 additions & 2 deletions SPECS/audit/audit.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
%{!?python2_sitelib: %global python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
%{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
%define with_golang 0

Summary: Kernel Audit Tool
Name: audit
Version: 2.8.5
Release: 1%{?dist}
Release: 2%{?dist}
Source0: http://people.redhat.com/sgrubb/audit/%{name}-%{version}.tar.gz
%define sha1 audit=62fcac8cbd20c796b909b91f8f615f8556b22a24
License: GPLv2+
Expand All @@ -14,12 +15,18 @@ Vendor: VMware, Inc.
Distribution: Photon
BuildRequires: krb5-devel
BuildRequires: openldap
BuildRequires: go
BuildRequires: tcp_wrappers-devel
BuildRequires: libcap-ng-devel
BuildRequires: swig
BuildRequires: e2fsprogs-devel
BuildRequires: systemd
BuildRequires: python2-devel
BuildRequires: python2-libs
BuildRequires: python3-devel
BuildRequires: python3-libs
%if %{with_golang}
BuildRequires: go
%endif
Requires: systemd
Requires: krb5
Requires: openldap
Expand Down Expand Up @@ -68,6 +75,7 @@ and libauparse.

%build
%configure \
$(test %{_host} != %{_build} && echo "--with-sysroot=/target-%{_arch}") \
--exec_prefix=/usr \
--with-python=yes \
--with-python3=yes \
Expand All @@ -76,7 +84,9 @@ and libauparse.
--with-libcap-ng=yes \
--with-aarch64 \
--enable-zos-remote \
%if %{with_golang}
--with-golang \
%endif
--enable-systemd \
--disable-static

Expand Down Expand Up @@ -143,7 +153,9 @@ make %{?_smp_mflags} check
%{_libdir}/*.so
%{_libdir}/*.la
%{_libdir}/pkgconfig/*.pc
%if %{with_golang}
%{_libdir}/golang/*
%endif
%{_includedir}/*.h
%{_mandir}/man3/*
/usr/share/aclocal/audit.m4
Expand All @@ -157,6 +169,10 @@ make %{?_smp_mflags} check
%{python3_sitelib}/*

%changelog
* Tue Nov 26 2019 Alexey Makhalov <amakhalov@vmware.com> 2.8.5-2
- Cross compilation support.
- Do not use BuildRequires in subpackages.
- Disable golang dependency.
* Thu Oct 17 2019 Shreyas B <shreyasb@vmware.com> 2.8.5-1
- Updated to version 2.8.5.
* Mon Sep 3 2018 Keerthana K <keerthanak@vmware.com> 2.8.4-1
Expand Down
6 changes: 5 additions & 1 deletion SPECS/binutils/binutils.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary: Contains a linker, an assembler, and other tools
Name: binutils
Version: 2.32
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+
URL: http://www.gnu.org/software/binutils
Group: System Environment/Base
Expand Down Expand Up @@ -66,6 +66,7 @@ for handling compiled objects.
--enable-ld=default \
--enable-plugins \
--enable-shared \
--enable-targets=x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu \
--disable-werror \
--with-system-zlib \
--enable-install-libiberty \
Expand Down Expand Up @@ -147,6 +148,9 @@ make %{?_smp_mflags} check
%{_lib64dir}/libiberty.a

%changelog
* Tue Nov 26 2019 Alexey Makhalov <amakhalov@vmware.com> 2.32-4
- Support for aarch64 target to be able to strip aarch64 libraries
during cross-aarch64-gcc build
* Wed Nov 13 2019 Satya Naga Vasamsetty <svasamsetty@vmware.com> 2.32-3
- Fix CVE-2019-17450 and CVE-2019-17451
* Sun Sep 29 2019 Srivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu> 2.32-2
Expand Down
8 changes: 5 additions & 3 deletions SPECS/gcc/gcc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Summary: Contains the GNU compiler collection
Name: gcc
Version: 7.3.0
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+
URL: http://gcc.gnu.org
Group: Development/Tools
Expand Down Expand Up @@ -96,9 +96,10 @@ sed -i '/^NO_PIE_CFLAGS = /s/@NO_PIE_CFLAGS@//' gcc/Makefile.in
%build

export glibcxx_cv_c99_math_cxx98=yes glibcxx_cv_c99_math_cxx11=yes
test %{_host} != %{_build} && export gcc_cv_objdump=%{_arch}-unknown-linux-gnu-objdump

SED=sed \
%configure \
$(test %{_host} != %{_build} && echo "--target=%{_host}") \
--enable-shared \
--enable-threads=posix \
--enable-__cxa_atexit \
Expand All @@ -109,7 +110,6 @@ SED=sed \
--enable-linker-build-id \
--enable-plugin \
--with-system-zlib
# --disable-silent-rules
make %{?_smp_mflags}
%install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
Expand Down Expand Up @@ -208,6 +208,8 @@ make %{?_smp_mflags} check-gcc
%{_lib64dir}/libgomp.spec

%changelog
* Tue Nov 06 2018 Alexey Makhalov <amakhalov@vmware.com> 7.3.0-5
- Cross compilation support
* Fri Nov 02 2018 Alexey Makhalov <amakhalov@vmware.com> 7.3.0-4
- Use nofortify security_hardening instead of sed hacking
- Use %configure
Expand Down
50 changes: 44 additions & 6 deletions SPECS/glibc/glibc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Summary: Main C library
Name: glibc
Version: 2.28
Release: 4%{?dist}
Release: 5%{?dist}
License: LGPLv2+
URL: http://www.gnu.org/software/libc
Group: Applications/System
Expand Down Expand Up @@ -106,9 +106,15 @@ chmod +x find_requires.sh
#___EOF

%build

# make aarch64 use /lib64 instead of /lib (same as x86_64)
sed -i "s/libc_cv_rtlddir='\/lib'/libc_cv_rtlddir='\/lib64'/" sysdeps/unix/sysv/linux/aarch64/configure

cd %{_builddir}/%{name}-build
../%{name}-%{version}/configure \
--prefix=%{_prefix} \
--build=%{_build} \
--host=%{_host} \
--disable-profile \
--enable-kernel=3.2 \
--enable-bind-now \
Expand Down Expand Up @@ -160,18 +166,27 @@ cat > %{buildroot}%{_sysconfdir}/ld.so.conf <<- "EOF"
/opt/lib
include /etc/ld.so.conf.d/*.conf
EOF
# Create empty ld.so.cache
:> %{buildroot}%{_sysconfdir}/ld.so.cache
popd

%find_lang %{name} --all-name
pushd localedata
# Generate out of locale-archive an (en_US.) UTF-8 locale
mkdir -p %{buildroot}/usr/lib/locale
I18NPATH=. GCONV_PATH=../../glibc-build/iconvdata LC_ALL=C ../../glibc-build/locale/localedef --no-archive --prefix=%{buildroot} -A ../intl/locale.alias -i locales/en_US -c -f charmaps/UTF-8 en_US.UTF-8
if [ %{_host} != %{_build} ]; then
LOCALEDEF=localedef
else
LOCALEDEF=../../glibc-build/locale/localedef
fi
I18NPATH=. GCONV_PATH=../../glibc-build/iconvdata LC_ALL=C $LOCALEDEF --no-archive --prefix=%{buildroot} -A ../intl/locale.alias -i locales/en_US -c -f charmaps/UTF-8 en_US.UTF-8
mv %{buildroot}/usr/lib/locale/en_US.utf8 %{buildroot}/usr/lib/locale/en_US.UTF-8
popd
# to do not depend on /bin/bash
sed -i 's@#! /bin/bash@#! /bin/sh@' %{buildroot}/usr/bin/ldd
sed -i 's@#!/bin/bash@#!/bin/sh@' %{buildroot}/usr/bin/tzselect


%check
cd %{_builddir}/glibc-build
make %{?_smp_mflags} check ||:
Expand Down Expand Up @@ -206,14 +221,19 @@ grep "^FAIL: nptl/tst-eintr1" tests.sum >/dev/null && n=$((n+1)) ||:
%config(noreplace) %{_sysconfdir}/nsswitch.conf
%config(noreplace) %{_sysconfdir}/ld.so.conf
%config(noreplace) %{_sysconfdir}/rpc
%config(missingok,noreplace) %{_sysconfdir}/ld.so.cache
%attr(0644,root,root) %config(missingok,noreplace) %{_sysconfdir}/ld.so.cache
%config %{_sysconfdir}/locale-gen.conf

%ifarch %{ix86}
/lib/*
%exclude /lib/libpcprofile.so
%{_libdir}/*.so
%else
/lib64/*
%ifarch aarch64
%exclude /lib
%endif
%exclude /lib64/libpcprofile.so
%{_lib64dir}/*.so
%endif

/sbin/ldconfig
/sbin/locale-gen.sh
%{_bindir}/*
Expand All @@ -234,7 +254,11 @@ grep "^FAIL: nptl/tst-eintr1" tests.sum >/dev/null && n=$((n+1)) ||:

%files iconv
%defattr(-,root,root)
%ifarch %{ix86}
%{_libdir}/gconv/*
%else
%{_lib64dir}/gconv/*
%endif
/usr/bin/iconv
/usr/sbin/iconvconfig

Expand All @@ -250,8 +274,13 @@ grep "^FAIL: nptl/tst-eintr1" tests.sum >/dev/null && n=$((n+1)) ||:
/usr/sbin/zdump
/usr/sbin/zic
/sbin/sln
%ifarch %{ix86}
%{_libdir}/audit/*
/lib/libpcprofile.so
%else
%{_lib64dir}/audit/*
/lib64/libpcprofile.so
%endif

%files nscd
%defattr(-,root,root)
Expand All @@ -272,15 +301,24 @@ grep "^FAIL: nptl/tst-eintr1" tests.sum >/dev/null && n=$((n+1)) ||:
%defattr(-,root,root)
# TODO: Excluding for now to remove dependency on PERL
# /usr/bin/mtrace
%ifarch %{ix86}
%{_libdir}/*.a
%{_libdir}/*.o
%else
%{_lib64dir}/*.a
%{_lib64dir}/*.o
%endif
%{_includedir}/*

%files -f %{name}.lang lang
%defattr(-,root,root)


%changelog
* Tue Sep 24 2019 Alexey Makhalov <amakhalov@vmware.com> 2.28-5
- Cross compilling support
- Create empty ld.so.cache file for all builds (native and cross)
- Use /lib64 for aarch64
* Fri Jul 12 2019 Ankit Jain <ankitja@vmware.com> 2.28-4
- Replaced spaces with tab in nsswitch.conf file
* Fri Mar 08 2019 Alexey Makhalov <amakhalov@vmware.com> 2.28-3
Expand Down
13 changes: 9 additions & 4 deletions SPECS/linux-api-headers/linux-api-headers.spec
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
%define debug_package %{nil}
Summary: Linux API header files
Name: linux-api-headers
Version: 4.19.87
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
URL: http://www.kernel.org/
Group: System Environment/Kernel
Vendor: VMware, Inc.
Distribution: Photon
Source0: http://www.kernel.org/pub/linux/kernel/v4.x/linux-%{version}.tar.xz
%define sha1 linux=6bef9ec5ef74ae160b18d7a0930cd80cb1461bdb
BuildArch: noarch
%description
The Linux API Headers expose the kernel's API for use by Glibc.
%prep
%setup -q -n linux-%{version}
%build
make mrproper
make headers_check
%install
[ "%{_arch}" = "x86_64" ] && ARCH=x86_64
[ "%{_arch}" = "aarch64" ] && ARCH=arm64
[ "%{_arch}" = "i686" ] && ARCH=i386
cd %{_builddir}/linux-%{version}
make INSTALL_HDR_PATH=%{buildroot}%{_prefix} headers_install
make ARCH=$ARCH headers_check
make ARCH=$ARCH INSTALL_HDR_PATH=%{buildroot}%{_prefix} headers_install
find /%{buildroot}%{_includedir} \( -name .install -o -name ..install.cmd \) -delete
%files
%defattr(-,root,root)
%{_includedir}/*
%changelog
* Mon Dec 09 2019 Alexey Makhalov <amakhalov@vmware.com> 4.19.87-2
- Make it arch specific
* Fri Dec 06 2019 Ajay Kaher <akaher@vmware.com> 4.19.87-1
- Update to version 4.19.87
* Tue Nov 12 2019 Srivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu> 4.19.84-1
Expand Down
File renamed without changes.
Loading

0 comments on commit 5f9f545

Please sign in to comment.