1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
Description: Modifications of Makefile to make symlinks
Some files from the nodejs framework are necessary to build jsxgraph
and its documentation. These modifications create and erase necessary
symlinks during the build and the clean processes.
Index: jsxgraph/Makefile
===================================================================
--- jsxgraph.orig/Makefile
+++ jsxgraph/Makefile
@@ -1,12 +1,12 @@
.PHONY: test docs core core-min prettier release lint eslint readers
# Build tools
-WEBPACK=./node_modules/.bin/webpack
-MINIFYER=./node_modules/terser/bin/terser
+WEBPACK=/usr/bin/webpack
+MINIFYER=/usr/bin/terser
# Code quality
LINT=./node_modules/.bin/jslint
-ESLINT=./node_modules/eslint/bin/eslint.js
+ESLINT=/usr/share/nodejs/eslint/bin/eslint.js
HINT=./node_modules/.bin/jshint
KARMA=node_modules/karma/bin/karma
PRETTIER=./node_modules/.bin/prettier
@@ -30,7 +30,7 @@ TMP=tmp
BUILDREADERS=tmpreaders
# API docs
-JSDOC2=node ./node_modules/.bin/jsdoc2
+JSDOC2=jsdoc2
JSDOC2PLG=doc/jsdoc-tk/plugins
JSDOC2PTCH=doc/jsdoc-tk/patches
JSDOC2TPL=doc/jsdoc-tk/template
@@ -65,7 +65,14 @@ PRETTIERFLAGS=-w --print-width 96 --tab-
READERSOUT=tmpreaders/geonext.min.js tmpreaders/geogebra.min.js tmpreaders/intergeo.min.js tmpreaders/sketch.min.js
# Rules
-all: core readers docs
+all: symlinks core readers docs
+
+symlinks:
+ # add symlinks to replace node_modules utilities
+ #################################################
+ # replace almond
+ $(MKDIR) $(MKDIRFLAGS) node_modules/almond
+ ln -s /usr/share/nodejs/almond/almond.js node_modules/almond/
core:
# Build uncompressed AND minified files
@@ -88,11 +95,11 @@ release: core docs
$(CP) $(OUTPUT)/jsxgraphcore.mjs $(TMP)/jsxgraphcore.mjs
$(CP) $(OUTPUT)/jsxgraphsrc.mjs $(TMP)/jsxgraphsrc.mjs
$(CP) $(OUTPUT)/jsxgraph.css $(TMP)/jsxgraph.css
- $(CP) $(OUTPUT)/docs.zip $(TMP)/docs.zip
+ $(CP) $(OUTPUT)/docs.tgz $(TMP)/docs.tgz
$(CP) src/index.d.ts $(TMP)/index.d.ts
$(CP) -r src/themes $(TMP)/themes
$(CP) README.md LICENSE.MIT LICENSE.LGPL $(TMP)/
- $(CD) $(TMP) && $(ZIP) $(ZIPFLAGS) jsxgraph.zip jsxgraph* themes/ index.d.ts docs.zip README.md LICENSE.*
+ $(CD) $(TMP) && $(ZIP) $(ZIPFLAGS) jsxgraph.zip jsxgraph* themes/ index.d.ts docs.tgz README.md LICENSE.*
$(CP) $(TMP)/jsxgraph.zip $(OUTPUT)/jsxgraph.zip
$(RM) $(RMFLAGS) $(TMP)
@@ -111,13 +118,15 @@ beta: docs
cat COPYRIGHT $(BETA)/jsxgraphcore.js >$(BETA)/tmp.file; mv $(BETA)/tmp.file $(BETA)/jsxgraphcore.js
cat COPYRIGHT $(BETA)/jsxgraphcore.mjs >$(BETA)/tmp.file; mv $(BETA)/tmp.file $(BETA)/jsxgraphcore.mjs
+SOURCE_DATE := $(shell dpkg-parsechangelog --show-field=Date)
+
docs: core
# Set up tmp dir
$(MKDIR) $(MKDIRFLAGS) $(TMP)
$(MKDIR) $(MKDIRFLAGS) $(OUTPUT)
# Update template related files
- $(CP) $(THIRDPARTY)/jquery.min.js $(JSDOC2TPLSTAT)/jquery.min.js
+ ln -sf /usr/share/javascript/jquery/jquery.min.js $(JSDOC2TPLSTAT)
$(CP) $(OUTPUT)/jsxgraphcore.js $(JSDOC2TPLSTAT)/jsxgraphcore.js
$(CP) $(OUTPUT)/jsxgraph.css $(JSDOC2TPLSTAT)/jsxgraph.css
@@ -125,6 +134,8 @@ docs: core
sed -i '2s/.*/<h1>JSXGraph $(VERSION) Reference<\/h1>/' doc/jsdoc-tk/template/static/header.html
# Patch run.js
+ mkdir -p ./node_modules/
+ cp -a /usr/share/nodejs/jsdoc2 ./node_modules
$(CP) $(JSDOC2PTCH)/*.js ./node_modules/jsdoc2/app
# Update the plugin
@@ -133,13 +144,15 @@ docs: core
# Run node-jsdoc2
$(JSDOC2) $(JSDOC2FLAGS) $(FILELIST)
- # Compress the result: zip -r tmp/docs.zip tmp/docs/
- $(CD) $(TMP) && $(ZIP) $(ZIPFLAGS) docs.zip docs/
- $(CP) $(TMP)/docs.zip $(OUTPUT)/docs.zip
+ # Compress the result: tar czf tmp/docs.tgz tmp/docs/
+ # with a reproducible timestamp
+ $(CD) $(TMP) && \
+ tar --clamp-mtime --mtime="$(SOURCE_DATE)" -czf docs.tgz docs/
+ $(CP) $(TMP)/docs.tgz $(OUTPUT)/docs.tgz
$(RM) $(RMFLAGS) tmp
# Test
- $(CD) $(OUTPUT) && $(UNZIP) -o docs.zip
+ #$(CD) $(OUTPUT) && $(UNZIP) -o docs.zip
# prettier:
# $(PRETTIER) $(PRETTIERFLAGS) src
@@ -170,6 +183,41 @@ lint:
eslint:
$(ESLINT) $(ESLINTFLAGS) $(LINTLIST)
-# test:
-test: core
- $(KARMA) start karma/karma.conf.js
+#test: core
+# $(KARMA) start karma/karma.conf.js
+
+clean:
+ for d in $$(ls node_modules/ | grep -v bin); do \
+ rm -rf node_modules/$$d; \
+ done
+ rm -f build/bin/jsxgraphcore.js
+ rm -f doc/jsdoc-tk/template/static/jquery.min.js
+ rm -rf distrib/docs/*
+ rm -f docs.tgz
+ rm -f jsxgraph_moodle.zip
+ rm -f JSXCompressor/jsxcompressor.min.js
+ rm -f JSXCompressor/jsxgraph.css
+ rm -f JSXCompressor/jsxgraphcore.js
+ rm -f build/bin/jsxcompressor.js
+ rm -f build/bin/jsxgraphcore-min.js
+ rm -f build/bin/jsxgraphcore.min.js
+ rm -f build/bin/readers/geogebra.min.js
+ rm -f build/bin/readers/geonext.min.js
+ rm -f build/bin/readers/intergeo.min.js
+ rm -f build/bin/readers/sketch.min.js
+ rm -f distrib/geogebra.min.js
+ rm -f distrib/geonext.min.js
+ rm -f distrib/intergeo.min.js
+ rm -f distrib/jsxgraphcore.js
+ rm -f distrib/sketch.min.js
+ rm -f doc/jsdoc-tk/template/static/jsxgraph.css
+ rm -f doc/jsdoc-tk/template/static/jsxgraphcore.js
+ rm -f JSXCompressor/jsxcompressor.min.js
+ rm -f JSXCompressor/jsxgraphcore.js
+ rm -rf distrib/docs/
+ rm -rf distrib/geogebra.min.js
+ rm -rf distrib/geonext.min.js
+ rm -rf distrib/intergeo.min.js
+ rm -rf distrib/jsxgraphcore.js
+ rm -rf distrib/sketch.min.js
+ rm -rf distrib/docs.tgz
|