File folly.spec of Package folly

#
# spec file for package folly
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           folly
Version:        2025.10.20.00
%{lua:
rpm.define('libver ' .. string.gsub(rpm.expand('%version'), "%.", "_"))
}
%define lname libfolly%{libver}
Release:        0
Summary:        An open-source C++ library. 
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License:        Apache-2.0
URL:            https://github.com/facebook/folly
Source1:        https://github.com/facebook/folly/releases/download/v%{version}/folly-v%{version}.tar.gz
Source0:        https://github.com/archlinux/aur/archive/refs/heads/folly.tar.gz#/aur-folly.tar.gz
Source2:        https://patch-diff.githubusercontent.com/raw/facebook/folly/pull/2523.patch
BuildRequires:  python3-devel
BuildRequires:  boost-devel
BuildRequires:  cmake
#BuildRequires:  double-conversion-devel
#BuildRequires:  fmt-9-devel
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  gflags-devel
#BuildRequires:  glog-4-devel
#BuildRequires:  libaio-devel
BuildRequires:  boost-devel
BuildRequires:  libboost_context-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
#BuildRequires:  libbz2-devel
#BuildRequires:  libdwarf-devel
#BuildRequires:  libevent-devel
#BuildRequires:  liblz4-devel
#BuildRequires:  libsodium-devel
#BuildRequires:  libunwind-devel
#BuildRequires:  liburing-devel
#BuildRequires:  openssl-devel
#BuildRequires:  snappy-devel
#BuildRequires:  xz-devel
#BuildRequires:  zlib-devel
BuildRequires:  python3-Cython
BuildRequires:  python3-setuptools
BuildRequires:  pkgconfig(gmock)
BuildRequires:  cmake(FastFloat)
BuildRequires:  libaio-devel
BuildRequires:  cmake(double-conversion)
BuildRequires:  cmake(fmt)
BuildRequires:  cmake(gflags)
BuildRequires:  cmake(glog) < 0.5
BuildRequires:  cmake(lz4)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(libdwarf)
BuildRequires:  pkgconfig(libevent)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(libsodium)
BuildRequires:  pkgconfig(libunwind)
BuildRequires:  pkgconfig(liburing)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(snappy)

Requires:       libaio-devel
Requires:       cmake(FastFloat)
Requires:       cmake(double-conversion)
Requires:       cmake(fmt)
Requires:       cmake(gflags)
Requires:       cmake(glog) < 0.5
Requires:       cmake(lz4)
Requires:       pkgconfig(bzip2)
Requires:       pkgconfig(libdwarf)
Requires:       pkgconfig(libevent)
Requires:       pkgconfig(liblzma)
Requires:       pkgconfig(libsodium)
Requires:       pkgconfig(libunwind)
Requires:       pkgconfig(liburing)
Requires:       pkgconfig(openssl)
Requires:       pkgconfig(snappy)


%description
folly (acronymed loosely after Facebook Open Source Library) is a library of
C++17 components designed with practicality and efficiency in mind. Folly
contains a variety of core library components used extensively at Facebook. In
particular, it's often a dependency of Facebook's other open source C++ efforts
and place where those projects can share code.

%package devel
Summary:        Facebook Open-source Library
Requires:       %{name} = %{version}
Requires:       libfolly%{libver} = %version

%description devel
folly (acronymed loosely after Facebook Open Source Library) is a library of
C++17 components designed with practicality and efficiency in mind. Folly
contains a variety of core library components used extensively at Facebook. In
particular, it's often a dependency of Facebook's other open source C++ efforts
and place where those projects can share code.

%package -n %lname
Summary:        Facebook Open-source Library

%description -n %lname
folly (acronymed loosely after Facebook Open Source Library) is a library of
C++17 components designed with practicality and efficiency in mind. Folly
contains a variety of core library components used extensively at Facebook. In
particular, it's often a dependency of Facebook's other open source C++ efforts
and place where those projects can share code.

%prep
%autosetup -n aur-folly
export srcdir="${PWD}"
cp "%{SOURCE2}" "$PWD/fix-cmake-remove-boost-system.patch"
. "${srcdir}/PKGBUILD"
mkdir "${pkgname}"
tar -xzvf %{SOURCE1} -C "${pkgname}"
prepare

%build
cd %{name}
export CXXFLAGS="-Wno-error=return-type"
mkdir -p "%{buildroot}%{_prefix}"
mkdir -p "%{buildroot}%{_libdir}/cmake"
mkdir -p "%{buildroot}%{_bindir}"
mkdir -p "%{buildroot}%{_includedir}"

export CMAKE_INSTALL_DIR="$(realpath --relative-to="%{buildroot}%{_prefix}" "%{buildroot}%{_libdir}/cmake")"
export LIB_INSTALL_DIR="$(realpath --relative-to="%{buildroot}%{_prefix}" "%{buildroot}%{_libdir}")"
export BIN_INSTALL_DIR="$(realpath --relative-to="%{buildroot}%{_prefix}" "%{buildroot}%{_bindir}")"
export INCLUDE_INSTALL_DIR="$(realpath --relative-to="%{buildroot}%{_prefix}" "%{buildroot}%{_includedir}")"

%cmake \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_PREFIX_PATH=%{_prefix} \
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    -DBUILD_TESTS=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DPYTHON_EXTENSIONS=ON \
    -DBIN_INSTALL_DIR="${BIN_INSTALL_DIR}" \
    -DLIB_INSTALL_DIR="${LIB_INSTALL_DIR}" \
    -DINCLUDE_INSTALL_DIR="${INCLUDE_INSTALL_DIR}" \
    -DCMAKE_INSTALL_DIR="${CMAKE_INSTALL_DIR}" \
    -DPACKAGE_VERSION="%{version}" \
    -DPYTHON_PACKAGE_INSTALL_DIR=%{buildroot}%{_prefix} \
    -DCMAKE_CXX_STANDARD=20 \
    -DCMAKE_CXX_STANDARD_REQUIRED=ON \
    -Wno-dev

%cmake_build

%install
cd %{name}
%cmake_install

%post   -n %lname -p %{_sbindir}/ldconfig
%postun -n %lname -p %{_sbindir}/ldconfig

%files
#%{_bindir}/*

%files devel
%{_includedir}/folly
%{_libdir}/libfolly*.so
%{_libdir}/cmake/folly*
%{_libdir}/pkgconfig/libfolly.pc
%exclude %python3_sitearch

%files -n %lname
%{_libdir}/libfolly*.so.*

%changelog
openSUSE Build Service is sponsored by