%define aprver 1 Summary: Apache Portable Runtime library Name: apr Version: 1.7.0 Release: 12%{?dist}2a # ASL 2.0: everything # ISC: network_io/apr-1.4.6/network_io/unix/inet_?to?.c # BSD with advertising: strings/apr_snprintf.c, strings/apr_fnmatch.c, # include/apr_fnmatch.h, misc/unix/getopt.c, # file_io/unix/mktemp.c, strings/apr_strings.c # BSD (3-clause): strings/apr_strnatcmp.c, include/apr_strings.h License: ASL 2.0 and BSD with advertising and ISC and BSD URL: https://apr.apache.org/ Source0: https://www.apache.org/dist/apr/%{name}-%{version}.tar.bz2 Patch0: apr-1.7.0-config.patch BuildArch: fat %description The mission of the Apache Portable Runtime (APR) is to provide a free library of C data structures and routines, forming a system portability layer to as many operating systems as possible, including Unices, MS Win32, BeOS and OS/2. %package devel Summary: APR library development kit Requires: apr = %{version}-%{release}, pkgconfig %description devel This package provides the support files which can be used to build applications using the APR library. The mission of the Apache Portable Runtime (APR) is to provide a free library of C data structures and routines. %prep %setup -q -c %{name}-%{version} mv %{name}-%{version} ARM64 pushd ARM64 %patch0 -p1 -b .darwin popd cp -a ARM64 X86_64 %build pushd ARM64 export CC=clang export CXX=clang++ export CFLAGS="-arch arm64 $RPM_OPT_FLAGS -I%{_includedir}" export CPPFLAGS="-arch arm64 -I%{_includedir}" export CXXFLAGS="$CFLAGS" export LDFLAGS="-arch arm64 $RPM_LD_FLAGS" export PREFIX="%{_prefix}" export LIBDIR="%{_libdir}" ./configure \ --prefix=%{_prefix} \ --includedir=%{_includedir}/apr-%{aprver} \ --with-installbuilddir=%{_libdir}/apr-%{aprver}/build \ --disable-static make %{?_smp_mflags} popd pushd X86_64 export CC=clang export CXX=clang++ export CFLAGS="-arch x86_64 $RPM_OPT_FLAGS -I%{_includedir}" export CPPFLAGS="-arch x86_64 -I%{_includedir}" export CXXFLAGS="$CFLAGS" export LDFLAGS="-arch x86_64 $RPM_LD_FLAGS" ./configure \ --prefix=%{_prefix} \ --includedir=%{_includedir}/apr-%{aprver} \ --with-installbuilddir=%{_libdir}/apr-%{aprver}/build \ --disable-static make %{?_smp_mflags} popd %install rm -rf $RPM_BUILD_ROOT PWD=`pwd` pushd ARM64 rm -rf ${PWD}-root mkdir -p ${PWD}-root export CFLAGS="-arch arm64 $RPM_OPT_FLAGS -I%{_includedir}" export CPPFLAGS="-arch arm64 -I%{_includedir}" export CXXFLAGS="$CFLAGS" export LDFLAGS="-arch arm64 $RPM_LD_FLAGS" export PREFIX="%{_prefix}" export LIBDIR="%{_libdir}" make install DESTDIR=${PWD}-root cp -a CHANGES NOTICE README* LICENSE docs .. popd pushd X86_64 rm -rf ${PWD}-root mkdir -p ${PWD}-root export CFLAGS="-arch x86_64 $RPM_OPT_FLAGS -I%{_includedir}" export CPPFLAGS="-arch x86_64 -I%{_includedir}" export CXXFLAGS="$CFLAGS" export LDFLAGS="-arch x86_64 $RPM_LD_FLAGS" make install DESTDIR=${PWD}-root popd ## Make Universal Binaries filelist=$(find ./ARM64-root -type f | xargs file | sed -e 's,^\./ARM64-root/,,g' | \ grep -E \(Mach-O\)\|\(ar\ archive\) |sed -e 's,:.*,,g' -e '/\for\ architecture/d') for i in $filelist do /usr/bin/lipo -create ARM64-root/$i X86_64-root/$i -output `basename $i` && \ (cp -f `basename $i` ARM64-root/$i) || : done # check header files for i in `find ARM64-root -name "*.h" -type f` do TARGET=`echo $i | sed -e "s,.*ARM64-root,,"` TEMP=`diff -u ARM64-root/$TARGET X86_64-root/$TARGET > /dev/null || echo different` if [ -n "$TEMP" ]; then mv X86_64-root/$TARGET ARM64-root/${TARGET%.*}-x86_64.h mv ARM64-root/$TARGET ARM64-root/${TARGET%.*}-arm64.h FILE=${TARGET##*/} FILE=${FILE%.*} cat < ARM64-root/$TARGET #if defined (__arm64__) #include "${FILE}-arm64.h" #elif defined( __x86_64__ ) #include "${FILE}-x86_64.h" #endif EOF fi done # install mkdir -p %{buildroot} tar cf - -C ARM64-root . | tar xpf - -C %{buildroot} %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,wheel,-) %doc CHANGES NOTICE README* docs %license LICENSE %{_libdir}/libapr-%{aprver}.0.dylib %files devel %{_bindir}/apr-%{aprver}-config %{_libdir}/libapr-%{aprver}.dylib %{_libdir}/pkgconfig/*.pc %dir %{_libdir}/apr-%{aprver} %dir %{_libdir}/apr-%{aprver}/build %{_libdir}/apr-%{aprver}/build/* %dir %{_includedir}/apr-%{aprver} %{_includedir}/apr-%{aprver}/*.h %changelog * Wed Jun 8 2022 Keisuke Fujii 1.7.0-12hepx2a - 2nd release on MacOS 12 for M1 and Intel Macs (fat). - built with OSXWS 12beta and clang * Mon Jun 6 2022 Keisuke Fujii 1.7.0-12hepx1a - 1st release on MacOS 12 for M1 Macs. - built with OSXWS 12beta and clang