APP=gnusocial
ARCH_TYPE='all'
GNUSOCIAL_VERSION?=3.0.0dev
DESTDIR?=${PWD}/debian/${APP}

# all:
# debug:
# sync:
# 	./upstream-to-debian.sh

source:
	cd ../.. && tar cvf dist/${APP}_${GNUSOCIAL_VERSION}.orig.tar --transform "s,^,${APP}-${GNUSOCIAL_VERSION}/," bin src config extlib public vendor plugins components templates social.yaml translations
	gzip -f9n ../${APP}_${GNUSOCIAL_VERSION}.orig.tar

install:
	mkdir -m 755 -p ${DESTDIR}/var/www/${APP}
	cp -r * ${DESTDIR}/var/www/${APP}

uninstall:
	rm -rf ${DESTDIR}/var/www/${APP}
	if [ -L /etc/nginx/vhosts/${APP} -or -f /etc/nginx/vhosts/${APP} ]; then
		rm -f /etc/nginx/vhosts/${APP};
	fi
	if [ -d /etc/apache2 ]; then
		a2dissite ${APP};
		rm /etc/apache2/sites-available/${APP};
	fi
	if [ -d /var/www/${APP} ]; then
		rm -r /var/www/${APP};
	fi

clean:
	rm -rf tmp/ src/ pkg/

clean-source:
	rm -rf ../${APP}_${GNUSOCIAL_VERSION}.orig.tar ../${APP}_${GNUSOCIAL_VERSION}.orig.tar.gz
