# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2022 Friedrich Kink

include ../../../make-rules/shared-macros.mk

COMPONENT_NAME=		spandsp
COMPONENT_VERSION=	3.0.0
COMPONENT_REVISION=	3
COMPONENT_SUMMARY=	A DSP library for telephony
COMPONENT_DESCRIPTION=  \
	SpanDSP is a low-level signal processing library that modulates and demodulates \
	signals commonly used in telephony, such as the "noise" generated by a fax modem \
	or DTMF touchpad.
COMPONENT_SRC=          $(COMPONENT_NAME)-master
COMPONENT_ARCHIVE=	master.zip
COMPONENT_ARCHIVE_HASH= sha256:fdee8fbba0b471500928cd88207a96e1eb89bbca6b518249cf58c11b767de2a1
COMPONENT_PROJECT_URL=	https://github.com/freeswitch/spandsp
COMPONENT_ARCHIVE_URL=	$(COMPONENT_PROJECT_URL)/archive/refs/heads/$(COMPONENT_ARCHIVE)
COMPONENT_CLASSIFICATION= System/Multimedia Libraries
COMPONENT_FMRI=		library/$(COMPONENT_NAME)
COMPONENT_LICENSE=	LPGPLv2.1
COMPONENT_LICENSE_FILE= COPYING

TEST_TARGET= $(NO_TESTS)

include $(WS_MAKE_RULES)/common.mk

COMPONENT_PRE_CONFIGURE_ACTION= ( \
	cd $(SOURCE_DIR); \
	$(GSED) -i -e '/^elif/d' autogen.sh; \
	$(GSED) -i -e '/^else/d' autogen.sh; \
	$(GSED) -i -e '/ libtoolize/d' autogen.sh; \
	$(GSED) -i -e '/ automake/d' autogen.sh; \
	$(GSED) -i -e '/ autoconf/d' autogen.sh; \
	./bootstrap.sh; \
	$(CLONEY) $(SOURCE_DIR) $(@D); \
	);

CONFIGURE_OPTIONS += --sysconfdir=/etc
CONFIGURE_OPTIONS += --localstatedir=/var
CONFIGURE_OPTIONS += --enable-static=no
ifeq ($(strip $(MACH)),i386)
CONFIGURE_OPTIONS += --enable-mmx
CONFIGURE_OPTIONS += --enable-sse
CONFIGURE_OPTIONS += --enable-sse2
CONFIGURE_OPTIONS += --enable-sse3
endif

CFLAGS += $(JPEG_CPPFLAGS) $(JPEG_CFLAGS)
CXXFLAGS += $(JPEG_CPPFLAGS) $(JPEG_CXXFLAGS)
LDFLAGS += $(JPEG_LDFLAGS)
CONFIGURE_ENV += CPPFLAGS="$(JPEG_CPPFLAGS)"

# Build dependencies
REQUIRED_PACKAGES += developer/build/libtool

# Auto-generated dependencies
REQUIRED_PACKAGES += $(JPEG_IMPLEM_PKG)
REQUIRED_PACKAGES += image/library/libtiff
REQUIRED_PACKAGES += system/library
REQUIRED_PACKAGES += system/library/math