# Maintainer (Arch): Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor (Arch): Andreas Radke <andyrtr@archlinux.org>
# Contributor (Arch): rabyte <rabyte@gmail.com>
# Contributor (Arch): Johannes Krampf <wuischke@amule.org>
# Contributor (Arch): Bartłomiej Piotrowski <barthalion@gmail.com>
# Contributor (Arch): André Silva <emulatorman@hyperbola.info>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=midori
pkgver=9.0
pkgrel=1
pkgrel+=.parabola1
pkgdesc='Lightweight web browser'
pkgdesc+=', without non-privacy search engines'
arch=(x86_64)
arch+=(i686 armv7h)
url='https://midori-browser.org/'
license=(LGPL)
depends=(aria2 gcr libarchive libpeas libxss webkit2gtk zeitgeist)
makedepends=(bzr cmake git gobject-introspection intltool ninja vala)
optdepends=('gst-plugins-base: HTML5 OGG videos support'
            'gst-plugins-good: HTML5 H264 and WebM videos support'
            'gst-libav: HTML5 H264 videos support')
options=(!emptydirs)
source=("$pkgname::git+https://github.com/midori-browser/core.git#tag=v$pkgver")
md5sums=('SKIP')

prepare() {
  cd $pkgname

  # Remove non-privacy search engines
  sed -i 's|Duck Duck Go|DuckDuckGo HTML|
          s|duckduckgo[.]com|duckduckgo.com/html|
          \|Yahoo|d
          \|Google|d
         ' core/preferences.vala

  # Use DuckDuckGo HTML
  sed -i 's|duckduckgo[.]com|duckduckgo.com/html|g' core/settings.vala
}

build() {
  mkdir -p build
  cd build
  cmake "$srcdir/$pkgname" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_C_FLAGS="$CFLAGS -fPIC -w" \
    -DVALA_CFLAGS="$CFLAGS -fPIC -w" \
    -G Ninja
  ninja
}

package() {
  DESTDIR="$pkgdir" ninja -C build install
}

# getver: -u 8 raw.githubusercontent.com/midori-browser/core/master/CMakeLists.txt
# vim:set ts=2 sw=2 et:
