This commit is contained in:
Jens Petersen 2022-03-24 14:31:24 +08:00
parent 7c7c7e8ee4
commit 3686a9e95a
5 changed files with 310 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/double-conversion-2.0.2.0.tar.gz

View File

@ -0,0 +1,133 @@
name: double-conversion
version: 2.0.2.0
x-revision: 1
license: BSD3
license-file: LICENSE
homepage: https://github.com/bos/double-conversion
bug-reports: https://github.com/bos/double-conversion/issues
category: Text
author: Bryan O'Sullivan <bos@serpentine.com>
maintainer: Bryan O'Sullivan <bos@serpentine.com>
stability: experimental
synopsis: Fast conversion between double precision floating point and text
cabal-version: >= 1.8
build-type: Simple
description:
A library that performs fast, accurate conversion between double
precision floating point and text.
.
This library is implemented as bindings to the C++
@double-conversion@ library written by Florian Loitsch at Google:
<https://github.com/floitsch/double-conversion>.
.
The 'Text' versions of these functions are about 30 times faster
than the default 'show' implementation for the 'Double' type.
.
The 'ByteString' versions are /slower/ than the 'Text' versions;
roughly half the speed. (This seems to be due to the cost of
allocating 'ByteString' values via @malloc@.)
.
As a final note, be aware that the @bytestring-show@ package is
about 50% slower than simply using 'show'.
extra-source-files:
README.markdown
benchmarks/*.cabal
benchmarks/*.hs
double-conversion/*.cmake.in
double-conversion/AUTHORS
double-conversion/CMakeLists.txt
double-conversion/COPYING
double-conversion/Changelog
double-conversion/LICENSE
double-conversion/Makefile
double-conversion/README
double-conversion/SConstruct
double-conversion/src/*.cc
double-conversion/src/*.h
double-conversion/src/CMakeLists.txt
double-conversion/src/SConscript
double-conversion/test/CMakeLists.txt
double-conversion/test/cctest/*.cc
double-conversion/test/cctest/*.h
double-conversion/test/cctest/CMakeLists.txt
double-conversion/test/cctest/SConscript
include/*.h
tests/*.hs
flag developer
description: operate in developer mode
default: False
manual: True
library
c-sources:
cbits/hs-double-conversion.cc
double-conversion/src/bignum.cc
double-conversion/src/bignum-dtoa.cc
double-conversion/src/cached-powers.cc
double-conversion/src/diy-fp.cc
double-conversion/src/double-conversion.cc
double-conversion/src/fast-dtoa.cc
double-conversion/src/fixed-dtoa.cc
double-conversion/src/strtod.cc
if os(windows)
if arch(x86_64)
extra-libraries: stdc++-6 gcc_s_seh-1
else
extra-libraries: stdc++-6 gcc_s_dw2-1
else
if os(darwin)
extra-libraries: c++
else
extra-libraries: stdc++
include-dirs:
double-conversion/src
include
exposed-modules:
Data.Double.Conversion.ByteString
Data.Double.Conversion.Text
other-modules:
Data.Double.Conversion.FFI
build-depends:
base == 4.*,
bytestring,
ghc-prim,
text >= 0.11.0.8 && < 1.3
if flag(developer)
ghc-options: -Werror
ghc-prof-options: -auto-all
else
cc-options: -DNDEBUG
ghc-options: -Wall
test-suite tests
type: exitcode-stdio-1.0
hs-source-dirs: tests
main-is: Properties.hs
other-modules: Regressions
ghc-options: -Wall
build-depends:
HUnit,
base,
bytestring,
double-conversion,
test-framework,
test-framework-hunit,
test-framework-quickcheck2,
text
source-repository head
type: git
location: https://github.com/bos/double-conversion
source-repository head
type: mercurial
location: https://bitbucket.org/bos/double-conversion

138
ghc-double-conversion.spec Normal file
View File

@ -0,0 +1,138 @@
# generated by cabal-rpm-2.0.11
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Haskell/
%global pkg_name double-conversion
%global pkgver %{pkg_name}-%{version}
# testsuite missing deps: test-framework test-framework-hunit test-framework-quickcheck2
Name: ghc-%{pkg_name}
Version: 2.0.2.0
Release: 1%{?dist}
Summary: Fast conversion between double precision floating point and text
License: BSD
Url: https://hackage.haskell.org/package/%{pkg_name}
# Begin cabal-rpm sources:
Source0: https://hackage.haskell.org/package/%{pkgver}/%{pkgver}.tar.gz
Source1: https://hackage.haskell.org/package/%{pkgver}/%{pkg_name}.cabal#/%{pkgver}.cabal
# End cabal-rpm sources
# tweaked https://salsa.debian.org/haskell-team/DHG_packages/-/raw/master/p/haskell-double-conversion/debian/patches/
Patch0: use-system-lib.diff
# Begin cabal-rpm deps:
BuildRequires: dos2unix
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-base-prof
BuildRequires: ghc-bytestring-prof
BuildRequires: ghc-text-prof
BuildRequires: double-conversion-devel
BuildRequires: gcc-c++
# End cabal-rpm deps
%description
A library that performs fast, accurate conversion between double precision
floating point and text.
This library is implemented as bindings to the C++ 'double-conversion' library
written by Florian Loitsch at Google:
<https://github.com/floitsch/double-conversion>.
The 'Text' versions of these functions are about 30 times faster than the
default 'show' implementation for the 'Double' type.
The 'ByteString' versions are /slower/ than the 'Text' versions; roughly half
the speed. (This seems to be due to the cost of allocating 'ByteString' values
via 'malloc'.)
As a final note, be aware that the 'bytestring-show' package is about 50%
slower than simply using 'show'.
%package devel
Summary: Haskell %{pkg_name} library development files
Provides: %{name}-static = %{version}-%{release}
Provides: %{name}-static%{?_isa} = %{version}-%{release}
%if %{defined ghc_version}
Requires: ghc-compiler = %{ghc_version}
%endif
Requires: %{name}%{?_isa} = %{version}-%{release}
# Begin cabal-rpm deps:
Requires: double-conversion-devel%{?_isa}
# End cabal-rpm deps
%description devel
This package provides the Haskell %{pkg_name} library development
files.
%if %{with haddock}
%package doc
Summary: Haskell %{pkg_name} library documentation
BuildArch: noarch
Requires: ghc-filesystem
%description doc
This package provides the Haskell %{pkg_name} library documentation.
%endif
%if %{with ghc_prof}
%package prof
Summary: Haskell %{pkg_name} profiling library
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
Supplements: (%{name}-devel and ghc-prof)
%description prof
This package provides the Haskell %{pkg_name} profiling library.
%endif
%prep
# Begin cabal-rpm setup:
%setup -q -n %{pkgver}
dos2unix -k -n %{SOURCE1} %{pkg_name}.cabal
# End cabal-rpm setup
%patch0 -p1 -b .orig
# remove bundled library
rm -r double-conversion
%build
# Begin cabal-rpm build:
%ghc_lib_build
# End cabal-rpm build
%install
# Begin cabal-rpm install
%ghc_lib_install
# End cabal-rpm install
%files -f %{name}.files
# Begin cabal-rpm files:
%license LICENSE
# End cabal-rpm files
%files devel -f %{name}-devel.files
%doc README.markdown
%if %{with haddock}
%files doc -f %{name}-doc.files
%license LICENSE
%endif
%if %{with ghc_prof}
%files prof -f %{name}-prof.files
%endif
%changelog
* Tue Mar 22 2022 Jens Petersen <petersen@redhat.com> - 2.0.2.0-1
- spec file generated by cabal-rpm-2.0.11

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (double-conversion-2.0.2.0.tar.gz) = 1713c4e8a28de2ee85e1f312dc12d30a9c6d7a139d89f04ea88048578ce65c8bdf62ded90b92bce011955b95867ca95a623a5109758276a29ba7b6843fbe37eb

37
use-system-lib.diff Normal file
View File

@ -0,0 +1,37 @@
--- a/cbits/hs-double-conversion.cc
+++ b/cbits/hs-double-conversion.cc
@@ -1,4 +1,4 @@
-#include "double-conversion.h"
+#include <double-conversion/double-conversion.h>
#include "hs-double-conversion.h"
#include <stdio.h>
--- double-conversion-2.0.2.0/double-conversion.cabal~ 2022-03-22 17:26:11.726199692 +0800
+++ double-conversion-2.0.2.0/double-conversion.cabal 2022-03-22 17:47:44.654066156 +0800
@@ -63,14 +63,6 @@
library
c-sources:
cbits/hs-double-conversion.cc
- double-conversion/src/bignum.cc
- double-conversion/src/bignum-dtoa.cc
- double-conversion/src/cached-powers.cc
- double-conversion/src/diy-fp.cc
- double-conversion/src/double-conversion.cc
- double-conversion/src/fast-dtoa.cc
- double-conversion/src/fixed-dtoa.cc
- double-conversion/src/strtod.cc
if os(windows)
if arch(x86_64)
@@ -81,10 +73,9 @@
if os(darwin)
extra-libraries: c++
else
- extra-libraries: stdc++
+ extra-libraries: stdc++ double-conversion
include-dirs:
- double-conversion/src
include
exposed-modules: