Using go implement of pkg-config.

400 views
Skip to first unread message

mattn

unread,
Mar 29, 2012, 1:41:15 AM3/29/12
to golan...@googlegroups.com
I saw a post in go-nus:


Certainly, pkg-config is depend on glib-2.0 and this is a issue for windows user, I guess. But go uses a part of functions that pkg-config have.
How about include pkg-gonfig into go tool?

# go tool pkg-config --cflags --libs sqlite3

This is pkg-goncfig that I written just now.


Thanks.

Benny Siegert

unread,
Mar 29, 2012, 5:05:24 AM3/29/12
to golang-dev
On Thu, Mar 29, 2012 at 07:41, mattn <matt...@gmail.com> wrote:
> Certainly, pkg-config is depend on glib-2.0 and this is a issue for windows
> user, I guess. But go uses a part of functions that pkg-config have.
> How about include pkg-gonfig into go tool?

How about making it installable by go get? Somebody who has trouble
installing the "real" pkg-config can just install the Go version into
his bin directory. When the go tool is running pkg-config, it could
use either the C or the Go version -- assuming the invocation is the
same.

> # go tool pkg-config --cflags --libs sqlite3
>
> This is pkg-goncfig that I written just now.
>
> https://gist.github.com/2233549

Looks very nice, thanks for this!

I think that you may be able to simplify the key/value parsing a bit
if you use strings.SplitN(line, "=", 2) instead of a regexp.

--Benny.

--
The first essential in chemistry is that you should perform practical
work and conduct experiments, for he who performs not practical work
nor makes experiments will never attain the least degree of mastery.
        -- Abu Musa Jabir ibn Hayyan (721-815)

roger peppe

unread,
Mar 29, 2012, 6:24:11 AM3/29/12
to mattn, golan...@googlegroups.com

BTW if you need gnu flag semantics, you might want
to use launchpad.net/gnuflag, which has almost exactly
the same API as the standard flag package.

mattn

unread,
Mar 29, 2012, 6:40:36 AM3/29/12
to golan...@googlegroups.com, mattn
nice!

I wrote getopt in go ago, But it don't support getopt_long. So I had feeling unsatisfactory.


I'll use it in next. Thanks.
Reply all
Reply to author
Forward
0 new messages