daurnimator / lua.vm.js

The project is superceded by Fengari. See https://fengari.io/
MIT License
835 stars 101 forks source link

gnu-sed on osx #59

Closed seanjensengrey closed 8 years ago

seanjensengrey commented 8 years ago

This fixes an issue I was seeing between BSD sed and Gnu sed

sed -i -e '1i!(function(exports){var module;' ../../dist/lua.vm.js
sed: 1: "1i!(function(exports){v ...": command i expects \ followed by text
make[2]: *** [../../dist/lua.vm.js] Error 1
make[1]: *** [emscripten] Error 2
make: *** [emscripten] Error 2
daurnimator commented 8 years ago

gsed isn't a standard alias; and I'd like to keep the lua makefile changes to a minimum.

Is there an easy way to prepend to a file without use of sed? Or a change to my sed invocation that will make it work with either gnu sed or bsd sed?

seanjensengrey commented 8 years ago

Understandable. I played with bsd sed vs gnu sed for awhile, I am no sedspert, and couldn't find an intersection of features. What about a python2 one liner ?

It does only attempt to use gsed while on Darwin and the comments direct one to install gnu-sed via Homebrew. I don't know what macports calls sed on OSX.

daurnimator commented 8 years ago

What about a python2 one liner ?

No python. Could probably use awk. Or could just fall back to echo + cat and shell redirection.

seanjensengrey commented 8 years ago

I removed the call to sed completely. Tested with my application using a built version of lua.vm.js using

emcc (Emscripten gcc/clang-like replacement) 1.36.5 (commit 8e29cf1b1d39f5d86aaeb702597aa34d97cd763a)

I built but did no test on Ubuntu 14.04 using emcc 1.10.0

daurnimator commented 8 years ago

Merged :)