126 lines
4.1 KiB
Bash
126 lines
4.1 KiB
Bash
# Maintainer: gym603 <gui_yuan_miao@163.com>
|
|
|
|
_realname=theano
|
|
pkgbase=mingw-w64-python-${_realname}
|
|
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
|
pkgver=1.0.4
|
|
pkgrel=1
|
|
pkgdesc="Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. (mingw-w64)"
|
|
arch=('any')
|
|
url="https://github.com/Theano/Theano"
|
|
license=('BSD')
|
|
_archive=Theano-rel-${pkgver}
|
|
source=(${_archive}.tar.gz::https://github.com/Theano/Theano/archive/rel-${pkgver}.tar.gz
|
|
0001-cmodule-obtain-mingw-w64-python-library.patch)
|
|
sha256sums=('DEB711BBB8A8F6021D4AD6F255A890DF51507CB1111DD3FC471EF40F23F7B88D'
|
|
'FD4A66AAC925ABDD9316BB142784C97E63D42EF590DDDDDF5D1771E69EA189DF')
|
|
noextract=(${_archive}.tar.gz)
|
|
|
|
_deps=('numpy' 'scipy' 'six')
|
|
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-setuptools")
|
|
|
|
# Helper macros to help make tasks easier #
|
|
apply_patch_with_msg() {
|
|
for _patch in "$@"
|
|
do
|
|
msg2 "Applying ${_patch}"
|
|
patch -b -p1 -i "${srcdir}/${_patch}"
|
|
done
|
|
}
|
|
|
|
prepare() {
|
|
cd "${srcdir}"
|
|
bsdtar zxf ${_archive}.tar.gz || true
|
|
|
|
cd "${srcdir}/${_archive}"
|
|
apply_patch_with_msg \
|
|
0001-cmodule-obtain-mingw-w64-python-library.patch
|
|
}
|
|
|
|
build() {
|
|
cd "${srcdir}"
|
|
rm -rf python{2,3}-build
|
|
for builddir in python{2,3}-build; do
|
|
cp -r ${_archive} ${builddir}
|
|
pushd $builddir
|
|
${MINGW_PREFIX}/bin/${builddir%-build} setup.py build
|
|
# ${MINGW_PREFIX}/bin/${builddir%-build} setup.py test
|
|
popd
|
|
done
|
|
}
|
|
|
|
package_python3-theano() {
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python3" "${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python3-}")
|
|
|
|
local _mingw_prefix=$(cygpath -am ${MINGW_PREFIX})
|
|
|
|
cd "${srcdir}/python3-build"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
|
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1
|
|
|
|
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
|
|
# fix python command in files
|
|
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
|
|
sed -e "s|/usr/bin/env |${MINGW_PREFIX}|g" \
|
|
-e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
|
|
done
|
|
|
|
for f in theano-cache theano-nose ; do
|
|
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,3}.exe
|
|
if [ -f "${pkgdir}${MINGW_PREFIX}"/bin/${f}.exe.manifest ]; then
|
|
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,3}.exe.manifest
|
|
sed -e "s|${f}|${f}3|g" -i "${pkgdir}${MINGW_PREFIX}"/bin/${f}3.exe.manifest
|
|
fi
|
|
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,3}-script.py
|
|
done
|
|
|
|
install -Dm644 doc/LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE"
|
|
}
|
|
|
|
package_python2-theano() {
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python2" "${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python2-}")
|
|
|
|
cd "${srcdir}/python2-build"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
|
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1
|
|
|
|
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
|
|
# fix python command in files
|
|
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
|
|
sed -e "s|/usr/bin/env |${MINGW_PREFIX}|g" \
|
|
-e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
|
|
done
|
|
|
|
for f in theano-cache theano-nose ; do
|
|
cp "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe
|
|
if [ -f "${pkgdir}${MINGW_PREFIX}"/bin/${f}.exe.manifest ]; then
|
|
cp "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe.manifest
|
|
sed -e "s|${f}|${f}2|g" -i "${pkgdir}${MINGW_PREFIX}"/bin/${f}2.exe.manifest
|
|
fi
|
|
cp "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}-script.py
|
|
done
|
|
|
|
install -Dm644 doc/LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
|
|
}
|
|
|
|
package_mingw-w64-i686-python2-theano() {
|
|
install=${_realname}2-${CARCH}.install
|
|
package_python2-theano
|
|
}
|
|
|
|
package_mingw-w64-i686-python3-theano() {
|
|
install=${_realname}3-${CARCH}.install
|
|
package_python3-theano
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python2-theano() {
|
|
install=${_realname}2-${CARCH}.install
|
|
package_python2-theano
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python3-theano() {
|
|
install=${_realname}3-${CARCH}.install
|
|
package_python3-theano
|
|
}
|