Visitar URL original
MSYS2 MinGW package · Issue #165 · cginternals/glbinding · GitHub
Skip to content

MSYS2 MinGW package #165

Open
Open

Description

@nazar554

Hello, I am the maintainer of glbinding package in MSYS2. After updating this package to 2.0.0 I have found that I can no longer build and install both static and shared libraries side by side.
Problem is in glbinding-export.cmake:

...
# Create imported target glbinding::glbinding
add_library(glbinding::glbinding SHARED IMPORTED) # This should be UNKNOWN 
...

Current package installs just shared libraries. I am making a split package now.
MSYS2 uses pacman, so here is my PKGBUILD:

# Maintainer: Nazar Mishturak <nazar m x at gmail dot com>

_realname=glbinding
pkgbase="mingw-w64-${_realname}"
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-static"
         )
pkgver=2.0.0
pkgrel=2
arch=('any')
url='https://github.com/cginternals/glbinding'
pkgdesc="A C++ binding for the OpenGL API, generated using the gl.xml specification (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-glfw") # Required for tools
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-doxygen")
license=('MIT')
# Is this needed? If yes how to make it work? Pacman detects file conflict anyway
#conflicts_mingw-w64-x86_64-glbinding=("${MINGW_PACKAGE_PREFIX}-${_realname}-static")
#conflicts_mingw-w64-i686-glbinding=("${MINGW_PACKAGE_PREFIX}-${_realname}-static")
#conflicts_mingw-w64-x86_64-glbinding-static=("${MINGW_PACKAGE_PREFIX}-${_realname}")
#conflicts_mingw-w64-i686-glbinding-static=("${MINGW_PACKAGE_PREFIX}-${_realname}")
options=('strip' 'staticlibs' 'docs')

source=(${_realname}-${pkgver}.tar.gz::"https://github.com/cginternals/glbinding/archive/v${pkgver}.tar.gz"
        'mingw-unix-layout.patch'
        'config-export-location.patch')
sha256sums=('105d8c2d6e345ccd2b49a1aaf3ce1d5fb2845d89c21c6ed3b655d42611b78662'
            '4d3960a529d6b76e5d63afbaab1376b687f8cc8899e3d5f10a17b3a18cf29ef5'
            '76bee25b5647806a397ef1ec0104851031b4a392aec9c97bb99380efe3051e6a')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  # sed -i 's/$/\r/' "${srcdir}/mingw-unix-layout.patch"
  patch -p1 -i "${srcdir}/mingw-unix-layout.patch"
  patch -p1 -i "${srcdir}/config-export-location.patch"
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"

  local BUILD_TYPE="Release"
  if check_option "debug" "y"; then
    BUILD_TYPE="Debug"
  fi

  # Build shared libs
  [[ -d ${srcdir}/shared-${MINGW_CHOST} ]] && rm -rf ${srcdir}/shared-${MINGW_CHOST}
  mkdir -p ${srcdir}/shared-${MINGW_CHOST}
  cd ${srcdir}/shared-${MINGW_CHOST}

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_C_COMPILER=${MINGW_CHOST}-gcc \
    -DCMAKE_CXX_COMPILER=${MINGW_CHOST}-g++ \
    -DOPTION_BUILD_EXAMPLES=OFF \
    -DOPTION_BUILD_TESTS=OFF \
    -DBUILD_SHARED_LIBS=ON \
    -DOPTION_BUILD_DOCS=ON \
    ../${_realname}-${pkgver}
  make

  # Build static libs
  [[ -d ${srcdir}/static-${MINGW_CHOST} ]] && rm -rf ${srcdir}/static-${MINGW_CHOST}
  mkdir -p ${srcdir}/static-${MINGW_CHOST}
  cd ${srcdir}/static-${MINGW_CHOST}

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_C_COMPILER=${MINGW_CHOST}-gcc \
    -DCMAKE_CXX_COMPILER=${MINGW_CHOST}-g++ \
    -DOPTION_BUILD_EXAMPLES=OFF \
    -DOPTION_BUILD_TESTS=OFF \
    -DBUILD_SHARED_LIBS=OFF \
    -DOPTION_BUILD_DOCS=ON \
    ../${_realname}-${pkgver}
  make
}

package_shared() {
  cd "${srcdir}/shared-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}

package_static() {
  cd "${srcdir}/static-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}

package_mingw-w64-x86_64-glbinding() {
  package_shared
}
package_mingw-w64-i686-glbinding() {
  package_shared
}

package_mingw-w64-x86_64-glbinding-static() {
  package_static
}
package_mingw-w64-i686-glbinding-static() {
  package_static
}

Any workaround possible? Or I should use split packaging?

Activity

  1. scheibel commented on Jan 11, 2022

    @scheibel
    Member

    From our side, it is intentional that you have to build glbinding either as dynamic library or as static library.
    Currently, you cannot have both in one build. This is the same with a release and a debug build, for which we use separate builds and packages as well.

    So, as of now, I suggest you use separate packages as well.
    However, if you want to package both a static and dynamic library into one package, you could use two build directories (as we use for PPA packages as well, https://github.com/cginternals/glbinding/blob/master/deploy/ubuntu-ppa/debian/rules#L14), but then, the CMake config scripts will conflict and we don't have added logic to let a user choose which build to use.

    A workaround is the use of additional prefixes or suffixes to the library names as we do with the debug builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions