# Description: Extra library for file management
# URL: https://wiki.lxde.org/en/PCManFM
# Maintainer: unmaintained
# Depends on: glib intltool

name=libfm-extra
version=1.3.2
release=1
source=(https://downloads.sourceforge.net/pcmanfm/libfm-$version.tar.xz)

build() {
  cd libfm-$version

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --with-extra-only \
    --with-gtk=no

  # https://bugzilla.gnome.org/show_bug.cgi?id=656231
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
  make DESTDIR="$SRC/libfm-extra" install

  install -d $PKG/usr/include/libfm $PKG/usr/lib/pkgconfig
  install -m 644 -t $PKG/usr/include/libfm $SRC/libfm-extra/usr/include/libfm/fm-{extra,version,xml-file}.h
  install -m 644 -t $PKG/usr/lib $SRC/libfm-extra/usr/lib/libfm-extra.*
  install -m 644 -t $PKG/usr/lib/pkgconfig $SRC/libfm-extra/usr/lib/pkgconfig/libfm-extra.pc

  rm $PKG/usr/lib/libfm-extra.so.4
  ln -s libfm-extra.so.4.1.3 $PKG/usr/lib/libfm-extra.so.4
}
