#!/usr/bin/make -f
export REPORT_EXIT_STATUS:=0
include /usr/share/dh-php/pkg-pecl.mk

ifeq ($(shell curl-config --checkfor 7.56.0;echo $$?),0)
export SWOOLE_CURL:=--enable-swoole-curl
else
export SWOOLE_CURL:=
endif

PECL_CONFIGURE_MAINT_APPEND = \
	--enable-swoole \
	--enable-sockets \
	--disable-brotli \
	--enable-cares \
	--enable-openssl \
	--enable-http2 \
	--enable-mysqlnd \
	$(SWOOLE_CURL) \
	--enable-swoole-pgsql \
	--enable-swoole-odbc=unixodbc \
	--enable-swoole-sqlite \
	--enable-zstd

# Added by ubuntu-dbgsym-deb when this source package was made for an Ubuntu
# release; it is not in the packaging repository. Ubuntu's debhelper names
# debug packages NAME-dbgsym_VERSION_ARCH.ddeb, and the archive these builds
# are published from takes only .deb files. Rename them once they are built
# and correct debian/files, from which the .changes file is written.
.PHONY: execute_after_dh_builddeb-arch dbgsym-ddeb-to-deb
execute_after_dh_builddeb-arch: dbgsym-ddeb-to-deb
dbgsym-ddeb-to-deb:
	@for f in $$(sed -n 's/^\([^ ]*\)\.ddeb .*/\1/p' debian/files 2>/dev/null); do \
		if mv "../$$f.ddeb" "../$$f.deb"; then \
			sed -i "s/^$$f\.ddeb /$$f.deb /" debian/files; \
			echo "dbgsym-ddeb-to-deb: renamed $$f.ddeb to $$f.deb"; \
		fi; \
	done
