name=v
version=10d738c7733f3046c16358b82bd72b80d7a27c26
revision=1
tarball_url="https://github.com/vlang/v/archive/${version}.tar.gz"
tarball_blake2b="9d2d98192be8b5467dc1ee94ba55dd71bc42f9065e72edc6b86f947c98271bb61b7d18133dde4a9b1f46dac1e20de5f7d42efde8637db9d1e5aae4d698fdd3aa"
source_imagedeps="curl"
source_allow_network="yes"
hostdeps="gcc"
deps="core-libs"

regenerate() {
    curl -o v.c https://raw.githubusercontent.com/vlang/vc/4076df679d4d35c51de44c327e8271f3e1eefd01/v.c
}

build() {
    cp -r ${source_dir}/. ./

    x86_64-vinix-gcc -O2 -pipe -w -std=gnu99 -fno-strict-aliasing v.c -o v
}

package() {
    rm -rf "${dest_dir}${prefix}"/v
    mkdir -p "${dest_dir}${prefix}"/v
    cp -r . "${dest_dir}${prefix}"/v/

    mkdir -p "${dest_dir}${prefix}"/bin
    ln -sf ../v/v "${dest_dir}${prefix}"/bin/v

    post_package_strip
}
