Created
December 17, 2013 02:43
-
-
Save xxuejie/7999132 to your computer and use it in GitHub Desktop.
Compile and link hiredis with webruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Suppose the currenct directory is ~/develop | |
$ git clone https://github.com/redis/hiredis | |
$ cd hiredis | |
# Set emscripten compiling target | |
$ export EMCC_LLVM_TARGET=i386-pc-linux-gnu | |
# Locale the installation path of webruby, for example, on my mac this is: | |
# ~/.gem/ruby/2.0.0/gems/webruby-0.2.4/ | |
# So emscripten cc compilier lives at: | |
# ~/.gem/ruby/2.0.0/gems/webruby-0.2.4/modules/emscripten/emcc | |
# And the ar archive tool lives at: | |
# ~/.gem/ruby/2.0.0/gems/webruby-0.2.4/modules/emscripten/emar | |
# Hence, use the following command to set compiler: | |
$ export CC="~/.gem/ruby/2.0.0/gems/webruby-0.2.4/modules/emscripten/emcc" | |
# Now we can compile hiredis: | |
$ make OPTIMIZATION="-O2" DEBUG="-g" STLIB_MAKE_CMD="/Users/rafael/develop/opensource/webruby/modules/emscripten/emar rcs libhiredis.a" libhiredis.a | |
# If everything goes as planned, we will have a `libhiredis.a` file in current directory, this is the library we want to link | |
$ cd .. | |
# Now install the latest webruby gem(0.2.4) | |
$ webruby new HiredisExample | |
$ cd HiredisExample | |
# Open your favourite editor, add the following lines to the Rakefile: | |
# | |
# conf.gem :git => 'https://github.com/matsumoto-r/mruby-redis', :branch => 'master' | |
# conf.cflags << '-I/usr/local/Cellar/hiredis/0.11.0/include' | |
# conf.static_libs << '~/develop/opensource/hiredis/libhiredis.a' | |
# | |
# You may want to adjust the parameters according to your environment | |
# Then you can use webruby to build and link hiredis: | |
$ rake |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment