Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of .map files in js_of_ocaml, wasm_of_ocaml #1909

Open
JasonGross opened this issue May 13, 2024 · 0 comments
Open

Better handling of .map files in js_of_ocaml, wasm_of_ocaml #1909

JasonGross opened this issue May 13, 2024 · 0 comments

Comments

@JasonGross
Copy link
Collaborator

Currently, we are pulling various sed hacks to deal with .map files when bedrock2 is enabled. We should have a more systematic way of generating files with appropriate names and mappings

ifeq ($(SKIP_BEDROCK2),1)
install-standalone-ocaml: FILESTOINSTALL=$(OCAML_BINARIES)
install-standalone-unified-ocaml: FILESTOINSTALL=$(UNIFIED_OCAML_BINARIES)
install-standalone-separate-ocaml: FILESTOINSTALL=$(SEPARATE_OCAML_BINARIES)
install-standalone-haskell: FILESTOINSTALL=$(HASKELL_BINARIES)
install-standalone-unified-haskell: FILESTOINSTALL=$(UNIFIED_HASKELL_BINARIES)
install-standalone-separate-haskell: FILESTOINSTALL=$(SEPARATE_HASKELL_BINARIES)
install-standalone-js-of-ocaml: FILESTOINSTALL=$(JS_OF_OCAML_FILES)
install-standalone-wasm-of-ocaml: FILESTOINSTALL=$(WASM_OF_OCAML_FILES)
install-standalone-ocaml install-standalone-unified-ocaml install-standalone-separate-ocaml install-standalone-haskell install-standalone-unified-haskell install-standalone-separate-haskell install-standalone-js-of-ocaml install-standalone-wasm-of-ocaml:
$(HIDE)code=0; for f in $(FILESTOINSTALL); do\
if ! [ -f "$$f" ]; then >&2 echo $$f does not exist; code=1; fi \
done; exit $$code
$(HIDE)for f in $(FILESTOINSTALL); do\
install -d "$(INSTALLDIR)/" &&\
install -m $(PERMS) "$$f" "$(INSTALLDIR)/" &&\
echo INSTALL "$$f" "$(INSTALLDIR)/";\
done
else
install-standalone-ocaml: FILESTOINSTALL=$(WITH_BEDROCK2_OCAML_BINARIES)
install-standalone-unified-ocaml: FILESTOINSTALL=$(WITH_BEDROCK2_UNIFIED_OCAML_BINARIES)
install-standalone-separate-ocaml: FILESTOINSTALL=$(WITH_BEDROCK2_SEPARATE_OCAML_BINARIES)
install-standalone-haskell: FILESTOINSTALL=$(WITH_BEDROCK2_HASKELL_BINARIES)
install-standalone-unified-haskell: FILESTOINSTALL=$(WITH_BEDROCK2_UNIFIED_HASKELL_BINARIES)
install-standalone-separate-haskell: FILESTOINSTALL=$(WITH_BEDROCK2_SEPARATE_HASKELL_BINARIES)
install-standalone-js-of-ocaml: FILESTOINSTALL=$(WITH_BEDROCK2_JS_OF_OCAML_FILES)
install-standalone-wasm-of-ocaml: FILESTOINSTALL=$(WITH_BEDROCK2_WASM_OF_OCAML_TEXT_FILES)
install-standalone-wasm-of-ocaml: BINARYFILESTOINSTALL=$(WITH_BEDROCK2_WASM_OF_OCAML_BINARY_FILES)
install-standalone-ocaml install-standalone-unified-ocaml install-standalone-separate-ocaml install-standalone-haskell install-standalone-unified-haskell install-standalone-separate-haskell:
$(HIDE)code=0; for f in $(FILESTOINSTALL); do\
if ! [ -f "$$f" ]; then >&2 echo $$f does not exist; code=1; fi \
done; exit $$code
$(HIDE)for f in $(FILESTOINSTALL); do\
fdir="$$(dirname "$$f")" &&\
fname="$$(basename "$$f")" &&\
df="$${fname#with_bedrock2_}" &&\
install -d "$(INSTALLDIR)/" &&\
install -m $(PERMS) "$$f" "$(INSTALLDIR)/$$df" &&\
echo INSTALL "$$f" "$(INSTALLDIR)/$$df";\
done
install-standalone-js-of-ocaml:
$(HIDE)code=0; for f in $(FILESTOINSTALL); do\
if ! [ -f "$$f" ]; then >&2 echo $$f does not exist; code=1; fi \
done; exit $$code
$(HIDE)for f in $(FILESTOINSTALL); do\
fdir="$$(dirname "$$f")" &&\
fname="$$(basename "$$f")" &&\
df="$${fname#with_bedrock2_}" &&\
install -d "$(INSTALLDIR)/" &&\
install -m $(PERMS) "$$f" "$(INSTALLDIR)/$$df" &&\
sed -i.bak -e 's,\(sourceMappingURL=.*\)with_bedrock2_,\1,g; s,\("file":[^"]*"[^"]*\)with_bedrock2_,\1,g' "$(INSTALLDIR)/$$df" &&\
rm -f "$(INSTALLDIR)/$$df.bak" &&\
echo 'INSTALL+SED' "$$f" "$(INSTALLDIR)/$$df";\
done
install-standalone-wasm-of-ocaml:
$(HIDE)code=0; for f in $(FILESTOINSTALL) $(BINARYFILESTOINSTALL); do\
if ! [ -f "$$f" ]; then >&2 echo $$f does not exist; code=1; fi \
done; exit $$code
$(HIDE)for f in $(FILESTOINSTALL); do\
fdir="$$(dirname "$$f")" &&\
fname="$$(basename "$$f")" &&\
df="wasm_$${fname#with_bedrock2_}" &&\
install -d "$(INSTALLDIR)/" &&\
install -m $(PERMS) "$$f" "$(INSTALLDIR)/$$df" &&\
sed -i.bak -e 's,with_bedrock2_,wasm_,g' "$(INSTALLDIR)/$$df" &&\
rm -f "$(INSTALLDIR)/$$df.bak" &&\
echo 'INSTALL+SED' "$$f" "$(INSTALLDIR)/$$df";\
done
$(HIDE)for f in $(BINARYFILESTOINSTALL); do\
fdir="$$(dirname "$$f")" &&\
fname="$$(basename "$$f")" &&\
df="wasm_$${fname#with_bedrock2_}" &&\
install -d "$(INSTALLDIR)/" &&\
install -m $(PERMS) "$$f" "$(INSTALLDIR)/$$df" &&\
echo 'INSTALL' "$$f" "$(INSTALLDIR)/$$df";\
done
endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant