mirror of https://github.com/perkeep/perkeep.git
On Mac, automatically find the brew sqlite3.
Change-Id: Iafa852a414d4f87553bd51ee75fe077b0f5cea1d
This commit is contained in:
parent
f1bed0e3b2
commit
8c2195d5ce
13
make.go
13
make.go
|
@ -96,8 +96,7 @@ func main() {
|
||||||
log.Printf("SQLite not found. Either install it, or run make.go with --sqlite=false")
|
log.Printf("SQLite not found. Either install it, or run make.go with --sqlite=false")
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
// TODO: search for /usr/local/Cellar/sqlite/*/lib/pkgconfig for the user.
|
log.Printf("On OS X, run 'brew install sqlite3' and 'brew install pkg-config'")
|
||||||
log.Printf("On OS X, run 'brew install sqlite3' and set PKG_CONFIG_PATH=/usr/local/Cellar/sqlite/3.7.17/lib/pkgconfig/")
|
|
||||||
case "linux":
|
case "linux":
|
||||||
log.Printf("On Linux, run 'sudo apt-get install libsqlite3-dev' or equivalent.")
|
log.Printf("On Linux, run 'sudo apt-get install libsqlite3-dev' or equivalent.")
|
||||||
case "windows":
|
case "windows":
|
||||||
|
@ -426,7 +425,15 @@ func haveSQLite() bool {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("No pkg-config found. Can't determine whether sqlite3 is available, and where.")
|
log.Fatalf("No pkg-config found. Can't determine whether sqlite3 is available, and where.")
|
||||||
}
|
}
|
||||||
out, err := exec.Command("pkg-config", "--libs", "sqlite3").Output()
|
cmd := exec.Command("pkg-config", "--libs", "sqlite3")
|
||||||
|
if runtime.GOOS == "darwin" && os.Getenv("PKG_CONFIG_PATH") == "" {
|
||||||
|
matches, err := filepath.Glob("/usr/local/Cellar/sqlite/*/lib/pkgconfig/sqlite3.pc")
|
||||||
|
if err == nil && len(matches) > 0 {
|
||||||
|
cmd.Env = append(os.Environ(), "PKG_CONFIG_PATH=" + filepath.Dir(matches[0]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out, err := cmd.Output()
|
||||||
if err != nil && err.Error() == "exit status 1" {
|
if err != nil && err.Error() == "exit status 1" {
|
||||||
// This is sloppy (comparing against a string), but
|
// This is sloppy (comparing against a string), but
|
||||||
// doing it correctly requires using multiple *.go
|
// doing it correctly requires using multiple *.go
|
||||||
|
|
Loading…
Reference in New Issue