diff --git a/.gitignore b/.gitignore index e69de29..7409d12 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/double-conversion-2.0.0.tar.gz diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000..d000b8c --- /dev/null +++ b/SConstruct @@ -0,0 +1,40 @@ +# vim:ft=python +import os + +double_conversion_sources = ['src/' + x for x in SConscript('src/SConscript')] +double_conversion_test_sources = ['test/cctest/' + x for x in SConscript('test/cctest/SConscript')] +test = double_conversion_sources + double_conversion_test_sources +print(test) + +DESTDIR = ARGUMENTS.get('DESTDIR', '') +prefix = ARGUMENTS.get('prefix', '/usr/local') +lib = ARGUMENTS.get('libsuffix', 'lib') +libdir = os.path.join(DESTDIR + prefix, lib) + +env = Environment(CPPPATH='#/src', LIBS=['m', 'stdc++'], CXXFLAGS=ARGUMENTS.get('CXXFLAGS', '')) +debug = ARGUMENTS.get('debug', 0) +optimize = ARGUMENTS.get('optimize', 0) +env.Replace(CXX = ARGUMENTS.get('CXX', 'g++')) + +# for shared lib, requires scons 2.3.0 +env['SHLIBVERSION'] = ARGUMENTS.get('VERSION', '') + +print double_conversion_sources +print double_conversion_test_sources +double_conversion_shared_objects = [ + env.SharedObject(src) for src in double_conversion_sources] +double_conversion_static_objects = [ + env.StaticObject(src) for src in double_conversion_sources] + +library_name = 'double-conversion' + +static_lib = env.StaticLibrary(library_name, double_conversion_static_objects) +static_lib_pic = env.StaticLibrary(library_name + '_pic', double_conversion_shared_objects) +shared_lib = env.SharedLibrary(library_name, double_conversion_shared_objects) + +env.Program('run_tests', double_conversion_test_sources, LIBS=[static_lib]) + +env.Alias('install-shared', env.InstallVersionedLib(libdir, shared_lib)) +env.Alias('install-static', env.Install(libdir, static_lib)) +env.Alias('install-static', env.Install(libdir, static_lib_pic)) +Alias('install', ['install-shared', 'install-static']) diff --git a/double-conversion.spec b/double-conversion.spec new file mode 100644 index 0000000..3fcf2a6 --- /dev/null +++ b/double-conversion.spec @@ -0,0 +1,113 @@ +%bcond_without static_libs # don't build static libraries + +Summary: Library providing binary-decimal and decimal-binary routines for IEEE doubles +Name: double-conversion +Version: 2.0.0 +Release: 4%{?dist} +License: BSD +Group: Development/Libraries +Source0: http://double-conversion.googlecode.com/files/%{name}-%{version}.tar.gz +# Currently needed to build a shared library with required options, filed upstream as +# http://code.google.com/p/double-conversion/issues/detail?id=42 +Source1: SConstruct +URL: http://code.google.com/p/double-conversion +BuildRequires: scons >= 2.3.0 + +%description +Provides binary-decimal and decimal-binary routines for IEEE doubles. +The library consists of efficient conversion routines that have been +extracted from the V8 JavaScript engine. The code has been re-factored +and improved so that it can be used more easily in other projects. + +%package devel +Summary: Library providing binary-decimal and decimal-binary routines for IEEE doubles +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +Contains header files for developing applications that use the %{name} +library. + +There is extensive documentation in src/double-conversion.h. Other +examples can be found in test/cctest/test-conversions.cc. + +%package static +Summary: Library providing binary-decimal and decimal-binary routines for IEEE doubles +Group: Development/Libraries +Requires: %{name}-devel%{?_isa} = %{version}-%{release} + +%description static +Static %{name} library. + +%prep +%setup -q -c %{name}-%{version} +cp -p %{SOURCE1} SConstruct + +%build +scons %{?_smp_mflags} \ + CXXFLAGS="%{optflags}" \ + VERSION="%{version}" + +# With scons 2.3.0 setting the version fails without this +# http://comments.gmane.org/gmane.comp.programming.tools.scons.user/24448 +rm -f libdouble-conversion.so* + +%install +install -d %{buildroot}{%{_libdir},%{_includedir}/%{name}} + +%if %{with static_libs} +%global target install +%else +%global target install-shared +%endif + +scons %{target} \ + CXXFLAGS="%{optflags}" \ + libsuffix=%{_lib} \ + prefix=%{_prefix} \ + DESTDIR=%{buildroot} \ + VERSION="%{version}" + +cp -p src/*.h %{buildroot}%{_includedir}/%{name} + +%check +scons CXXFLAGS="%{optflags}" run_tests +./run_tests --list | tr -d '<' | xargs ./run_tests + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%doc LICENSE README AUTHORS Changelog +%{_libdir}/libdouble-conversion.so.2* + +%files devel +%{_libdir}/libdouble-conversion.so +%{_includedir}/%{name} + +%if %{with static_libs} +%files static +%{_libdir}/libdouble-conversion.a +%{_libdir}/libdouble-conversion_pic.a +%endif + +%changelog +* Tue Dec 17 2013 Milan Bouchet-Valat - 2.0.0-4 +- Drop libstdc++-devel from BuildRequires. +- Move %%check after %%install. + +* Sat Dec 14 2013 Milan Bouchet-Valat - 2.0.0-3 +- Remove gcc-c++ from BuildRequires as it is an exception. +- Fix command in %%check and pass CXXFLAGS to scons. +- Use %%global instead of %%define. + +* Thu Dec 12 2013 Milan Bouchet-Valat - 2.0.0-2 +- Fix building when "--without static_libs" is passed. +- Remove %%ghost with libdouble-conversion.so.2. +- Drop BuildRoot. +- Use rm instead of %%{__rm} for consistency +- Use %%{?dist} in Release. + +* Wed Dec 11 2013 Milan Bouchet-Valat - 2.0.0-1 +- Initial Fedora package based on a PLD Linux RPM by Elan Ruusamäe : + http://git.pld-linux.org/gitweb.cgi?p=packages/double-conversion.git diff --git a/sources b/sources index e69de29..f491ad5 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +a2ca5b30282b37222ad1eae01b6f2345 double-conversion-2.0.0.tar.gz