opened
xyproto
username_0
Hi,

I'm trying to package OpenTimelineIO for Arch Linux.

Looking at `setup.py` and the CMake files, it looks like OpenTimelineIO (python files that go in site-packages + C++ include files + libraries) is meant to be installed either into /home somewhere for a user, or directly onto the system into / somewhere. However, when packaging for a Linux distro there are slightly different needs, since files needs to be able to be packaged into a directory that will later be installed to `/`. Usually, this can be solved by flags to `setup.py` or flags to `cmake`, but I was not successful in convincing OpenTimelineIO to install to a directory, meant for being installed to the system root later.

Is there a flag I have overlooked?

Here is my best attempt so far, at a WIP `PKGBUILD` file. I assume the intention is that only `setup.py` or `cmake` should be called, but I tried a few different things.

```bash
# Maintainer: Alexander F. Rødseth <username_0@archlinux.org>

pkgname=python-opentimelineio
pkgver=0.12.1
pkgrel=1
pkgdesc='API and interchange format for editorial timeline information'
arch=(any)
license=('APACHE')
makedepends=(cmake git python-pip python-setuptools setconf)
url='https://github.com/PixarAnimationStudios/OpenTimeLineIO'
source=("git+$url#commit=cc9c067cf8482d9e703c480f31df9d22198d076a") # tag: v0.12.1
md5sums=(SKIP)

prepare() {
  setconf OpenTimeLineIO/setup.py _ctx.cxx_install_root "'""$pkgdir""'"
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  setconf OpenTimeLineIO/setup.py _ctx.install_usersite "'""$pkgdir$site_packages""'"
}

build() {
  mkdir -p build
  cd build
  cmake "$srcdir/OpenTimeLineIO" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_C_FLAGS="$CFLAGS -fPIC -w" \
    -DPYTHON_EXECUTABLE=/usr/bin/python \
    -DOTIO_PYTHON_INSTALL:BOOL=ON \
    -G Ninja
  ninja
}

package() {
  DESTDIR="$pkgdir" ninja -C build install
  cd "$srcdir/OpenTimeLineIO"
  python setup.py install --cxx-install-root="$pkgdir/usr" --user
}

# vim: ts=2 sw=2 et:
```

Attaching the `stdout` and `stderr` I get when running the above:

[out.log](https://github.com/PixarAnimationStudios/OpenTimelineIO/files/4697866/out.log)
[err.log](https://github.com/PixarAnimationStudios/OpenTimelineIO/files/4697867/err.log)

The resulting directory structure in the package directory is this one (without ie. `otioconvert`).

[pkgdir.txt](https://github.com/PixarAnimationStudios/OpenTimelineIO/files/4697878/pkgdir.txt)

Any help or tips are warmly welcome.

Best regards,
Alexander F. Rødseth
Not installing for a user, not installing for root, but packaging for a Linux distro
issue
created
ssteinbach
username_1
@username_0 sorry for the late reply - I think the #764 PR might make what you're trying to do easier.  Does that look like it might help?
comment
created
xyproto
username_0
@username_1 Yes, that looks helpful. I'll give it a shot.
comment