#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DH_VERBOSE = 1
export NODE_OPTIONS=--max-old-space-size=6042
export TOOL_NODE_FLAGS=--max-old-space-size=8199
export YARN_CHECKSUM_BEHAVIOR=ignore
export PATH := $(PATH):/usr/local/bin

%:
	dh $@

override_dh_auto_build:
	test -x /usr/local/bin/meteor || curl https://install.meteor.com/ | sh
	~/.meteor/meteor npm install -g yarn
	~/.meteor/meteor yarn cache clean
	~/.meteor/meteor yarn install
	~/.meteor/meteor yarn run build
	cd apps/meteor && ~/.meteor/meteor build --server-only --directory ../../../meteor-build-output
	(\
	cd ../meteor-build-output/bundle/programs/server &&\
	~/.meteor/meteor npm --no-save -no-cache install \
	)

override_dh_auto_clean:
	dh_auto_clean
	rm -rf .meteor/local
	rm -rf ../meteor-build-output/.bundle-garbage-*
	rm -rf ../rocketchat-*obsolete*

override_dh_shlibdeps:

override_dh_strip:

override_dh_strip_nondeterminism:

