pekim / gobbi

gobbi is a set of generated Go bindings for gtk et al.
MIT License
28 stars 3 forks source link

Feature request: libhandy support #14

Open ddevault opened 4 years ago

ddevault commented 4 years ago

https://source.puri.sm/Librem5/libhandy

Would be nice if bindings to libhandy could be generated for gobbi.

pekim commented 4 years ago

I'll certainly look in to this, but it might not be for a week or two.

ddevault commented 4 years ago

Of course. Happy holidays!

ddevault commented 4 years ago

Bump?

pekim commented 4 years ago

I can't easily install install all of libhandy's build dependencies locally. So I'm resorting to exploring this in a docker image.

A (rather crude) Dockerfile results in generation of some plausible looking files in /gobbi/lib/handy/.

FROM ubuntu:19.10

ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install -y \
  git \
  wget \
  libatk1.0-dev \
  libcairo2-dev \
  libglib2.0-dev \
  libgtk-3-dev \
  libgtksourceview-3.0-dev \
  libpango1.0-dev \
  libwebkit2gtk-4.0-dev \
  xvfb

# install go
RUN wget https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.13.6.linux-amd64.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"

# clone and build libhandy
RUN git clone https://source.puri.sm/Librem5/libhandy.git /libhandy
WORKDIR /libhandy
RUN apt-get build-dep -y .
RUN meson . _build
RUN ninja -C _build
RUN ninja -C _build install

# clone gobbi
RUN git clone https://github.com/pekim/gobbi.git /gobbi
# copy libhandy's gir file
WORKDIR /gobbi
RUN cp /libhandy/_build/src/Handy-0.0.gir internal/gir-files/
# include libhandy in generation
RUN sed -i '/{version: "4.0", name: "WebKit2"},/a\\t{version: "0.0", name: "Handy"},' internal/cmd/generate/main.go
# generate and test
WORKDIR /gobbi/internal
RUN ./gobbi generate
# RUN ./gobbi test

So it looks promising so far.