Fossil SCM

Added optional build infrastructure for using emcc so that we have a reproducible pikchr.wasm instead of an opaque 3rd-party blob. This adds the --with-emsdk configure flag.

stephan 2022-06-07 18:05 pikchrshow-wasm
Commit 8f6886c90516d4f6a85242c86be737aaafc1f3dcff4a26422d83dfacee3c2ba9
+11
--- Makefile.in
+++ Makefile.in
@@ -72,10 +72,21 @@
7272
USE_SEE = @USE_SEE@
7373
APPNAME = fossil
7474
#
7575
# APPNAME = fossil-fuzz
7676
# may be more appropriate for fuzzing.
77
+
78
+#### Emscripten stuff for optionally doing in-tree builds
79
+# of any WASM components. We store precompiled WASM in the the SCM, so
80
+# this is only useful for people who actively work on WASM
81
+# components. EMSDK_ENV refers to the "environment" script which comes
82
+# with the Emscripten SDK package:
83
+# https://emscripten.org/docs/getting_started/downloads.html
84
+EMSDK_HOME = @EMSDK_HOME@
85
+EMSDK_ENV = @EMSDK_ENV@
86
+EMCC_OPT = @EMCC_OPT@
87
+EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh
7788
7889
.PHONY: all tags
7990
8091
include $(SRCDIR)/main.mk
8192
8293
--- Makefile.in
+++ Makefile.in
@@ -72,10 +72,21 @@
72 USE_SEE = @USE_SEE@
73 APPNAME = fossil
74 #
75 # APPNAME = fossil-fuzz
76 # may be more appropriate for fuzzing.
 
 
 
 
 
 
 
 
 
 
 
77
78 .PHONY: all tags
79
80 include $(SRCDIR)/main.mk
81
82
--- Makefile.in
+++ Makefile.in
@@ -72,10 +72,21 @@
72 USE_SEE = @USE_SEE@
73 APPNAME = fossil
74 #
75 # APPNAME = fossil-fuzz
76 # may be more appropriate for fuzzing.
77
78 #### Emscripten stuff for optionally doing in-tree builds
79 # of any WASM components. We store precompiled WASM in the the SCM, so
80 # this is only useful for people who actively work on WASM
81 # components. EMSDK_ENV refers to the "environment" script which comes
82 # with the Emscripten SDK package:
83 # https://emscripten.org/docs/getting_started/downloads.html
84 EMSDK_HOME = @EMSDK_HOME@
85 EMSDK_ENV = @EMSDK_ENV@
86 EMCC_OPT = @EMCC_OPT@
87 EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh
88
89 .PHONY: all tags
90
91 include $(SRCDIR)/main.mk
92
93
+36
--- auto.def
+++ auto.def
@@ -28,10 +28,11 @@
2828
static=0 => {Link a static executable}
2929
fusefs=1 => {Disable the Fuse Filesystem}
3030
fossil-debug=0 => {Build with fossil debugging enabled}
3131
no-opt=0 => {Build without optimization}
3232
json=0 => {Build with fossil JSON API enabled}
33
+ with-emsdk:path => {Directory containing the Emscripten SDK}
3334
}
3435
3536
# Update the minimum required SQLite version number here, and also
3637
# in src/main.c near the sqlite3_libversion_number() call. Take care
3738
# that both places agree!
@@ -632,10 +633,37 @@
632633
set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \
633634
$tclconfig(TCL_LD_FLAGS)]
634635
define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
635636
define FOSSIL_ENABLE_TCL
636637
}
638
+
639
+# Emscripten is a purely optional component used only for doing
640
+# in-tree builds of WASM stuff, as opposed to WASM binaries we import
641
+# from other places. This is only set up for Unix-style OSes and is
642
+# untested anywhere but Linux.
643
+set emsdkHome [opt-val with-emsdk]
644
+define EMSDK_HOME ""
645
+define EMSDK_ENV ""
646
+define EMCC_OPT "-Oz"
647
+if {$emsdkHome eq "" && [info exists ::env(EMSDK)]} {
648
+ # Fall back to checking the environment. $EMSDK gets set
649
+ # by sourcing emsdk_env.sh.
650
+ set emsdkHome $::env(EMSDK)
651
+}
652
+if {$emsdkHome ne ""} {
653
+ define EMSDK_HOME $emsdkHome
654
+ set emsdkEnv "$emsdkHome/emsdk_env.sh"
655
+ if {[file exists $emsdkEnv]} {
656
+ puts "Using Emscripten SDK environment from $emsdkEnv."
657
+ define EMSDK_ENV $emsdkEnv
658
+ if {[info exists ::env(EMCC_OPT)]} {
659
+ define EMCC_OPT $::env(EMCC_OPT)
660
+ }
661
+ } else {
662
+ puts "emsdk_env.sh not found. Assuming emcc is in the PATH."
663
+ }
664
+}
637665
638666
# Network functions require libraries on some systems
639667
cc-check-function-in-lib gethostbyname nsl
640668
if {![cc-check-function-in-lib socket {socket network}]} {
641669
# Last resort, may be Windows
@@ -726,8 +754,16 @@
726754
# Linux can only infer the dependency on pthread from OpenSSL when
727755
# doing dynamic linkage.
728756
define-append LIBS -lpthread
729757
}
730758
759
+if {[get-define EMSDK_ENV] ne ""} {
760
+ define EMCC_WRAPPER $::autosetup(dir)/../tools/emcc.sh
761
+ make-template tools/emcc.sh.in
762
+ catch {exec chmod u+x tools/emcc.sh}
763
+} else {
764
+ define EMCC_WRAPPER ""
765
+ catch {exec rm -f tools/emcc.sh}
766
+}
731767
732768
make-template Makefile.in
733769
make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
734770
735771
DELETED extsrc/pikchr-module.js
--- auto.def
+++ auto.def
@@ -28,10 +28,11 @@
28 static=0 => {Link a static executable}
29 fusefs=1 => {Disable the Fuse Filesystem}
30 fossil-debug=0 => {Build with fossil debugging enabled}
31 no-opt=0 => {Build without optimization}
32 json=0 => {Build with fossil JSON API enabled}
 
33 }
34
35 # Update the minimum required SQLite version number here, and also
36 # in src/main.c near the sqlite3_libversion_number() call. Take care
37 # that both places agree!
@@ -632,10 +633,37 @@
632 set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \
633 $tclconfig(TCL_LD_FLAGS)]
634 define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
635 define FOSSIL_ENABLE_TCL
636 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
638 # Network functions require libraries on some systems
639 cc-check-function-in-lib gethostbyname nsl
640 if {![cc-check-function-in-lib socket {socket network}]} {
641 # Last resort, may be Windows
@@ -726,8 +754,16 @@
726 # Linux can only infer the dependency on pthread from OpenSSL when
727 # doing dynamic linkage.
728 define-append LIBS -lpthread
729 }
730
 
 
 
 
 
 
 
 
731
732 make-template Makefile.in
733 make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
734
735 ELETED extsrc/pikchr-module.js
--- auto.def
+++ auto.def
@@ -28,10 +28,11 @@
28 static=0 => {Link a static executable}
29 fusefs=1 => {Disable the Fuse Filesystem}
30 fossil-debug=0 => {Build with fossil debugging enabled}
31 no-opt=0 => {Build without optimization}
32 json=0 => {Build with fossil JSON API enabled}
33 with-emsdk:path => {Directory containing the Emscripten SDK}
34 }
35
36 # Update the minimum required SQLite version number here, and also
37 # in src/main.c near the sqlite3_libversion_number() call. Take care
38 # that both places agree!
@@ -632,10 +633,37 @@
633 set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \
634 $tclconfig(TCL_LD_FLAGS)]
635 define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
636 define FOSSIL_ENABLE_TCL
637 }
638
639 # Emscripten is a purely optional component used only for doing
640 # in-tree builds of WASM stuff, as opposed to WASM binaries we import
641 # from other places. This is only set up for Unix-style OSes and is
642 # untested anywhere but Linux.
643 set emsdkHome [opt-val with-emsdk]
644 define EMSDK_HOME ""
645 define EMSDK_ENV ""
646 define EMCC_OPT "-Oz"
647 if {$emsdkHome eq "" && [info exists ::env(EMSDK)]} {
648 # Fall back to checking the environment. $EMSDK gets set
649 # by sourcing emsdk_env.sh.
650 set emsdkHome $::env(EMSDK)
651 }
652 if {$emsdkHome ne ""} {
653 define EMSDK_HOME $emsdkHome
654 set emsdkEnv "$emsdkHome/emsdk_env.sh"
655 if {[file exists $emsdkEnv]} {
656 puts "Using Emscripten SDK environment from $emsdkEnv."
657 define EMSDK_ENV $emsdkEnv
658 if {[info exists ::env(EMCC_OPT)]} {
659 define EMCC_OPT $::env(EMCC_OPT)
660 }
661 } else {
662 puts "emsdk_env.sh not found. Assuming emcc is in the PATH."
663 }
664 }
665
666 # Network functions require libraries on some systems
667 cc-check-function-in-lib gethostbyname nsl
668 if {![cc-check-function-in-lib socket {socket network}]} {
669 # Last resort, may be Windows
@@ -726,8 +754,16 @@
754 # Linux can only infer the dependency on pthread from OpenSSL when
755 # doing dynamic linkage.
756 define-append LIBS -lpthread
757 }
758
759 if {[get-define EMSDK_ENV] ne ""} {
760 define EMCC_WRAPPER $::autosetup(dir)/../tools/emcc.sh
761 make-template tools/emcc.sh.in
762 catch {exec chmod u+x tools/emcc.sh}
763 } else {
764 define EMCC_WRAPPER ""
765 catch {exec rm -f tools/emcc.sh}
766 }
767
768 make-template Makefile.in
769 make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
770
771 ELETED extsrc/pikchr-module.js
D extsrc/pikchr-module.js
-44
--- a/extsrc/pikchr-module.js
+++ b/extsrc/pikchr-module.js
@@ -1,44 +0,0 @@
1
-) {
2
- r initPikchrModuDi
3
-var initPikchrMod || {};e["ready"] = new Promise(fhis by
4
-// setting the ENVIRONMENT// setting the ENVIRONMENT settingow) => {
5
- throw toT(resolve, reject) =>e present at the end iffunction(resolve, reject) end if `scriptDirectory` is lice"";
6
-
7
-function locateFile(path) {
8
- if (Module["locaeFile"]) {
9
- retut they can
10
-// refer to Module (if they choose; th// Sometimes an exivartory` is lice"";
11
-
12
-fnse = awaitirectory + path;
13
-}
14
-
15
-
16
-
17
-/aitirectory + path;
18
-}
19
-
20
-
21
-
22
-// Ho);nt runtime environments.}
23
-var initPikchrModule = (() => {
24
- vchrModule var initPikchrModule =, setWindowTitle;
25
-ed in the code, and you
26
-//d in the code, and yORKER) {
27
-iseResvar readomiseResolve = resolveft());
28
- }
29
- }
30
- // = reject;
31
-});
32
-
33
-// Determine nvironment we are in}
34
- if (_scriptDir) {
35
-iseResvar readyPromi_scriptDir;
36
- }
37
-Throw) => {
38
- throw tindexOf("blob:") !== 0) {
39
-iseResvar readyPromiscriptDirectory.substr(0, ) => {
40
- thrvar runtimeKeepavar buffer,aliveCounter = 0 || runtimeKeepaliveCounter > 0binaryFilevar initPikchrModuDir = typGlobalBufferAn ENVIRONME.src : undefined;
41
- nresponse =>b() =>var function(str)function(arr)function(type) {
42
- r()())PikchrMod || {};e["read) {
43
- r initPikchrModuDi
44
-v
--- a/extsrc/pikchr-module.js
+++ b/extsrc/pikchr-module.js
@@ -1,44 +0,0 @@
1 ) {
2 r initPikchrModuDi
3 var initPikchrMod || {};e["ready"] = new Promise(fhis by
4 // setting the ENVIRONMENT// setting the ENVIRONMENT settingow) => {
5 throw toT(resolve, reject) =>e present at the end iffunction(resolve, reject) end if `scriptDirectory` is lice"";
6
7 function locateFile(path) {
8 if (Module["locaeFile"]) {
9 retut they can
10 // refer to Module (if they choose; th// Sometimes an exivartory` is lice"";
11
12 fnse = awaitirectory + path;
13 }
14
15
16
17 /aitirectory + path;
18 }
19
20
21
22 // Ho);nt runtime environments.}
23 var initPikchrModule = (() => {
24 vchrModule var initPikchrModule =, setWindowTitle;
25 ed in the code, and you
26 //d in the code, and yORKER) {
27 iseResvar readomiseResolve = resolveft());
28 }
29 }
30 // = reject;
31 });
32
33 // Determine nvironment we are in}
34 if (_scriptDir) {
35 iseResvar readyPromi_scriptDir;
36 }
37 Throw) => {
38 throw tindexOf("blob:") !== 0) {
39 iseResvar readyPromiscriptDirectory.substr(0, ) => {
40 thrvar runtimeKeepavar buffer,aliveCounter = 0 || runtimeKeepaliveCounter > 0binaryFilevar initPikchrModuDir = typGlobalBufferAn ENVIRONME.src : undefined;
41 nresponse =>b() =>var function(str)function(arr)function(type) {
42 r()())PikchrMod || {};e["read) {
43 r initPikchrModuDi
44 v
--- a/extsrc/pikchr-module.js
+++ b/extsrc/pikchr-module.js
@@ -1,44 +0,0 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- extsrc/pikchr-worker.js
+++ extsrc/pikchr-worker.js
@@ -206,13 +206,13 @@
206206
data:{step: ++f.last.step, text: text||null}
207207
});
208208
}
209209
};
210210
211
- importScripts('pikchr-module.js');
211
+ importScripts('pikchr.js');
212212
/**
213
- initPikchrModule() is installed via pikchr-module.js due to
213
+ initPikchrModule() is installed via pikchr.js due to
214214
building with:
215215
216216
emcc ... -sMODULARIZE=1 -sEXPORT_NAME=initPikchrModule
217217
*/
218218
initPikchrModule(pikchrModule).then(function(thisModule){
219219
220220
ADDED extsrc/pikchr.js
--- extsrc/pikchr-worker.js
+++ extsrc/pikchr-worker.js
@@ -206,13 +206,13 @@
206 data:{step: ++f.last.step, text: text||null}
207 });
208 }
209 };
210
211 importScripts('pikchr-module.js');
212 /**
213 initPikchrModule() is installed via pikchr-module.js due to
214 building with:
215
216 emcc ... -sMODULARIZE=1 -sEXPORT_NAME=initPikchrModule
217 */
218 initPikchrModule(pikchrModule).then(function(thisModule){
219
220 DDED extsrc/pikchr.js
--- extsrc/pikchr-worker.js
+++ extsrc/pikchr-worker.js
@@ -206,13 +206,13 @@
206 data:{step: ++f.last.step, text: text||null}
207 });
208 }
209 };
210
211 importScripts('pikchr.js');
212 /**
213 initPikchrModule() is installed via pikchr.js due to
214 building with:
215
216 emcc ... -sMODULARIZE=1 -sEXPORT_NAME=initPikchrModule
217 */
218 initPikchrModule(pikchrModule).then(function(thisModule){
219
220 DDED extsrc/pikchr.js

No diff available

--- src/fossil.page.pikchrshowasm.js
+++ src/fossil.page.pikchrshowasm.js
@@ -336,12 +336,12 @@
336336
}
337337
let vw = null, vh = null;
338338
if('svg'===mode && !this.config.renderAutofit && !m.isError){
339339
vw = m.width; vh = m.height;
340340
}
341
- this.e.pikOut.style.width = vw ? vw+'px' : null;
342
- this.e.pikOut.style.height = vh ? vh+'px' : null;
341
+ this.e.pikOut.style.width = vw && vw+'px';
342
+ this.e.pikOut.style.height = vh && vh+'px';
343343
}.bind(PS))/*'pikchr' msg handler*/;
344344
345345
E('#btn-render-mode').addEventListener('click',function(){
346346
const modes = this.renderModes;
347347
modes.selectedIndex = (modes.selectedIndex + 1) % modes.length;
348348
--- src/fossil.page.pikchrshowasm.js
+++ src/fossil.page.pikchrshowasm.js
@@ -336,12 +336,12 @@
336 }
337 let vw = null, vh = null;
338 if('svg'===mode && !this.config.renderAutofit && !m.isError){
339 vw = m.width; vh = m.height;
340 }
341 this.e.pikOut.style.width = vw ? vw+'px' : null;
342 this.e.pikOut.style.height = vh ? vh+'px' : null;
343 }.bind(PS))/*'pikchr' msg handler*/;
344
345 E('#btn-render-mode').addEventListener('click',function(){
346 const modes = this.renderModes;
347 modes.selectedIndex = (modes.selectedIndex + 1) % modes.length;
348
--- src/fossil.page.pikchrshowasm.js
+++ src/fossil.page.pikchrshowasm.js
@@ -336,12 +336,12 @@
336 }
337 let vw = null, vh = null;
338 if('svg'===mode && !this.config.renderAutofit && !m.isError){
339 vw = m.width; vh = m.height;
340 }
341 this.e.pikOut.style.width = vw && vw+'px';
342 this.e.pikOut.style.height = vh && vh+'px';
343 }.bind(PS))/*'pikchr' msg handler*/;
344
345 E('#btn-render-mode').addEventListener('click',function(){
346 const modes = this.renderModes;
347 modes.selectedIndex = (modes.selectedIndex + 1) % modes.length;
348
+6 -1
--- src/main.mk
+++ src/main.mk
@@ -163,12 +163,12 @@
163163
$(SRCDIR)/xfer.c \
164164
$(SRCDIR)/xfersetup.c \
165165
$(SRCDIR)/zip.c
166166
167167
EXTRA_FILES = \
168
- $(SRCDIR)/../extsrc/pikchr-module.js \
169168
$(SRCDIR)/../extsrc/pikchr-worker.js \
169
+ $(SRCDIR)/../extsrc/pikchr.js \
170170
$(SRCDIR)/../extsrc/pikchr.wasm \
171171
$(SRCDIR)/../skins/ardoise/css.txt \
172172
$(SRCDIR)/../skins/ardoise/details.txt \
173173
$(SRCDIR)/../skins/ardoise/footer.txt \
174174
$(SRCDIR)/../skins/ardoise/header.txt \
@@ -2113,13 +2113,18 @@
21132113
$(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
21142114
$(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
21152115
21162116
$(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
21172117
$(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
2118
+
2119
+$(SRCDIR_extsrc)/pikchr.js: $(SRCDIR_extsrc)/pikchr.c
2120
+ $(EMCC_WRAPPER) -o $@ $(EMCC_OPT) --no-entry -sEXPORTED_RUNTIME_METHODS=cwrap,setValue,getValue,stackSave,stackRestore -sEXPORTED_FUNCTIONS=_pikchr $(SRCDIR_extsrc)/pikchr.c -sENVIRONMENT=web -sMODULARIZE -sEXPORT_NAME=initPikchrModule --minify 0
2121
+ @chmod -x $(SRCDIR_extsrc)/pikchr.wasm
2122
+wasm: $(SRCDIR_extsrc)/pikchr.js
21182123
21192124
#
21202125
# The list of all the targets that do not correspond to real files. This stops
21212126
# 'make' from getting confused when someone makes an error in a rule.
21222127
#
21232128
21242129
.PHONY: all install test clean
21252130
21262131
21272132
ADDED tools/emcc.sh.in
--- src/main.mk
+++ src/main.mk
@@ -163,12 +163,12 @@
163 $(SRCDIR)/xfer.c \
164 $(SRCDIR)/xfersetup.c \
165 $(SRCDIR)/zip.c
166
167 EXTRA_FILES = \
168 $(SRCDIR)/../extsrc/pikchr-module.js \
169 $(SRCDIR)/../extsrc/pikchr-worker.js \
 
170 $(SRCDIR)/../extsrc/pikchr.wasm \
171 $(SRCDIR)/../skins/ardoise/css.txt \
172 $(SRCDIR)/../skins/ardoise/details.txt \
173 $(SRCDIR)/../skins/ardoise/footer.txt \
174 $(SRCDIR)/../skins/ardoise/header.txt \
@@ -2113,13 +2113,18 @@
2113 $(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
2114 $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
2115
2116 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
2117 $(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
 
 
 
 
 
2118
2119 #
2120 # The list of all the targets that do not correspond to real files. This stops
2121 # 'make' from getting confused when someone makes an error in a rule.
2122 #
2123
2124 .PHONY: all install test clean
2125
2126
2127 DDED tools/emcc.sh.in
--- src/main.mk
+++ src/main.mk
@@ -163,12 +163,12 @@
163 $(SRCDIR)/xfer.c \
164 $(SRCDIR)/xfersetup.c \
165 $(SRCDIR)/zip.c
166
167 EXTRA_FILES = \
 
168 $(SRCDIR)/../extsrc/pikchr-worker.js \
169 $(SRCDIR)/../extsrc/pikchr.js \
170 $(SRCDIR)/../extsrc/pikchr.wasm \
171 $(SRCDIR)/../skins/ardoise/css.txt \
172 $(SRCDIR)/../skins/ardoise/details.txt \
173 $(SRCDIR)/../skins/ardoise/footer.txt \
174 $(SRCDIR)/../skins/ardoise/header.txt \
@@ -2113,13 +2113,18 @@
2113 $(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
2114 $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
2115
2116 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
2117 $(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
2118
2119 $(SRCDIR_extsrc)/pikchr.js: $(SRCDIR_extsrc)/pikchr.c
2120 $(EMCC_WRAPPER) -o $@ $(EMCC_OPT) --no-entry -sEXPORTED_RUNTIME_METHODS=cwrap,setValue,getValue,stackSave,stackRestore -sEXPORTED_FUNCTIONS=_pikchr $(SRCDIR_extsrc)/pikchr.c -sENVIRONMENT=web -sMODULARIZE -sEXPORT_NAME=initPikchrModule --minify 0
2121 @chmod -x $(SRCDIR_extsrc)/pikchr.wasm
2122 wasm: $(SRCDIR_extsrc)/pikchr.js
2123
2124 #
2125 # The list of all the targets that do not correspond to real files. This stops
2126 # 'make' from getting confused when someone makes an error in a rule.
2127 #
2128
2129 .PHONY: all install test clean
2130
2131
2132 DDED tools/emcc.sh.in
--- a/tools/emcc.sh.in
+++ b/tools/emcc.sh.in
@@ -0,0 +1,56 @@
1
+#!/usr/bin/bash
2
+#############################################
3
+# WARNING: emcc.sh is generated from emcc.sh.in by the configure
4
+# process. Do not edit emcc.sh directly, as it may be deleted or
5
+# overwritten by the configure script.
6
+#
7
+# A wrapper around the emcc compiler which uses configure-time state
8
+# to locate the Emscripten SDK and import the SDK's environment
9
+# script, if needed.
10
+########################################################################
11
+# EMSDK_HOME comes from the configure --with-emsdk=/dir flag.
12
+# EMSDK_ENVk=/dir flag.
13
+# EMSDK_ENV_SH is ${thatDir}/emsdk_env.sh and is also set by the
14
+# ="@EMSDK_ENV@"
15
+
16
+emc`which emcc 2>/dev/null`IET
17
+ # ^^^ Sque_HOME}" ]; then
18
+/to/emsdk" \
19
+ "to the configure script." 1>&2
20
+ exit 1
21
+ fi
22
+
23
+ i then
24
+ if [ -f "${EMSDK_HOME}/eexit 1
25
+fi
26
+
27
+IET
28
+ # ^^^ Sque>&2
29
+ exit 3
30
+ if [ -f Expecting configure script t ]; then
31
+H is not set. Expeelse
32
+>&2
33
+ exit 2
34
+ fi
35
+ fi
36
+
37
+ if [ ! -f "${EMSDK_ENV_SH}" ]; then
38
+ echo "emexit 2
39
+ fi
40
+fi
41
+
42
+"emsdk_env script not found: $EMSDK
43
+
44
+ # $EMSDK is part of thexit 3
45
+fi
46
+
47
+EMSDK}" ]; then
48
+ EMSDIET
49
+ # ^^^ Squelches informa # ^^^ Squelches inMSDK_ENV_SH}" || {
50
+ rc=$rc=$?
51
+ENV_SH}"
52
+ eexit $rc
53
+ }
54
+fi
55
+
56
+if ! w
--- a/tools/emcc.sh.in
+++ b/tools/emcc.sh.in
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/tools/emcc.sh.in
+++ b/tools/emcc.sh.in
@@ -0,0 +1,56 @@
1 #!/usr/bin/bash
2 #############################################
3 # WARNING: emcc.sh is generated from emcc.sh.in by the configure
4 # process. Do not edit emcc.sh directly, as it may be deleted or
5 # overwritten by the configure script.
6 #
7 # A wrapper around the emcc compiler which uses configure-time state
8 # to locate the Emscripten SDK and import the SDK's environment
9 # script, if needed.
10 ########################################################################
11 # EMSDK_HOME comes from the configure --with-emsdk=/dir flag.
12 # EMSDK_ENVk=/dir flag.
13 # EMSDK_ENV_SH is ${thatDir}/emsdk_env.sh and is also set by the
14 # ="@EMSDK_ENV@"
15
16 emc`which emcc 2>/dev/null`IET
17 # ^^^ Sque_HOME}" ]; then
18 /to/emsdk" \
19 "to the configure script." 1>&2
20 exit 1
21 fi
22
23 i then
24 if [ -f "${EMSDK_HOME}/eexit 1
25 fi
26
27 IET
28 # ^^^ Sque>&2
29 exit 3
30 if [ -f Expecting configure script t ]; then
31 H is not set. Expeelse
32 >&2
33 exit 2
34 fi
35 fi
36
37 if [ ! -f "${EMSDK_ENV_SH}" ]; then
38 echo "emexit 2
39 fi
40 fi
41
42 "emsdk_env script not found: $EMSDK
43
44 # $EMSDK is part of thexit 3
45 fi
46
47 EMSDK}" ]; then
48 EMSDIET
49 # ^^^ Squelches informa # ^^^ Squelches inMSDK_ENV_SH}" || {
50 rc=$rc=$?
51 ENV_SH}"
52 eexit $rc
53 }
54 fi
55
56 if ! w
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -218,11 +218,11 @@
218218
style.*.css
219219
../skins/*/*.txt
220220
sounds/*.wav
221221
alerts/*.wav
222222
../extsrc/pikchr.wasm
223
- ../extsrc/pikchr-*.js
223
+ ../extsrc/pikchr*.js
224224
}
225225
226226
# Options used to compile the included SQLite library.
227227
#
228228
set SQLITE_OPTIONS {
@@ -561,10 +561,21 @@
561561
$(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
562562
563563
$(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
564564
$(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
565565
566
+$(SRCDIR_extsrc)/pikchr.js: $(SRCDIR_extsrc)/pikchr.c
567
+ $(EMCC_WRAPPER) -o $@ $(EMCC_OPT) --no-entry \
568
+ -sEXPORTED_RUNTIME_METHODS=cwrap,setValue,getValue,stackSave,stackRestore \
569
+ -sEXPORTED_FUNCTIONS=_pikchr $(SRCDIR_extsrc)/pikchr.c \
570
+ -sENVIRONMENT=web \
571
+ -sMODULARIZE \
572
+ -sEXPORT_NAME=initPikchrModule \
573
+ --minify 0
574
+ @chmod -x $(SRCDIR_extsrc)/pikchr.wasm
575
+wasm: $(SRCDIR_extsrc)/pikchr.js
576
+
566577
#
567578
# The list of all the targets that do not correspond to real files. This stops
568579
# 'make' from getting confused when someone makes an error in a rule.
569580
#
570581
@@ -639,11 +650,11 @@
639650
640651
#### Enable compiling with debug symbols (much larger binary)
641652
#
642653
# FOSSIL_ENABLE_SYMBOLS = 1
643654
644
-#### Enable JSON (http://www.json.org) support using "cson"
655
+#### Enable JSON (https://www.json.org) support using "cson"
645656
#
646657
# FOSSIL_ENABLE_JSON = 1
647658
648659
#### Enable HTTPS support via OpenSSL (links to libssl and libcrypto)
649660
#
650661
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -218,11 +218,11 @@
218 style.*.css
219 ../skins/*/*.txt
220 sounds/*.wav
221 alerts/*.wav
222 ../extsrc/pikchr.wasm
223 ../extsrc/pikchr-*.js
224 }
225
226 # Options used to compile the included SQLite library.
227 #
228 set SQLITE_OPTIONS {
@@ -561,10 +561,21 @@
561 $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
562
563 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
564 $(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
565
 
 
 
 
 
 
 
 
 
 
 
566 #
567 # The list of all the targets that do not correspond to real files. This stops
568 # 'make' from getting confused when someone makes an error in a rule.
569 #
570
@@ -639,11 +650,11 @@
639
640 #### Enable compiling with debug symbols (much larger binary)
641 #
642 # FOSSIL_ENABLE_SYMBOLS = 1
643
644 #### Enable JSON (http://www.json.org) support using "cson"
645 #
646 # FOSSIL_ENABLE_JSON = 1
647
648 #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto)
649 #
650
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -218,11 +218,11 @@
218 style.*.css
219 ../skins/*/*.txt
220 sounds/*.wav
221 alerts/*.wav
222 ../extsrc/pikchr.wasm
223 ../extsrc/pikchr*.js
224 }
225
226 # Options used to compile the included SQLite library.
227 #
228 set SQLITE_OPTIONS {
@@ -561,10 +561,21 @@
561 $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
562
563 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
564 $(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
565
566 $(SRCDIR_extsrc)/pikchr.js: $(SRCDIR_extsrc)/pikchr.c
567 $(EMCC_WRAPPER) -o $@ $(EMCC_OPT) --no-entry \
568 -sEXPORTED_RUNTIME_METHODS=cwrap,setValue,getValue,stackSave,stackRestore \
569 -sEXPORTED_FUNCTIONS=_pikchr $(SRCDIR_extsrc)/pikchr.c \
570 -sENVIRONMENT=web \
571 -sMODULARIZE \
572 -sEXPORT_NAME=initPikchrModule \
573 --minify 0
574 @chmod -x $(SRCDIR_extsrc)/pikchr.wasm
575 wasm: $(SRCDIR_extsrc)/pikchr.js
576
577 #
578 # The list of all the targets that do not correspond to real files. This stops
579 # 'make' from getting confused when someone makes an error in a rule.
580 #
581
@@ -639,11 +650,11 @@
650
651 #### Enable compiling with debug symbols (much larger binary)
652 #
653 # FOSSIL_ENABLE_SYMBOLS = 1
654
655 #### Enable JSON (https://www.json.org) support using "cson"
656 #
657 # FOSSIL_ENABLE_JSON = 1
658
659 #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto)
660 #
661
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -54,11 +54,11 @@
5454
5555
#### Enable compiling with debug symbols (much larger binary)
5656
#
5757
# FOSSIL_ENABLE_SYMBOLS = 1
5858
59
-#### Enable JSON (http://www.json.org) support using "cson"
59
+#### Enable JSON (https://www.json.org) support using "cson"
6060
#
6161
# FOSSIL_ENABLE_JSON = 1
6262
6363
#### Enable HTTPS support via OpenSSL (links to libssl and libcrypto)
6464
#
@@ -549,12 +549,12 @@
549549
$(SRCDIR)/xfer.c \
550550
$(SRCDIR)/xfersetup.c \
551551
$(SRCDIR)/zip.c
552552
553553
EXTRA_FILES = \
554
- $(SRCDIR)/../extsrc/pikchr-module.js \
555554
$(SRCDIR)/../extsrc/pikchr-worker.js \
555
+ $(SRCDIR)/../extsrc/pikchr.js \
556556
$(SRCDIR)/../extsrc/pikchr.wasm \
557557
$(SRCDIR)/../skins/ardoise/css.txt \
558558
$(SRCDIR)/../skins/ardoise/details.txt \
559559
$(SRCDIR)/../skins/ardoise/footer.txt \
560560
$(SRCDIR)/../skins/ardoise/header.txt \
561561
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -54,11 +54,11 @@
54
55 #### Enable compiling with debug symbols (much larger binary)
56 #
57 # FOSSIL_ENABLE_SYMBOLS = 1
58
59 #### Enable JSON (http://www.json.org) support using "cson"
60 #
61 # FOSSIL_ENABLE_JSON = 1
62
63 #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto)
64 #
@@ -549,12 +549,12 @@
549 $(SRCDIR)/xfer.c \
550 $(SRCDIR)/xfersetup.c \
551 $(SRCDIR)/zip.c
552
553 EXTRA_FILES = \
554 $(SRCDIR)/../extsrc/pikchr-module.js \
555 $(SRCDIR)/../extsrc/pikchr-worker.js \
 
556 $(SRCDIR)/../extsrc/pikchr.wasm \
557 $(SRCDIR)/../skins/ardoise/css.txt \
558 $(SRCDIR)/../skins/ardoise/details.txt \
559 $(SRCDIR)/../skins/ardoise/footer.txt \
560 $(SRCDIR)/../skins/ardoise/header.txt \
561
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -54,11 +54,11 @@
54
55 #### Enable compiling with debug symbols (much larger binary)
56 #
57 # FOSSIL_ENABLE_SYMBOLS = 1
58
59 #### Enable JSON (https://www.json.org) support using "cson"
60 #
61 # FOSSIL_ENABLE_JSON = 1
62
63 #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto)
64 #
@@ -549,12 +549,12 @@
549 $(SRCDIR)/xfer.c \
550 $(SRCDIR)/xfersetup.c \
551 $(SRCDIR)/zip.c
552
553 EXTRA_FILES = \
 
554 $(SRCDIR)/../extsrc/pikchr-worker.js \
555 $(SRCDIR)/../extsrc/pikchr.js \
556 $(SRCDIR)/../extsrc/pikchr.wasm \
557 $(SRCDIR)/../skins/ardoise/css.txt \
558 $(SRCDIR)/../skins/ardoise/details.txt \
559 $(SRCDIR)/../skins/ardoise/footer.txt \
560 $(SRCDIR)/../skins/ardoise/header.txt \
561
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -505,12 +505,12 @@
505505
"$(OX)\xfer_.c" \
506506
"$(OX)\xfersetup_.c" \
507507
"$(OX)\zip_.c" \
508508
"$(SRCDIR_extsrc)\pikchr.c"
509509
510
-EXTRA_FILES = "$(SRCDIR)\..\extsrc\pikchr-module.js" \
511
- "$(SRCDIR)\..\extsrc\pikchr-worker.js" \
510
+EXTRA_FILES = "$(SRCDIR)\..\extsrc\pikchr-worker.js" \
511
+ "$(SRCDIR)\..\extsrc\pikchr.js" \
512512
"$(SRCDIR)\..\extsrc\pikchr.wasm" \
513513
"$(SRCDIR)\..\skins\ardoise\css.txt" \
514514
"$(SRCDIR)\..\skins\ardoise\details.txt" \
515515
"$(SRCDIR)\..\skins\ardoise\footer.txt" \
516516
"$(SRCDIR)\..\skins\ardoise\header.txt" \
@@ -1134,12 +1134,12 @@
11341134
"$(OBJDIR)\json_timeline$O" : "$(SRCDIR)\json_detail.h"
11351135
"$(OBJDIR)\json_user$O" : "$(SRCDIR)\json_detail.h"
11361136
"$(OBJDIR)\json_wiki$O" : "$(SRCDIR)\json_detail.h"
11371137
11381138
"$(OX)\builtin_data.reslist": $(EXTRA_FILES) "$(B)\win\Makefile.msc"
1139
- echo "$(SRCDIR)\../extsrc/pikchr-module.js" > $@
1140
- echo "$(SRCDIR)\../extsrc/pikchr-worker.js" >> $@
1139
+ echo "$(SRCDIR)\../extsrc/pikchr-worker.js" > $@
1140
+ echo "$(SRCDIR)\../extsrc/pikchr.js" >> $@
11411141
echo "$(SRCDIR)\../extsrc/pikchr.wasm" >> $@
11421142
echo "$(SRCDIR)\../skins/ardoise/css.txt" >> $@
11431143
echo "$(SRCDIR)\../skins/ardoise/details.txt" >> $@
11441144
echo "$(SRCDIR)\../skins/ardoise/footer.txt" >> $@
11451145
echo "$(SRCDIR)\../skins/ardoise/header.txt" >> $@
11461146
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -505,12 +505,12 @@
505 "$(OX)\xfer_.c" \
506 "$(OX)\xfersetup_.c" \
507 "$(OX)\zip_.c" \
508 "$(SRCDIR_extsrc)\pikchr.c"
509
510 EXTRA_FILES = "$(SRCDIR)\..\extsrc\pikchr-module.js" \
511 "$(SRCDIR)\..\extsrc\pikchr-worker.js" \
512 "$(SRCDIR)\..\extsrc\pikchr.wasm" \
513 "$(SRCDIR)\..\skins\ardoise\css.txt" \
514 "$(SRCDIR)\..\skins\ardoise\details.txt" \
515 "$(SRCDIR)\..\skins\ardoise\footer.txt" \
516 "$(SRCDIR)\..\skins\ardoise\header.txt" \
@@ -1134,12 +1134,12 @@
1134 "$(OBJDIR)\json_timeline$O" : "$(SRCDIR)\json_detail.h"
1135 "$(OBJDIR)\json_user$O" : "$(SRCDIR)\json_detail.h"
1136 "$(OBJDIR)\json_wiki$O" : "$(SRCDIR)\json_detail.h"
1137
1138 "$(OX)\builtin_data.reslist": $(EXTRA_FILES) "$(B)\win\Makefile.msc"
1139 echo "$(SRCDIR)\../extsrc/pikchr-module.js" > $@
1140 echo "$(SRCDIR)\../extsrc/pikchr-worker.js" >> $@
1141 echo "$(SRCDIR)\../extsrc/pikchr.wasm" >> $@
1142 echo "$(SRCDIR)\../skins/ardoise/css.txt" >> $@
1143 echo "$(SRCDIR)\../skins/ardoise/details.txt" >> $@
1144 echo "$(SRCDIR)\../skins/ardoise/footer.txt" >> $@
1145 echo "$(SRCDIR)\../skins/ardoise/header.txt" >> $@
1146
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -505,12 +505,12 @@
505 "$(OX)\xfer_.c" \
506 "$(OX)\xfersetup_.c" \
507 "$(OX)\zip_.c" \
508 "$(SRCDIR_extsrc)\pikchr.c"
509
510 EXTRA_FILES = "$(SRCDIR)\..\extsrc\pikchr-worker.js" \
511 "$(SRCDIR)\..\extsrc\pikchr.js" \
512 "$(SRCDIR)\..\extsrc\pikchr.wasm" \
513 "$(SRCDIR)\..\skins\ardoise\css.txt" \
514 "$(SRCDIR)\..\skins\ardoise\details.txt" \
515 "$(SRCDIR)\..\skins\ardoise\footer.txt" \
516 "$(SRCDIR)\..\skins\ardoise\header.txt" \
@@ -1134,12 +1134,12 @@
1134 "$(OBJDIR)\json_timeline$O" : "$(SRCDIR)\json_detail.h"
1135 "$(OBJDIR)\json_user$O" : "$(SRCDIR)\json_detail.h"
1136 "$(OBJDIR)\json_wiki$O" : "$(SRCDIR)\json_detail.h"
1137
1138 "$(OX)\builtin_data.reslist": $(EXTRA_FILES) "$(B)\win\Makefile.msc"
1139 echo "$(SRCDIR)\../extsrc/pikchr-worker.js" > $@
1140 echo "$(SRCDIR)\../extsrc/pikchr.js" >> $@
1141 echo "$(SRCDIR)\../extsrc/pikchr.wasm" >> $@
1142 echo "$(SRCDIR)\../skins/ardoise/css.txt" >> $@
1143 echo "$(SRCDIR)\../skins/ardoise/details.txt" >> $@
1144 echo "$(SRCDIR)\../skins/ardoise/footer.txt" >> $@
1145 echo "$(SRCDIR)\../skins/ardoise/header.txt" >> $@
1146

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button