You are not logged in.

#1 2018-10-24 17:20:42

gunar
Member
Registered: 2016-08-17
Posts: 3
Website

[SOLVED] How to make PKGBUILD install .so dependencies?

Not sure if I should post here or on StackOverflow so I did there first and am just linking it here now. Let me know if that was a wrong assumption. Thank you.

https://superuser.com/questions/1369661 … pendencies


---


I'm writing a PKGBUILD for [meetalva.io](https://meetalva.io) so I can submit it to AUR—so others can install it through `yaourt`.

The binary `Alva` has two library dependencies, `libnode.so` and `libffmpeg.so`, which I need to include otherwise I get `alva: error while loading shared libraries: libnode.so: cannot open shared object file: No such file or directory`.

I can't simply copy these two `.so` files into `/usr/bin`, so what's the best practice here? I feel like I want to copy the binary and `.so` files into `/usr/lib` then create a symlink `/usr/lib/alva-git/Alva` -> `/usr/bin/Alva` but I'm not managing to get the symlinking working.

Thanks in advance.

---


    _pkgname="alva"
    pkgname="${_pkgname}-git"
    pkgver=v0.8.0
    pkgrel=1
    pkgdesc="Create living prototypes with code components."
    arch=("i686" "x86_64")
    url="https://meetalva.io"
    license=('MIT')
    groups=()
    depends=(gconf libxss nss gtk3)
    makedepends=(git npm nodejs)
    optdepends=()
    provides=(alva)
    conflicts=(alva)
    replaces=()
    backup=()
    options=()
    install=
    changelog=
    source=("${pkgname}::git+http://github.com/meetalva/${_pkgname}.git")
    noextract=()
    md5sums=(SKIP)
    
    # [url]https://wiki.archlinux.org/index.php/VCS_package_guidelines[/url]
    pkgver() {
      cd "$srcdir/$pkgname"
    # Use latest tag
      git tags|tail -n 1
    }
    
    build() {
      cd "$pkgname"
      last_tag=$( git tags|tail -n 1 )
      git checkout $last_tag
      npm install
      npm run build
      npm run build:electron || true
    }
    
    package() {
      cd "$pkgname" # enter git repo
      install -D -m 644 LICENSE "${pkgdir}/usr/share/licenses/$pkgname/LICENSE"
      mkdir -p "${pkgdir}/usr/bin/"
      cp -f dist/linux-unpacked/Alva "${pkgdir}/usr/bin/alva"
    }

Last edited by gunar (2018-10-24 18:15:28)

Offline

#2 2018-10-24 17:34:23

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED] How to make PKGBUILD install .so dependencies?

If you want to post your question here, post your question here.  Don't expect us to follow a link somewhere else.

But it looks like the answer would be had if your read the wiki page on PKGBUILDs.  You list dependencies and makepkg installs them.

Although the question you ask on S.O. does not remotely resemble the title of this thread.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-10-24 17:48:18

gunar
Member
Registered: 2016-08-17
Posts: 3
Website

Re: [SOLVED] How to make PKGBUILD install .so dependencies?

Thanks, Trilby. Yeah there are two questions in it.

1. How can I figure out what's the exact dependency name that provides these files `libnode.so` and `libffmpeg.so`?

2. Is creating a bash script in `/usr/bin` the endorsed way to run binaries with direct dependencies? (cp'ing doesn't do it because the binary complains about the lack of these two .so files)

Offline

#4 2018-10-24 18:14:30

gunar
Member
Registered: 2016-08-17
Posts: 3
Website

Re: [SOLVED] How to make PKGBUILD install .so dependencies?

Answers

1. Just use electron as a package, set it as dependency, then use `electron` to call the `.asar` file, to be stored in `/usr/share/`

2. Yes, create a bash file there that calls electron

#!/bin/sh

exec electron /usr/share/alva/ "$@"

The issue is settled. Thank you.

Offline

#5 2018-10-24 22:29:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED] How to make PKGBUILD install .so dependencies?

Good work on that, I concur with both of the answers you came to.

In case you didn't find it alread, `pacman -F $filename` can identify the package that provides a given file/library.  This may be how you found that the `electron` package provides the libraries you needed.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2018-10-25 00:04:08

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How to make PKGBUILD install .so dependencies?

TBH, it was discovered due to waiting for me to provide this answer on superuser.com. smile

As I said there:

This is an Electron app, so you need to copy the *entire* `linux-unpacked/` directory to `/opt/alva/`, then make a symlink into `"${pkgdir}"/usr/bin/Alva` for the binary itself which is merely a renamed `electron` binary.

All the actual alva code will be in the `resources/app/` directory (or app.asar file in some cases). The ideal packaging method would be to simply use the system electron package (available in the [community] repository).

Install this app resources directory/file to e.g. `/usr/share/alva/` or `/usr/share/alva.asar` (if there are no compiled node modules) or `/usr/lib/alva/` (if there *are* compiled modules), then create a shell script wrapper for `/usr/bin/alva` which looks like this:

#!/bin/sh

exec electron /usr/share/alva/ "$@"

...

I know this because I've packaged electron software before, and I can recognize it a mile off. big_smile
Also I recognize libnode.so and libffmpeg.so, despite that our system electron package explicitly doesn't provide libffmpeg.so, since it is instead linked to the system libavcodec.so.58 libavformat.so.58 libavutil.so.56 (but it does have libnode.so)

...

I'd also like to offer the general PKGBUILD advice, to get rid of empty variables and arrays. You don't need to specify them, and they waste space and make it harder to read the important bits.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB