This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Statically link to libxml2 when
static_build
tag is defined (#95)
* Statically link to libxml2 when `static_build` tag is defined There's an unofficial convention in the Go ecosystem that the `static_build` tag indicates a desire to link statically to external libraries detected with pkg-config - examples include: * [LXC](https://github.com/lxc/go-lxc/blob/ccae595aa49e779f7ecc9250329967aa546acd31/linking_static.go) * [containers-storage](https://github.com/containers/storage/blob/6c835719e98e403dae4a437e3809e247c9561b29/pkg/devicemapper/devmapper_wrapper_static.go) Support this convention by invoking pkg-config with the `--static` option if the `static_build` tag is defined, or without if it isn't. * Add linking configuration CI test for Ubuntu * Simplify goflags * Update ci.yml See if removing this key works * Update ci.yml --------- Co-authored-by: lestrrat <49281+lestrrat@users.noreply.github.com>
- Loading branch information
1 parent
99c7102
commit c5fabe2
Showing
6 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// +build !static_build | ||
|
||
package clib | ||
|
||
// #cgo pkg-config: libxml-2.0 | ||
import "C" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// +build static_build | ||
|
||
package clib | ||
|
||
// #cgo pkg-config: --static libxml-2.0 | ||
// #cgo LDFLAGS: -static | ||
import "C" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/lestrrat-go/libxml2" | ||
) | ||
|
||
func main() { | ||
doc, err := libxml2.ParseHTMLString(`<html><body><h1>Hello, World!</h1><p>Lorem Ipsum</p></body></html>`) | ||
if err != nil { | ||
panic(err) | ||
} | ||
doc.Free() | ||
} |