diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..44a267a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/black-hole-solver-0.20.0.tar.xz diff --git a/bhs-no-rpath.diff b/bhs-no-rpath.diff new file mode 100644 index 0000000..eec7eeb --- /dev/null +++ b/bhs-no-rpath.diff @@ -0,0 +1,32 @@ +--- black-hole-solver-0.20.0/CMakeLists.txt.orig 2019-04-24 13:25:05.705449647 +0300 ++++ black-hole-solver-0.20.0/CMakeLists.txt 2019-04-24 13:25:55.340522389 +0300 +@@ -35,29 +35,6 @@ + "~$" + ) + +-### This is to set the RPATH correctly, so when installed under a prefix +-### the executables will find the libraries. +-### +-### See: +-### +-### http://www.cmake.org/Wiki/CMake_RPATH_handling +-### +-### (Taken from that wiki page) +- +-# use, i.e. don't skip the full RPATH for the build tree +-SET(CMAKE_SKIP_BUILD_RPATH FALSE) +- +-# when building, don't use the install RPATH already +-# (but later on when installing) +-SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +- +-# the RPATH to be used when installing +-SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}") +- +-# add the automatically determined parts of the RPATH +-# which point to directories outside the build tree to the install RPATH +-SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +- + SET (LIB_BASE "black_hole_solver") + option (FCS_WITH_TEST_SUITE "Also build and run the test suite." ON) + option (FCS_AVOID_TCMALLOC "Avoid linking against Google's tcmalloc") diff --git a/bhs-xxhash.patch b/bhs-xxhash.patch new file mode 100644 index 0000000..f4a3ce7 --- /dev/null +++ b/bhs-xxhash.patch @@ -0,0 +1,21 @@ +--- black-hole-solver-0.20.0/xxHash-wrapper/wrap_xxhash.h.orig 2019-04-25 13:12:43.484068977 +0300 ++++ black-hole-solver-0.20.0/xxHash-wrapper/wrap_xxhash.h 2019-04-25 13:13:01.633166022 +0300 +@@ -11,7 +11,6 @@ + #pragma once + + #include "config.h" +-#define XXH_PRIVATE_API + #include "xxhash.h" + + #if SIZEOF_VOID_P == 4 +--- black-hole-solver-0.20.0/CMakeLists.txt.orig 2019-04-25 13:16:38.000222097 +0300 ++++ black-hole-solver-0.20.0/CMakeLists.txt 2019-04-25 13:17:14.864067712 +0300 +@@ -169,7 +169,7 @@ + ARCHIVE DESTINATION "lib${LIB_SUFFIX}" + ) + +-TARGET_LINK_LIBRARIES("${LIB_BASE}" ${LIBTOKYO_CAB_LIBS}) ++TARGET_LINK_LIBRARIES("${LIB_BASE}" ${LIBTOKYO_CAB_LIBS} "xxhash") + + LIST (APPEND BLACK_HOLE_SOLVER_LIBS "${LIB_BASE}") + diff --git a/black-hole-solver.spec b/black-hole-solver.spec new file mode 100644 index 0000000..28bcabb --- /dev/null +++ b/black-hole-solver.spec @@ -0,0 +1,117 @@ +%define basen black-hole-solver +%define libname_orig lib%{basen} +%define major 1 +%define libname lib%{basen}%{major} +%define develname lib%{basen}-devel + +Name: %{basen} +Version: 0.20.0 +Release: 1%{?dist} +# The entire source code is MIT except xxHash-0.6.5/ which is BSD +License: MIT and BSD +Source0: https://fc-solve.shlomifish.org/downloads/fc-solve/%{basen}-%{version}.tar.xz +Patch1: bhs-no-rpath.diff +Patch2: bhs-xxhash.patch +URL: https://www.shlomifish.org/open-source/projects/black-hole-solitaire-solver/ +Requires: %{libname}%{?_isa} = %version-%release +Summary: The Black Hole Solitaire Solver Executable +BuildRequires: cmake +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: glibc-devel +BuildRequires: perl(Carp) +BuildRequires: perl(Cwd) +BuildRequires: perl(Data::Dumper) +BuildRequires: perl(Dir::Manifest) +BuildRequires: perl(Env::Path) +BuildRequires: perl(File::Path) +BuildRequires: perl(File::Spec) +BuildRequires: perl(Inline) +BuildRequires: perl(Inline::C) +BuildRequires: perl(List::MoreUtils) +BuildRequires: perl(Path::Tiny) +BuildRequires: perl(Test::Differences) +BuildRequires: perl(Test::More) +BuildRequires: perl(Test::RunValgrind) +BuildRequires: perl(Test::Trap) +BuildRequires: perl(autodie) +BuildRequires: perl(base) +BuildRequires: perl(lib) +BuildRequires: perl(strict) +BuildRequires: perl(warnings) +BuildRequires: perl-devel +BuildRequires: python3 +BuildRequires: valgrind +BuildRequires: xxhash-devel + +%description +This is a solver, written in C, to solve the Solitaire variants “Golf”, +“Black Hole” and “All in a Row”. It provides a portable C library, and +a command line application that after being fed with a layout will emit the +cards to move. + +%files +%license COPYING +%doc NEWS README.md TODO.quicktask +%_bindir/black-hole-solve +%{_mandir}/man6/black-hole-solve.6.* + +#-------------------------------------------------------------------- + +%package -n %{libname} +Summary: The Black Hole Solver dynamic libraries + +%description -n %{libname} +Contains the Black Hole Solver libraries that are used by some programs. + +This package is mandatory for the Black Hole Solver executable too. + +%files -n %{libname} +%{_libdir}/libblack_hole_solver.so.%{major}{,.*} + +#-------------------------------------------------------------------- + +%package -n %{develname} +Summary: The Black Hole Solitaire development tools +Requires: %{libname}%{?_isa} = %version-%release +Provides: %{name}-devel = %{version}-%{release} + +%description -n %{develname} +Development tools for the Black Hole Solitaire Solver. + +%files -n %{develname} +%_includedir/black-hole-solver/*.h +%{_libdir}/pkgconfig/*.pc +%{_libdir}/libblack_hole_solver.so + +#-------------------------------------------------------------------- + +%prep +%setup -q +%autopatch -p1 +rm -fr xxHash*/xxHash* + +%build +# The game limit flags are recommended by the PySolFC README. +%cmake -DLOCALE_INSTALL_DIR=%{_datadir}/locale -DLIB_INSTALL_DIR=%{_libdir} -DBUILD_STATIC_LIBRARY= +%make_build + +%check +%ifarch %arm +# valgrind suppression not working without glibc-debuginfo breaks it +rm -f t/valgrind.t +%endif +rm -f t/clang-format.t +rm -f t/perltidy.t +# fails due to build containing binaries +rm -f t/style-trailing-space.t +# %%make_build test +perl ./run-tests.pl + +%install +%{make_install} +rm -f %{buildroot}/%{_libdir}/*.a + +%changelog +* Wed Apr 24 2019 Shlomi Fish 0.20.0-1 +- Initial Fedora package based on the Mageia one. diff --git a/sources b/sources new file mode 100644 index 0000000..039e69f --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (black-hole-solver-0.20.0.tar.xz) = c7dd7fdb6a6a1fe5faf54a11f99a41f8fd142d2a2ab7e640b7d3853f2246f3bfa714be8675c8dc2db1ab2ade23bedeaa00b320b9ce77124fb17d76141be72aca