Skip to content

Commit

Permalink
bugfix: compiled module 'rapidjson' with the luajit of openresty.
Browse files Browse the repository at this point in the history
Fix #206.
  • Loading branch information
membphis committed Jul 7, 2019
1 parent 151c899 commit 1e8459c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ env:

before_install:
- sudo cpanm --notest Test::Nginx IPC::Run > build.log 2>&1 || (cat build.log && exit 1)
- sudo luarocks install luacov-coveralls
- sudo luarocks install --lua-dir=/usr/local/openresty/luajit luacov-coveralls

install:
- wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
- sudo apt-get -y install software-properties-common
- sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"
- sudo apt-get update
- sudo apt-get install openresty-debug
- sudo luarocks install apisix-*.rockspec --only-deps
- sudo luarocks install --lua-dir=/usr/local/openresty/luajit apisix-*.rockspec --only-deps
- git clone https://github.com/openresty/test-nginx.git test-nginx

script:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ help:
dev:
./utils/update_nginx_conf_dev.sh
ifeq ($(UNAME),Darwin)
luarocks install apisix-*.rockspec --tree=deps --only-deps
luarocks install --lua-dir=/usr/local/openresty/luajit apisix-*.rockspec --tree=deps --only-deps
else
sudo luarocks install apisix-*.rockspec --tree=deps --only-deps
sudo luarocks install --lua-dir=/usr/local/openresty/luajit apisix-*.rockspec --tree=deps --only-deps
endif


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ We recommend that you use [luarocks](https://luarocks.org/) to install APISIX, a
#### Install APISIX

```shell
sudo luarocks install apisix
sudo luarocks install --lua-dir=/usr/local/openresty/luajit apisix
```

If all goes well, you will see the message like this:
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ APISIX 是基于 [openresty](http://openresty.org/) 之上构建的, 配置数
#### 安装 APISIX

```shell
sudo luarocks install apisix
sudo luarocks install --lua-dir=/usr/local/openresty/luajit apisix
```

如果一切顺利,你会在最后看到这样的信息:
Expand Down
26 changes: 11 additions & 15 deletions bin/apisix
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,25 @@ end

excute_cmd("install -d -m 777 /tmp/apisix_cores/")

-- _VERSION = "Lua 5.*"
local lua_ver = string.sub(_VERSION, #"Lua " + 1)

local apisix_home = "/usr/local/apisix"
if script_path:sub(1, 4) == '/usr' or script_path:sub(1, 4) == '/bin' then
package.cpath = "/usr/local/apisix/deps/lib64/lua/" .. lua_ver .. "/?.so;"
.. "/usr/local/apisix/deps/lib/lua/" .. lua_ver .. "/?.so;"
package.cpath = "/usr/local/apisix/deps/lib64/lua/5.1/?.so;"
.. "/usr/local/apisix/deps/lib/lua/5.1/?.so;"
.. package.cpath

package.path = "/usr/local/apisix/deps/share/lua/" .. lua_ver .. "/apisix/lua/?.lua;"
.. "/usr/local/apisix/deps/share/lua/" .. lua_ver .. "/?.lua;"
.. "/usr/share/lua/" .. lua_ver .. "/apisix/lua/?.lua;"
.. "/usr/local/share/lua/" .. lua_ver .. "/apisix/lua/?.lua;"
package.path = "/usr/local/apisix/deps/share/lua/5.1/apisix/lua/?.lua;"
.. "/usr/local/apisix/deps/share/lua/5.1/?.lua;"
.. "/usr/share/lua/5.1/apisix/lua/?.lua;"
.. "/usr/local/share/lua/5.1/apisix/lua/?.lua;"
.. package.path

else
apisix_home = pwd
package.cpath = pwd .. "/deps/lib64/lua/" .. lua_ver .. "/?.so;"
package.cpath = pwd .. "/deps/lib64/lua/5.1/?.so;"
.. package.cpath

package.path = pwd .. "/lua/?.lua;"
.. pwd .. "/deps/share/lua/" .. lua_ver .. "/?.lua;"
.. pwd .. "/deps/share/lua/5.1/?.lua;"
.. package.path
end
-- print("apisix_home: ", apisix_home)
Expand Down Expand Up @@ -83,10 +80,10 @@ working_directory /tmp/apisix_cores/;
worker_shutdown_timeout 3;
http {
lua_package_path "$prefix/deps/share/lua/{*lua_version*}/?.lua;]=]
lua_package_path "$prefix/deps/share/lua/5.1/?.lua;]=]
.. [=[{*apisix_lua_home*}/lua/?.lua;;{*lua_path*};";
lua_package_cpath "$prefix/deps/lib64/lua/{*lua_version*}/?.so;]=]
.. [=[$prefix/deps/lib/lua/{*lua_version*}/?.so;;]=]
lua_package_cpath "$prefix/deps/lib64/lua/5.1/?.so;]=]
.. [=[$prefix/deps/lib/lua/5.1/?.so;;]=]
.. [=[{*lua_cpath*};";
lua_shared_dict plugin-limit-req 10m;
Expand Down Expand Up @@ -284,7 +281,6 @@ local function init()
lua_cpath = package.cpath,
os_name = exec("uname"),
apisix_lua_home = apisix_home,
lua_version = lua_ver,
with_module_status = with_module_status,
node_ssl_listen = 9443, -- default value
},
Expand Down

0 comments on commit 1e8459c

Please sign in to comment.