# Template file for 'mixxx'
pkgname=mixxx
version=2.0.0.20180219
revision=1
_gitrev="231132e108804db7f832faf0d9d0dce238118e2a"
hostmakedepends="scons pkg-config"
makedepends="portaudio-devel libusb-devel libmad-devel protobuf-devel
 libid3tag-devel glu-devel taglib-devel opus-devel portmidi-devel
 vamp-plugin-sdk-devel faad2-devel libmp4v2-devel libshout-devel
 rubberband-devel chromaprint-devel fftw-devel ffmpeg-devel upower0-devel
 qt5-svg-devel qt5-script-devel qt5-xmlpatterns-devel qt5-script-devel"
depends="qt5-plugin-sqlite"
short_desc="Open source digital DJing software that allows mixing music"
maintainer="Enno Boland <gottox@voidlinux.eu>"
homepage="http://www.mixxx.org"
license="GPL-2"
distfiles="https://github.com/mixxxdj/mixxx/archive/${_gitrev}.tar.gz>${pkgname}-${version}.tar.gz"
checksum=2144f19492a52a698c27b7c97089169752d6109e6f8c65e697ca0885b27cb27b
_scons_args="shoutcast=1 faad=1 tuned=0 prefix=/usr qt5=1 qtdir=/usr/include/qt5"
#wrksrc=$pkgname-release-$version
wrksrc=${pkgname}-${_gitrev}

nocross="https://build.voidlinux.eu/builders/armv7l_builder/builds/7882/steps/shell_3/logs/stdio"

do_build() {
	case "$XBPS_TARGET_MACHINE" in
		*-musl) find plugins -type f -exec sed -i "{}" \
			-e "s;u_int8_t;uint8_t;g" -e "s;u_int32_t;uint32_t;g" \;
			;;
	esac
	if [ "${XBPS_TARGET_MACHINE%-musl}" = "i686" ]; then
		export CFLAGS+=" -msse"
		export CXXFLAGS+=" -msse"
	fi
	sed -i \
		-e 's/branch_name = .*/branch_name = "mixxx"/' \
		-e 's/vcs_revision = .*/vcs_revision = "'$version'"/' \
		src/SConscript

	MAKEFLAGS="${makejobs}" scons ${makejobs} ${_scons_args}
}
do_install() {
	if [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
		export CFLAGS+=" -msse"
		export CXXFLAGS+=" -msse"
	fi
	scons ${_scons_args} install_root=${DESTDIR}/usr install
}
