msys2で、allegro 5のPKGBUILDを書いた。5.1.13固定のものは他にも公開されていたが、これは最新版(WIP, 2016/2/13現在5.1.14)用。 (20162)

  • コンパイラはgcc使用(migw-w64-x86_64-gcc)
  • ライブラリは下記に依存(不要なものはPKGBUILD内の depends=からはずしてください)

    • freetype
    • physfs
    • libvorbis
    • flac
    • dumb
    • libtheora
    • libjpeg-turbo

使い方

空のディレクトリに PKGBUILDを放り込んで、

$ cd <そこ>
$ makepkg-mingw

でパッケージが作成される。パッケージのファイル名は例えば、mingw-w64-x86_64-allegro5-git-5.1.14.r259.58360b3-1-x86_64.pkg.tar.xzとなる。

インストールするには、管理者権限で

# pacman -U mingw-w64-x86_64-allegro5-git-5.1.14.r259.58360b3-1-x86_64.pkg.tar.xz

新しいリビジョンのパッケージがあれば、-U すればアップデートされる。

アンインストールは

# pacman -Rs mingw-w64-x86_64-allegro5-git

PKGBUILD

# $Id: pkgbuild-mode.el,v 1.23 2007/10/20 16:02:14 juergen Exp $
# Maintainer: Ohi <ohi@example.com>
pkgbase=mingw-w64-allegro
pkgname=${MINGW_PACKAGE_PREFIX}-allegro-git
pkgver=5.1.14.r260.ae5f869
pkgrel=1
pkgdesc="a cross-platform library mainly aimed at video game and multimedia (mingw-w64)"
arch=(any)
url="http://liballeg.org/"
license=('ZLIB')
groups=()
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-cmake"
  "${MINGW_PACKAGE_PREFIX}-dumb"
  "${MINGW_PACKAGE_PREFIX}-gcc"
  "${MINGW_PACKAGE_PREFIX}-flac"
  "${MINGW_PACKAGE_PREFIX}-freetype"
  "${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
  "${MINGW_PACKAGE_PREFIX}-libpng"
  "${MINGW_PACKAGE_PREFIX}-libtheora"
  "${MINGW_PACKAGE_PREFIX}-libvorbis"
  "${MINGW_PACKAGE_PREFIX}-openal"
  "${MINGW_PACKAGE_PREFIX}-physfs"
  "${MINGW_PACKAGE_PREFIX}-pkg-config"
  )
depends=(
  "${MINGW_PACKAGE_PREFIX}-gcc-libs"
  )
checkdepends=()
optdepends=(
  "${MINGW_PACKAGE_PREFIX}-dumb: audio"
  "${MINGW_PACKAGE_PREFIX}-flac: audio"
  "${MINGW_PACKAGE_PREFIX}-freetype: font"
  "${MINGW_PACKAGE_PREFIX}-libjpeg-turbo: image"
  "${MINGW_PACKAGE_PREFIX}-libpng: image"
  "${MINGW_PACKAGE_PREFIX}-libtheora: image"
  "${MINGW_PACKAGE_PREFIX}-libvorbis: audio"
  "${MINGW_PACKAGE_PREFIX}-openal: audio"
  "${MINGW_PACKAGE_PREFIX}-physfs: physfs"
 )
provides=(${MINGW_PACKAGE_PREFIX}-allegro)
conflicts=(${MINGW_PACKAGE_PREFIX}-allegro)
replaces=()
backup=()
options=('strip' 'staticlibs')
install=
changelog=
source=(git+https://github.com/liballeg/allegro5.git)
md5sums=('SKIP')

pkgver() {
  local ver rev
  cd ${srcdir}/allegro5
  ver=$(grep set  CMakeLists.txt | grep ALLEGRO_VERSION | sed -r 's/(^[^0-9]*|[^0-9]*$)//g')
  rev=$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g'| sed -r 's/.*(r.*)/\1/')

  echo ${ver}.${rev}
}

build() {
  rm -fr build
  mkdir build
  cd build

  # prevent path conversion like /mingw64 -> S:/msys64/mingw64
  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  cmake -G"MSYS Makefiles" \
        -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
        -DWANT_MONOLITH=off \
        -DINSTALL_PKG_CONFIG_FILES=on \
        -DCMAKE_BUILD_TYPE=Release \
        -DWANT_EXAMPLES=off \
        -DWANT_DEMO=off \
          ../allegro5
        #-DCMAKE_SYSTEM_PREFIX_PATH:PATH=/mingw64/x86_64-w64-mingw32/ \
  make
}

package() {

  cd build

  # sed -ir 's|set[(][ ]*CMAKE_INSTALL_PREFIX[ ]*".:/[^"]*"[ ]*[)]|set(CMAKE_INSTALL_PREFIX "'"$(cygpath -m "$pkgdir")"'")|' cmake_install.cmake
  # make install

  make DESTDIR=${pkgdir} install
}

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