Add support for static builds, switch to PHP 7.x by default

This commit is contained in:
Alex Palaistras 2017-01-28 16:58:59 +00:00
parent 89c9c5b7bd
commit 7087ecbd63
5 changed files with 21 additions and 10 deletions

View File

@ -1,4 +1,6 @@
# PHP bindings for Go [![API Documentation][godoc-svg]][godoc-url] [![MIT License][license-svg]][license-url]
# PHP bindings for Go
[![API Documentation][godoc-svg]][godoc-url] [![MIT License][license-svg]][license-url]
This package implements support for executing PHP scripts, exporting Go variables for use in PHP contexts, attaching Go method receivers as PHP classes and returning PHP variables for use in Go contexts.
@ -10,13 +12,13 @@ Building this package requires that you have PHP installed as a library. For mos
Once the PHP library is available, the bindings can be compiled with `go build` and are `go get`-able.
**Note**: Building against PHP 7 currently requires that the `php7` tag is provided, i.e.:
**Note**: Building against PHP 5.x requires that the `php5` tag is provided, i.e.:
```bash
go get -tags php7 github.com/deuill/go-php
go get -tags php5 github.com/deuill/go-php
```
This restriction might change in the future, in which case building against PHP 7 will be made the default and building against PHP 5 will require a `php5` tag.
This is due to the fact that PHP 7.x is the default build target.
## Status
@ -47,7 +49,7 @@ These items will be tackled in order of significance (which may not be the order
### Basic
Executing a script is very simple:
Executing a script is simple:
```go
package main

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
//
// +build !php7,!php7.debian
// +build php5
package engine

View File

@ -7,12 +7,13 @@
// conventions for include and library paths, so we need a specific build tag
// for building against those packages.
//
// +build php7.debian
// +build php7
// +build debian
package engine
// #cgo CFLAGS: -I/usr/include/php/20151012 -Iinclude/php7 -Isrc/php7
// #cgo CFLAGS: -I/usr/include/php/20151012/main -I/usr/include/php/20151012/Zend
// #cgo CFLAGS: -I/usr/include/php/20151012/main -I/usr/include/php/20151012/Zend
// #cgo CFLAGS: -I/usr/include/php/20151012/TSRM
// #cgo LDFLAGS: -lphp7.0
import "C"

10
engine/php7-static.go Normal file
View File

@ -0,0 +1,10 @@
// Copyright 2016 Alexander Palaistras. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
//
// +build static
package engine
// #cgo LDFLAGS: -ldl -lm -lssl -lcrypto -lreadline -lresolv -lpcre -lz -lxml2
import "C"

View File

@ -1,8 +1,6 @@
// Copyright 2016 Alexander Palaistras. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
//
// +build php7
package engine