#!/usr/bin/make -f
export DPKG_EXPORT_BUILDFLAGS := 1
include /usr/share/dpkg/default.mk
export DEB_BUILD_MAINT_OPTIONS := hardening=+all
export DEB_CFLAGS_MAINT_APPEND := -Wno-pedantic
export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed
export PHP_RPATH := no

%:
	dh $@

override_dh_auto_clean:
	rm -rf build-extension

override_dh_auto_configure:
	cp -a oauth-2.0.10 build-extension
	cd build-extension && /usr/bin/phpize8.4
	cd build-extension && ./configure --with-php-config=/usr/bin/php-config8.4 --enable-oauth --with-curl

override_dh_auto_build:
	dh_auto_build --sourcedirectory=build-extension

# The complete PHPT trees are exercised in the qualification guests.
override_dh_auto_test:

override_dh_auto_install:
	$(MAKE) -C build-extension install INSTALL_ROOT=$(CURDIR)/debian/php8.4-oauth
	install -Dm644 debian/oauth.ini debian/php8.4-oauth/etc/php/8.4/mods-available/oauth.ini
