forked from mirror/ledisdb
add lua build tag
maybe install golua error, and lua cannot be used
This commit is contained in:
parent
8ad6eabd6a
commit
b9ea592026
|
@ -16,4 +16,4 @@ go get github.com/BurntSushi/toml
|
||||||
|
|
||||||
go get github.com/siddontang/go-bson/bson
|
go get github.com/siddontang/go-bson/bson
|
||||||
|
|
||||||
go get github.com/aarzilli/golua/lua
|
go get github.com/siddontang/golua/lua
|
7
dev.sh
7
dev.sh
|
@ -74,6 +74,13 @@ if [ -f $HYPERLEVELDB_DIR/include/hyperleveldb/c.h ]; then
|
||||||
GO_BUILD_TAGS="$GO_BUILD_TAGS hyperleveldb"
|
GO_BUILD_TAGS="$GO_BUILD_TAGS hyperleveldb"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#check lua
|
||||||
|
CHECK_LUA_FILE="$LEDISTOP/tools/check_lua.go"
|
||||||
|
go run $CHECK_LUA_FILE 2>/dev/null
|
||||||
|
if [ "$?" = 0 ]; then
|
||||||
|
GO_BUILD_TAGS="$GO_BUILD_TAGS lua"
|
||||||
|
fi
|
||||||
|
|
||||||
export CGO_CFLAGS
|
export CGO_CFLAGS
|
||||||
export CGO_CXXFLAGS
|
export CGO_CXXFLAGS
|
||||||
export CGO_LDFLAGS
|
export CGO_LDFLAGS
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
// +build lua
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/aarzilli/golua/lua"
|
"github.com/siddontang/golua/lua"
|
||||||
"github.com/siddontang/ledisdb/ledis"
|
"github.com/siddontang/ledisdb/ledis"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build lua
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
// +build lua
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/aarzilli/golua/lua"
|
"github.com/siddontang/golua/lua"
|
||||||
"github.com/siddontang/ledisdb/ledis"
|
"github.com/siddontang/ledisdb/ledis"
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -159,6 +161,10 @@ func (app *App) openScript() {
|
||||||
l.OpenTable()
|
l.OpenTable()
|
||||||
l.OpenPackage()
|
l.OpenPackage()
|
||||||
|
|
||||||
|
l.OpenCJson()
|
||||||
|
l.OpenCMsgpack()
|
||||||
|
l.OpenStruct()
|
||||||
|
|
||||||
l.Register("error", luaErrorHandler)
|
l.Register("error", luaErrorHandler)
|
||||||
|
|
||||||
s.l = l
|
s.l = l
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
// +build !lua
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
type script struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (app *App) openScript() {}
|
||||||
|
|
||||||
|
func (app *App) closeScript() {}
|
|
@ -1,8 +1,10 @@
|
||||||
|
// +build lua
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/aarzilli/golua/lua"
|
"github.com/siddontang/golua/lua"
|
||||||
"github.com/siddontang/ledisdb/config"
|
"github.com/siddontang/ledisdb/config"
|
||||||
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "github.com/siddontang/golua/lua"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
L := lua.NewState()
|
||||||
|
L.Close()
|
||||||
|
}
|
Loading…
Reference in New Issue