diff --git a/README.md b/README.md index 482591f..5b7f36d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/engine/php5.go b/engine/php5.go index 1e3ae77..8a804f7 100644 --- a/engine/php5.go +++ b/engine/php5.go @@ -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 diff --git a/engine/php7-debian.go b/engine/php7-debian.go index 36f0c61..674dce2 100644 --- a/engine/php7-debian.go +++ b/engine/php7-debian.go @@ -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" diff --git a/engine/php7-static.go b/engine/php7-static.go new file mode 100644 index 0000000..a3eaf43 --- /dev/null +++ b/engine/php7-static.go @@ -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" diff --git a/engine/php7.go b/engine/php7.go index 8376c9c..1a4d60f 100644 --- a/engine/php7.go +++ b/engine/php7.go @@ -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