xmpp.chapril.org-conversejs/Makefile

241 lines
8.8 KiB
Makefile
Raw Normal View History

2013-04-26 21:01:39 +02:00
# You can set these variables from the command line.
2017-07-10 15:54:05 +02:00
UGLIFYJS ?= node_modules/.bin/uglifyjs
BABEL ?= node_modules/.bin/babel
BOURBON = ./node_modules/bourbon/app/assets/stylesheets/
BOOTSTRAP = ./node_modules/
2017-06-13 12:22:02 +02:00
BUILDDIR = ./docs
BUNDLE ?= ./.bundle/bin/bundle
CHROMIUM ?= ./node_modules/.bin/run-headless-chromium
CLEANCSS ?= ./node_modules/clean-css-cli/bin/cleancss --skip-rebase
ESLINT ?= ./node_modules/.bin/eslint
2017-06-13 12:22:02 +02:00
HTTPSERVE ?= ./node_modules/.bin/http-server
HTTPSERVE_PORT ?= 8000
2018-03-30 13:30:50 +02:00
INKSCAPE ?= inkscape
2017-06-13 12:22:02 +02:00
PAPER =
PO2JSON ?= ./node_modules/.bin/po2json
RJS ?= ./node_modules/.bin/r.js
2017-06-13 12:22:02 +02:00
SASS ?= ./.bundle/bin/sass
SPHINXBUILD ?= ./bin/sphinx-build
2017-07-12 22:51:56 +02:00
SED ?= sed
2017-06-13 12:22:02 +02:00
SPHINXOPTS =
2018-03-30 13:30:50 +02:00
OXIPNG ?= oxipng
2017-12-05 18:35:01 +01:00
# In the case user wishes to use RVM
USE_RVM ?= false
RVM_RUBY_VERSION ?= 2.4.2
ifeq ($(USE_RVM),true)
RVM_USE = rvm use $(RVM_RUBY_VERSION)
endif
2013-04-26 21:01:39 +02:00
# Internal variables.
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source
.PHONY: all
all: dev dist
.PHONY: help
2013-04-26 21:01:39 +02:00
help:
@echo "Please use \`make <target>' where <target> is one of the following:"
@echo ""
@echo " all A synonym for 'make dev'."
@echo " build Create minified builds of converse.js and all its dependencies."
2018-03-06 11:26:47 +01:00
@echo " clean Remove all NPM and Ruby packages."
@echo " css Generate CSS from the Sass files."
@echo " dev Set up the development environment. To force a fresh start, run 'make clean' first."
@echo " html Make standalone HTML files of the documentation."
@echo " po Generate gettext PO files for each i18n language."
@echo " po2json Generate JSON files from the language PO files."
@echo " pot Generate a gettext POT file to be used for translations."
@echo " release Prepare a new release of converse.js. E.g. make release VERSION=0.9.5"
@echo " serve Serve this directory via a webserver on port 8000."
2018-03-30 12:57:51 +02:00
@echo " stamp-npm Install NPM dependencies"
@echo " stamp-bundler Install Bundler (Ruby) dependencies"
@echo " watch Tells Sass to watch the .scss files for changes and then automatically update the CSS files."
2018-03-30 13:30:50 +02:00
@echo " logo Generate PNG logos of multiple sizes."
########################################################################
## Miscellaneous
.PHONY: serve
2017-06-13 12:22:02 +02:00
serve: dev
$(HTTPSERVE) -p $(HTTPSERVE_PORT) -c-1
2017-06-13 12:22:02 +02:00
.PHONY: serve_bg
serve_bg: dev
$(HTTPSERVE) -p $(HTTPSERVE_PORT) -c-1 -s &
########################################################################
## Translation machinery
2018-03-05 14:43:53 +01:00
GETTEXT = xgettext --language="JavaScript" --keyword=__ --keyword=___ --from-code=UTF-8 --output=locale/converse.pot dist/converse-no-dependencies.js --package-name=Converse.js --copyright-holder="Jan-Carel Brand" --package-version=3.3.4 -c
.PHONY: pot
pot: dist/converse-no-dependencies.js
$(GETTEXT) 2>&1 > /dev/null; exit $$?;
2013-04-26 21:01:39 +02:00
.PHONY: po
po:
find ./locale -maxdepth 1 -mindepth 1 -type d -exec msgmerge {}/LC_MESSAGES/converse.po ./locale/converse.pot -U \;
.PHONY: po2json
2013-09-15 22:16:16 +02:00
po2json:
2018-01-05 12:47:50 +01:00
find ./locale -maxdepth 1 -mindepth 1 -type d -exec $(PO2JSON) -f jed1.x -d converse {}/LC_MESSAGES/converse.po {}/LC_MESSAGES/converse.json \;
2013-09-15 22:16:16 +02:00
########################################################################
## Release management
.PHONY: release
release:
2017-07-22 22:18:55 +02:00
$(SED) -ri s/Version:\ [0-9]\+\.[0-9]\+\.[0-9]\+/Version:\ $(VERSION)/ COPYRIGHT
2017-07-12 22:51:56 +02:00
$(SED) -ri s/Version:\ [0-9]\+\.[0-9]\+\.[0-9]\+/Version:\ $(VERSION)/ src/start.frag
$(SED) -ri s/Project-Id-Version:\ Converse\.js\ [0-9]\+\.[0-9]\+\.[0-9]\+/Project-Id-Version:\ Converse.js\ $(VERSION)/ locale/converse.pot
$(SED) -ri s/\"version\":\ \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/\"version\":\ \"$(VERSION)\"/ package.json
$(SED) -ri s/--package-version=[0-9]\+\.[0-9]\+\.[0-9]\+/--package-version=$(VERSION)/ Makefile
$(SED) -ri s/v[0-9]\+\.[0-9]\+\.[0-9]\+\.zip/v$(VERSION)\.zip/ index.html
$(SED) -ri s/v[0-9]\+\.[0-9]\+\.[0-9]\+\.tar\.gz/v$(VERSION)\.tar\.gz/ index.html
$(SED) -ri s/version\ =\ \'[0-9]\+\.[0-9]\+\.[0-9]\+\'/version\ =\ \'$(VERSION)\'/ docs/source/conf.py
$(SED) -ri s/release\ =\ \'[0-9]\+\.[0-9]\+\.[0-9]\+\'/release\ =\ \'$(VERSION)\'/ docs/source/conf.py
$(SED) -ri "s/(Unreleased)/`date +%Y-%m-%d`/" CHANGES.md
$(SED) -ri "s/cdn.conversejs.org\/[0-9]+\.[0-9]+\.[0-9]+/cdn.conversejs.org\/$(VERSION)/" docs/source/quickstart.rst
2014-08-25 14:39:32 +02:00
make pot
make po
make po2json
2014-08-04 23:09:14 +02:00
make build
########################################################################
## Install dependencies
2018-03-17 19:54:01 +01:00
stamp-npm: package.json package-lock.json
2018-03-06 11:26:47 +01:00
npm install
2018-03-17 19:54:01 +01:00
touch stamp-npm
stamp-bundler: Gemfile
mkdir -p .bundle
2017-12-05 18:35:01 +01:00
$(RVM_USE)
gem install --user bundler --bindir .bundle/bin
$(BUNDLE) install --path .bundle --binstubs .bundle/bin
touch stamp-bundler
.PHONY: clean
clean:
2018-03-25 21:21:43 +02:00
rm -rf node_modules .bundle stamp-npm
2018-03-06 11:26:47 +01:00
rm dist/*.min.js
rm css/theme.min.css
rm css/converse.min.css
rm css/*.map
2013-04-26 21:01:39 +02:00
.PHONY: dev
dev: stamp-bundler stamp-npm
2014-05-07 22:36:45 +02:00
########################################################################
## Builds
.PHONY: css
css: dev sass/*.scss css/converse.css css/converse.min.css css/theme.min.css css/inverse.css css/inverse.min.css
2017-06-13 21:07:42 +02:00
css/inverse.css:: dev sass sass
$(SASS) -I $(BOURBON) -I $(BOOTSTRAP) sass/inverse/inverse.scss css/inverse.css
2017-06-13 21:07:42 +02:00
css/converse.css:: dev sass
$(SASS) -I $(BOURBON) -I $(BOOTSTRAP) sass/converse/converse.scss css/converse.css
2018-03-06 11:26:47 +01:00
css/%.min.css:: css/%.css
make dev
$(CLEANCSS) $< > $@
.PHONY: watch
watch: dev
$(SASS) --watch -I $(BOURBON) -I $(BOOTSTRAP) sass/converse/converse.scss:css/converse.css sass/inverse/inverse.scss:css/inverse.css
.PHONY: watchjs
watchjs: dev
$(BABEL) --source-maps --watch=./src --out-dir=./builds
transpile: dev src
2017-11-17 11:02:55 +01:00
$(BABEL) --source-maps --out-dir=./builds ./src
$(BABEL) --source-maps --out-dir=./builds ./node_modules/backbone.vdomview/backbone.vdomview.js
touch transpile
2018-03-30 13:30:50 +02:00
.PHONY: logo
logo: logo/conversejs-transparent16.png \
logo/conversejs-transparent19.png \
logo/conversejs-transparent48.png \
logo/conversejs-transparent128.png \
logo/conversejs-transparent512.png \
logo/conversejs-filled16.png \
logo/conversejs-filled19.png \
logo/conversejs-filled48.png \
logo/conversejs-filled128.png \
logo/conversejs-filled512.png \
logo/conversejs-transparent%.png:: logo/conversejs-transparent.svg
$(INKSCAPE) -e $@ -w $* $<
$(OXIPNG) $@
logo/conversejs-filled%.png:: logo/conversejs-filled.svg
$(INKSCAPE) -e $@ -w $* $<
$(OXIPNG) $@
BUILDS = dist/converse.js \
dist/converse.min.js \
dist/converse-headless.js \
dist/converse-headless.min.js \
2017-07-10 15:54:05 +02:00
dist/converse-muc-embedded.js \
dist/converse-muc-embedded.min.js \
dist/converse-no-dependencies.min.js \
dist/converse-no-dependencies.js
# dist/converse-esnext.js \
# dist/converse-esnext.min.js \
2018-03-17 19:54:01 +01:00
dist/converse.js: transpile src stamp-npm
$(RJS) -o src/build.js include=converse out=dist/converse.js optimize=none
2018-03-17 19:54:01 +01:00
dist/converse.min.js: transpile src stamp-npm
2017-08-09 18:43:05 +02:00
$(RJS) -o src/build.js include=converse out=dist/converse.min.js
2018-03-17 19:54:01 +01:00
dist/converse-headless.js: transpile src stamp-npm
$(RJS) -o src/build.js paths.converse=src/headless include=converse out=dist/converse-headless.js optimize=none
2018-03-17 19:54:01 +01:00
dist/converse-headless.min.js: transpile src stamp-npm
$(RJS) -o src/build.js paths.converse=src/headless include=converse out=dist/converse-headless.min.js
2018-03-17 19:54:01 +01:00
dist/converse-esnext.js: src stamp-npm
$(RJS) -o src/build-esnext.js include=converse out=dist/converse-esnext.js optimize=none
2018-03-17 19:54:01 +01:00
dist/converse-esnext.min.js: src stamp-npm
2017-08-09 18:43:05 +02:00
$(RJS) -o src/build-esnext.js include=converse out=dist/converse-esnext.min.js
2018-03-17 19:54:01 +01:00
dist/converse-no-dependencies.js: transpile src stamp-npm
$(RJS) -o src/build-no-dependencies.js optimize=none out=dist/converse-no-dependencies.js
2018-03-17 19:54:01 +01:00
dist/converse-no-dependencies.min.js: transpile src stamp-npm
2017-08-09 18:43:05 +02:00
$(RJS) -o src/build-no-dependencies.js out=dist/converse-no-dependencies.min.js
2018-03-17 19:54:01 +01:00
dist/converse-muc-embedded.js: transpile src stamp-npm
$(RJS) -o src/build.js paths.converse=src/converse-embedded include=converse out=dist/converse-muc-embedded.js optimize=none
2018-03-17 19:54:01 +01:00
dist/converse-muc-embedded.min.js: transpile src stamp-npm
2017-08-09 18:43:05 +02:00
$(RJS) -o src/build.js paths.converse=src/converse-embedded include=converse out=dist/converse-muc-embedded.min.js
.PHONY: dist
dist:: build
.PHONY: build
build:: dev css transpile $(BUILDS)
2014-08-04 22:37:35 +02:00
########################################################################
## Tests
.PHONY: eslint
2018-03-17 19:54:01 +01:00
eslint: stamp-npm
$(ESLINT) src/
$(ESLINT) spec/
2016-05-23 21:21:42 +02:00
.PHONY: check
2017-04-05 11:01:31 +02:00
check: eslint
2018-02-07 13:26:39 +01:00
LOG_CR_VERBOSITY=INFO $(CHROMIUM) --no-sandbox http://localhost:$(HTTPSERVE_PORT)/tests/index.html
########################################################################
## Documentation
.PHONY: html
2013-04-26 21:01:39 +02:00
html:
rm -rf $(BUILDDIR)/html
2013-04-26 21:01:39 +02:00
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."