# Maintainer: Nicola Squartini <tensor5@gmail.com>

pkgname=solidity
pkgver=0.5.11
_commit=22be85921b5b0846295608e997e7af9b08ba9ad9
pkgrel=1
pkgdesc='Contract-Oriented Programming Language'
arch=('x86_64')
url='https://github.com/ethereum/solidity'
license=('GPL3')
depends=('gcc-libs')
makedepends=('boost' 'cmake' 'git')
source=("git+https://github.com/ethereum/solidity.git#commit=${_commit}")
sha256sums=('SKIP')

prepare() {
    cd ${pkgname}

    commithash=$(git rev-parse --short=8 HEAD)
    echo -n ${commithash} > commit_hash.txt
    echo -n > prerelease.txt

    # Fix for GCC 8
    sed -e '/add_compile_options(-Wall)/d' -i cmake/EthCompilerSettings.cmake
}

build() {
    cd ${pkgname}

    mkdir build
    cd build
    cmake \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DTESTS=OFF \
        ..
    make
}

package() {
    cd ${pkgname}/build

    make DESTDIR="${pkgdir}" install
}
