bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 60 forks source link

How to compile? #105

Closed pedroalbanese closed 3 years ago

pedroalbanese commented 3 years ago

Hi, how do I build it statically?

bugaevc commented 3 years ago

Hi!

What do you mean by building statically? If you mean linking wl-clipboard against libwayland-client and libc statically, then it's up to your system / pkg-config to provide a static version of them. wl-clipboard does not do anything special wrt static/dynamic linking: it just asks Meson to find wayland-client (Meson then goes and asks pkg-config which flags and libraries one has to use to link with libwayland-client):

https://github.com/bugaevc/wl-clipboard/blob/aa4633b894c3c5ae6053026529ec9288566060a6/src/meson.build#L1

pedroalbanese commented 3 years ago

I need the standalone binaries for armel, if it is not static it will not run on Android. I urgently need an equivalent to the xclip for Android terminal.

I mean, I would like to know what the gcc command is, so I can add the -static flag

bugaevc commented 3 years ago

Several things here don't work that way :slightly_smiling_face:

That all being said, you can pass -v to ninja to see the actual command (gcc something something...) it runs. And wl-clipboard is easy to build without Meson, too: just write a suitable config.h, pass all the C files to a compiler (using whatever flags you want!), link to libwayland-client somehow, done.

pedroalbanese commented 3 years ago

Android supports shared libs but the structure of directories differs, I used to compile things for mi Android with arm-linux-gnueabi-gcc/g++ tool. It works just if I make it -static.

root@cce:/tmp/wl-clipboard-master/build# ninja -v [1/2] cc -o src/wl-paste src/wl-paste.p/wl-paste.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group src/libwl-clipboard.a src/libgtk-primary-selection.a src/libwlr-data-control.a /usr/lib/x86_64-linux-gnu/libwayland-client.so -Wl,--end-group [2/2] cc -o src/wl-copy src/wl-copy.p/wl-copy.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group src/libwl-clipboard.a src/libgtk-primary-selection.a src/libwlr-data-control.a /usr/lib/x86_64-linux-gnu/libwayland-client.so -Wl,--end-group

I need to know what's the command to compile the executable..

pedroalbanese commented 3 years ago

Oh sorry, now I saw that there are two outputs.

pedroalbanese commented 3 years ago

if I add the flag -static:

root@cce:/tmp/wl-clipboard-master/build# cc -o src/wl-paste src/wl-paste.p/wl-paste.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group src/libwl-clipboard.a src/libgtk-primary-selection.a src/libwlr-data-control.a /usr/lib/x86_64-linux-gnu/libwayland-client.so -Wl,--end-group -s -static /usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libwayland-client.so' collect2: error: ld returned 1 exit status

bugaevc commented 3 years ago

Yes, exactly, you'd need to get/build yourself a static version of libwayland-client.

pedroalbanese commented 3 years ago

Wow, forget it then haha. Thanks

Do you know the path of /dev/Clipborad on Android?

bugaevc commented 3 years ago

There's no /dev/clipboard on Android either :slightly_smiling_face:

Clipboard is just a service that you can access via Binder, just like the rest of them. See e.g. here about doing it from the terminal.