%define _sbindir    /sbin

Summary: The GNU disk partition manipulation program.
Summary(ja): ディスクパーティション操作ツール
Name: parted
Version: 3.2.153
Release: 1%{?_dist_release}
License: GPLv3
Group: Applications/Administration
URL: http://www.gnu.org/software/parted/

Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz

# Upstream still uses python2 for these scripts
Patch0000: 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: e2fsprogs-devel, ncurses-devel, readline-devel
BuildRequires: python3-devel, ncurses-devel
BuildRequires: device-mapper-devel
BuildRequires: libtool, automake, autoconf
BuildRequires: gettext-devel >= 0.18
BuildRequires: texinfo
BuildRequires: libuuid-devel
BuildRequires: libblkid-devel >= 2.17
BuildRequires: gnupg

Provides: libparted = %{version}-%{release}

Vendor: Project Vine
Distribution: Vine Linux

%description
GNU Parted is a program that allows you to create, destroy,
resize, move and copy hard disk partitions. This is useful for
creating space for new operating systems, reorganising disk
usage, and copying data to new hard disks.

%description -l ja
GNU Parted はハードディスクのパーティションを作成/削除/リサイズ/
移動/コピーすることが出来るプログラムです．新しいオペレーティング
システムをインストールするスペースを確保したり，ディスクのパーティションを
整理したり，新しいハードディスクにデータをコピーする際に非常に便利です．

%package devel
Summary: Files for developing apps which will manipulate disk partitions.
Summary(ja) : パーティション操作をするアプリケーションの開発用ファイル
Group: Development/Libraries
Requires: parted = %{version}-%{release}
Provides: libparted-devel = %{version}-%{release}

%description devel
The GNU Parted library is a set of routines for hard disk partition
manipulation. If you want to develop programs that manipulate disk
partitions and filesystems using the routines provided by the GNU
Parted library, you need to install this package.

%description devel -l ja
GNU Parted ライブラリにはハードディスクのパーティションを操作する
関数が用意されています。GNU Parted ライブラリが提供する関数を使って
ディスクパーティションやファイルシステムを操作するプログラムを開発
したいのであれば、このパッケージをインストールして下さい。

%prep
%setup -q
%patch0 -p1 -b .python3

iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS

%build
autoreconf
autoconf

CFLAGS="$RPM_OPT_FLAGS -Wno-unused-but-set-variable"; export CFLAGS
%configure \
    --enable-device-mapper \
    --enable-shared 

# Don't use rpath!
%{__sed} -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
%{__sed} -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

%__make %{?_smp_mflags}

%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
%__make install DESTDIR=$RPM_BUILD_ROOT

# Remove components we do not ship
%{__rm} -rf %{buildroot}%{_libdir}/*.la
%{__rm} -rf %{buildroot}%{_infodir}/dir
%{__rm} -rf %{buildroot}%{_bindir}/label

%find_lang %{name}

%post
/sbin/ldconfig
/sbin/install-info %{_infodir}/parted.info.gz %{_infodir}/dir >/dev/null 2>&1 || : 

%postun
/sbin/ldconfig

%preun 
if [ $1 = 0 ]; then
   /sbin/install-info --delete %{_infodir}/parted.info.gz %{_infodir}/dir >/dev/null 2>&1 || :
fi

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-,root,root)
%license COPYING
%doc AUTHORS BUGS ChangeLog NEWS README THANKS TODO
%doc doc/FAT doc/USER.jp
%{_sbindir}/*
%{_mandir}/man8/*
%{_libdir}/lib*.so.*
%{_infodir}/parted.info*

%files devel
%defattr(-,root,root)
%doc doc/API
%{_includedir}/*
%{_libdir}/lib*.so
%{_libdir}/*.a
%{_libdir}/pkgconfig/libparted*.pc

%changelog
* Mon Sep 02 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.2.153-1
- new upstream release.
- built with readline-8.0.

* Thu Apr  2 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.2-2
- rebuilt with readline 6.3

* Sun Aug 24 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.2-1
- new upstream release

* Wed Jan 15 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.1-2
- rebuild with VineSeed environment

* Sun Jul 15 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.1-1
- new upstream release
- remove Patch1

* Thu Jan 05 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0-1
- new upstream release
- remove Patch0

* Tue Nov  9 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.3-1
- new upstream release
- drop old patches
- new patch for 2.3 from fc14 
- add BRs: libuuid-devel, libblkid-devel >= 2.17, gnupg
- change BR: gettext -> gettext-devel >= 0.18

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

* Sun Aug 17 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.8.8-1
- new upstream release
- import patch[1-8] from fedora

* Sat May 19 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.8.1-1vl2
- rebuild with new environment/toolchain.

* Fri Dec  8 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.8.1-1vl1
- new upstream release
- remove Patch0, 3, 100, 150, 151 and 152 (merged into upstream)

* Sat Sep  9 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.25.1-0vl2
- changed Group to Applications/Administration

* Wed May  3 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.25.1-0vl1
- new upstream release

* Thu Dec  1 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.25-3vl1
- new upstream release
- updated Patch3, 100, 150 and 151 from Fedora
  * Wed Nov 09 2005 Chris Lumens <clumens@redhat.com> 1.6.25-1
  - Update DASD, iseries, and SX8 patches.

* Mon Aug 22 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.24-0vl1
- new upstream release
- updated Patch100, 151

* Mon Apr 11 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.22-0vl1
- new upstream release

* Thu Jan 27 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.21-1vl1
- new upstream release
- added Patch3 and Patch152, updated Patch150 (from Fedora)
  * Tue Dec 14 2004 Jeremy Katz <katzj@redhat.com> - 1.6.19-2
  - add support for Promise SX8 devices
  * Thu Nov 11 2004 Jeremy Katz <katzj@redhat.com> - 1.6.16-2
  - add patch from Matt Domsch to fix consistency of GPT disk labels 
    with the EFI specification for disks > 2TB (#138480)

* Tue Nov 23 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.18-0vl1
- new upstream release

* Thu Nov 18 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.16-0vl1
- new upstream release

* Sun Sep 26 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.15-0vl1
- new upstream release
- added BuildRequires: automake autoconf gettext
- patches from Fedora development
  * Tue Aug 24 2004 Jeremy Katz <katzj@redhat.com> - 1.6.12-2
  - fix assertion error when checking flags on non-active partition (#130692)
  - buildrequires: gettext-devel
  * Mon Aug 16 2004 Jeremy Katz <katzj@redhat.com> - 1.6.12-1
  - update to 1.6.12 with major changes to CHS handling to hopefully fix #115980
  - adjust dasd patch accordingly, drop some included patches
  * Mon Jul 19 2004 Karsten Hopp <karsten@redhat.de> 1.6.11-4 
  - update dasd patch for dos-type partitions on mainframes (scsi disks)

* Sun Aug 22 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.12-0vl1
- new upstream release
- removed BuildRequires: automake17 autoconf
- updated %post %postun section to install .info file

* Sun Apr 18 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.10-0vl2
- dropped BuildRequires: libunicode-devel

* Sat Apr 17 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.10-0vl1
- updated to current stable release 1.6.10
- changed BuildRequires: automake17
- added compile optioin -Os
- dropped patch1

* Fri Jun  6 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.5-0vl1
- updated to current stable release 1.6.5
- changed summay and description based on Rawhide specfile

* Tue Jan 29 2002 Toru Sagami <sagami@vinelinux.org> 1.4.24-0vl1
- updated to current stable release 1.4.24

* Sun Jan 06 2002 Toru Sagami <sagami@vinelinux.org>
- 1.4.21-0vl1 
- enable __libtoolize

* Wed Nov 21 2001 Toru Sagami <sagami@vinelinux.org>
- 1.4.19-0vl1 

* Thu Oct 04 2001 Toru Sagami <sagami@vinelinux.org>
- 1.4.19-0vl1 

* Sun Aug 19 2001 Toru Sagami <sagami@vinelinux.org>
- 1.4.18-0vl1 
- Where did any python related files go?  Erase'em.

* Wed Aug 15 2001 <sagami@vinelinux.org>
- 1.4.16-0vl1 
- build w/ --enable-shared --enable-all-static, instead of --disable-shared 
- consequently, eliminate Requires against e2fsprogs, readline
- ldconfig at post/postun

* Mon Jul 09 2001 <sagami@vinelinux.org>
- 1.4.15-0vl1: use %%{find_lang}, added doc/FAQ
- %%define __libtoolize /bin/true

* Mon May 28 2001 <sagami@vinelinux.org>
- 1.4.13-0vl1

* Wed Apr 18 2001 <sagami@vinelinux.org>
- 1.4.10-0vl1

* Sun Jan 21 2001 Toru Sagami <czs14350@mb.infoweb.ne.jp>
- updated to 1.4.7-0vl1
- changed Group for devel subpackage
- added USER.jp in %doc

* Sun Dec 10 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.4.2-1vl2
- partially used rpmmacros

* Mon Nov 20 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.4.2-1vl1
- build for Vine Linux
- added Japanese summary and description

* Mon Mar 13 2000 Fabian Emmes <fab@orlen.de>
- changed "unset LINGUAS" line
- reintroduced %build section ;)
- started changelog
