Coder Social home page Coder Social logo

Comments (10)

progandy avatar progandy commented on July 20, 2024 2

Here is a working PKGBUILD that downloads the release version and does not use git at all. Feel free to use it without attribution, I consider it public domain / CC0.

The changes in prepare should probably fixed directly. Maybe skip version_from_git if VERSION is set or let it fail gracefully. The models listed in CMakeLIsts have to be fixed as well.

pkgname=obs-backgroundremoval
pkgver=0.2.4_beta
_ONNXRUNTIME_FILE=onnxruntime-linux-x64-1.7.0.tgz
_onnxdir=onnxruntime-linux-x64-1.7.0
_bgdir=$pkgname-${pkgver//_/-}
pkgrel=1
arch=(x86_64)
url='https://github.com/royshil/obs-backgroundremoval'
pkgdesc="Background removal plugin for OBS studio (precomopiled onnxruntime)"
license=(MIT custom)
depends=(obs-studio opencv)
makedepends=(cmake)
source=("${_bgdir}.tar.gz::https://github.com/royshil/$pkgname/archive/refs/tags/v${pkgver//_/-}.tar.gz" 
        "https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/$_ONNXRUNTIME_FILE")
sha256sums=('5e66cfc45827581bc8da50a775d3e8601beb4aec72d42f0efc4d3e403161ddc1'
            '0345f45f222208344406d79a6db3280ed2ccc884dc1e064ce6e6951ed4c70606')

prepare() {
  # build from archive, not git. Version set during build()
  sed -i "s/^version_from_git/#&/" $_bgdir/CMakeLists.txt

  # fix models listed in cmake
  sed -i '/^.*file(GLOB/i file(GLOB onnxmodels data/*.onnx)' $_bgdir/CMakeLists.txt
  sed -i 's/"data\/SINet_Softmax.onnx"/${onnxmodels}/' $_bgdir/CMakeLists.txt
}

build() {
  cd "$_bgdir"
  # no way to set beta suffix
  # set rpath to avoid installing onnxruntime globally
  cmake -B build -DVERSION="${pkgver//_*/.0}" -DobsIncludePath=/usr/include/obs/ \
           -DCMAKE_INSTALL_PREFIX:PATH=/usr \
           -DOnnxruntime_INCLUDE_DIRS="$srcdir/$_onnxdir/include/" -DOnnxruntime_LIBRARIES="$srcdir/$_onnxdir/lib/libonnxruntime.so" \
           -DOnnxruntime_INCLUDE_DIR="$srcdir/$_onnxdir/include/" \
           -DCMAKE_INSTALL_RPATH="/usr/lib/obs-backgroundremoval"
  cd build
  make
}

package() {
  make -C "$_bgdir/build" DESTDIR="$pkgdir" install
  install -Dt "$pkgdir/usr/share/licenses/obs-backgroundremoval" "$_bgdir/LICENSE"

  # install onnxruntimey
  cd "$_onnxdir"
  install -Dt "$pkgdir/usr/share/licenses/obs-backgroundremoval/onnxruntime" \
          LICENSE  Privacy.md  README.md  ThirdPartyNotices.txt
  install -Dt "$pkgdir/usr/lib/obs-backgroundremoval" lib/*
}

from obs-backgroundremoval.

royshil avatar royshil commented on July 20, 2024

you can always give cmake the directories explicitly e.g.

$ cmake .. -DobsIncludePath=/usr/local/include/libobs -DobsLibPath=/usr/local/lib

from obs-backgroundremoval.

progandy avatar progandy commented on July 20, 2024

Remove external/FindLibObs.cmake and try again, this file should only be required for osx.

from obs-backgroundremoval.

ngoonee avatar ngoonee commented on July 20, 2024

Hi,
This is what happens when I try to build on Archlinux following the README instructions:

Hi, do let me know if you were successful (or better yet try to provide a PKGBUILD). Haven't tried it myself due to time constraints but I will get round to it at some point.

from obs-backgroundremoval.

savy-91 avatar savy-91 commented on July 20, 2024

I am getting the same error on Ubuntu 21.04

from obs-backgroundremoval.

royshil avatar royshil commented on July 20, 2024

I've added a PKGBUILD for making the package
@ngoonee ☝️

from obs-backgroundremoval.

morrolinux avatar morrolinux commented on July 20, 2024

Awesome work @royshil !
However I had to

sudo ln -s /usr/local/share/obs/obs-plugins/obs-backgroundremoval /usr/share/obs/obs-plugins/obs-backgroundremoval
sudo ln -s /usr/local/lib/obs-plugins/obs-backgroundremoval.so /usr/lib/obs-plugins/obs-backgroundremoval.so

Because apparently OBS plugins in Archlinux are loaded from /usr/lib rather than /usr/local so you might want to correct that in the Makefile or add those two lines in the pkgbuild IDK.

Thanks for the awesome work :)

from obs-backgroundremoval.

royshil avatar royshil commented on July 20, 2024

@morrolinux can you plz make a PR with changes to the PKGBUILD?

from obs-backgroundremoval.

ngoonee avatar ngoonee commented on July 20, 2024

The provided PKGBUILD by @progandy works for me. Thanks!

from obs-backgroundremoval.

royshil avatar royshil commented on July 20, 2024

the changes have been incorporated into the PKGBUILD. Thank you everyone!

from obs-backgroundremoval.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.