#!/usr/bin/make -f

%:
	dh $@

override_dh_install:
	mkdir -p debian/tmp
	if [ -f debian/prebuilt/ghostty-$(shell dpkg-architecture -qDEB_HOST_ARCH).deb ]; then \
		dpkg-deb -x debian/prebuilt/ghostty-$(shell dpkg-architecture -qDEB_HOST_ARCH).deb debian/tmp && \
		test -d debian/tmp/usr/bin && \
		test -d debian/tmp/usr/share && \
		mkdir -p debian/ghostty/usr && \
		mv debian/tmp/usr/bin debian/ghostty/usr/ && \
		mv debian/tmp/usr/share debian/ghostty/usr/ ; \
	fi
	if [ -f debian/prebuilt/libghostty-dev-$(shell dpkg-architecture -qDEB_HOST_ARCH).deb ]; then \
		dpkg-deb -x debian/prebuilt/libghostty-dev-$(shell dpkg-architecture -qDEB_HOST_ARCH).deb debian/tmp && \
		test -d debian/tmp/usr/include && \
		mkdir -p debian/libghostty-dev/usr && \
		mv debian/tmp/usr/include debian/libghostty-dev/usr/ ; \
	fi
	rm -rf debian/tmp
