%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary: Garbage Collector for C and C++ 	
Summary(ja): C, C++ ガーベージコレクションライブラリ
Name:    gc	
Version: 8.0.4
Release: 1%{?_dist_release}
Group:	 System Environment/Libraries
License: BSD
URL:     https://www.hboehm.info/gc/
Source:  https://www.hboehm.info/gc/gc_source/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root

BuildRequires: libatomic_ops-devel

#Patch1: gc-6.4-opendl.patch

Vendor: Project Vine
Distribution: Vine Linux

Packager: inagaki

%description
The Boehm-Demers-Weiser conservative garbage collector can be used as a garbage 
collecting replacement for C malloc or C++ new.

%package devel
Summary: Libraries and header files for gc development 
Summary(ja): gc の開発用ライブラリおよびヘッダファイル
Group:   Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
Libraries and header files for gc development.


## to build compat32 for x86_64 architecture support
%package -n compat32-%{name}
Summary: Garbage Collector for C and C++ 	
Group:	 System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description -n compat32-%{name}
The Boehm-Demers-Weiser conservative garbage collector can be used as a garbage 
collecting replacement for C malloc or C++ new.

%package -n compat32-%{name}-devel
Summary: Libraries and header files for gc development 
Group:   Development/Libraries
Requires: compat32-%{name} = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}

%description -n compat32-%{name}-devel
Libraries and header files for gc development.


%prep
%setup -q

%build
%configure \
  --enable-cplusplus \
  --disable-static \
  --disable-dependency-tracking \
  --enable-large-config \
  --enable-threads=posix
  
make %{?_smp_mflags}

%check
make check

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install 
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man3
install -m644 doc/gc.man $RPM_BUILD_ROOT%{_mandir}/man3/gc.3
## Unpackaged files
rm -rf $RPM_BUILD_ROOT%{_datadir}/gc
rm -f  $RPM_BUILD_ROOT%{_libdir}/lib*.la
rm -rf $RPM_BUILD_ROOT%{_docdir}/gc

%clean
rm -rf 	$RPM_BUILD_ROOT

%post   -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig

%postun -n compat32-%{name} -p /sbin/ldconfig


%files 
%defattr(-,root,root)
%doc ChangeLog doc/README*
%{_libdir}/lib*.so.*

%files devel
%defattr(-,root,root)
%doc doc/*.html
%dir %{_includedir}/gc
%{_includedir}/gc.h
%{_includedir}/gc_cpp.h
%{_includedir}/gc/*
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man?/*

## to build compat32 for x86_64 architecture support
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
%{_libdir}/lib*.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root)
%{_libdir}/lib*.so
%endif


%changelog
* Tue Sep 10 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 8.0.4-1
- updated to 8.0.4.

* Fri Jul  1 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 7.4.4-1
- updated to 7.4.4.

* Sun Jan 25 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 7.2f-1
- update to 7.2f

* Thu Dec 26 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 7.2e-1
- new upstream release

* Sun Oct 03 2010 Shu KONNO <owa@bg.wakwak.com> 7.1-3
- rebuilt with rpm-4.8.1 for pkg-config

* Sun Jul 05 2009 NAKAMURA Kenta <kenta@vinelinux.org> 7.1-2
- removed unneccesary %if !%{build_compat32} case condition

* Wed Jun 10 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 7.1-1
- new upstream release

* Wed Apr 01 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 7.0-2
- spec in utf-8
- remove static library
- add --enable-large-config --enable-threads=posix

* Wed Apr 30 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 7.0-1
- new upstream release

* Sat Feb 10 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 6.8-0vl1
- new upstream release

* Wed Jul 19 2006 Shu KONNO <owa@bg.wakwak.com> 6.6-0vl2
- added compat32-* packages for x86_64 architecture support

* Thu Feb 09 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 6.6-0vl1
- new upstream release

* Tue May 03 2005 Satoshi MACHINO <machino@vinelinux.org> 6.4-0vl1
- new upstream release
	-- updated patch1

* Sun Jan 18 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 6.2-0vl1
- initial build for Vine Linux
