diff options
author | Michel Zou | 2016-12-29 16:24:21 +0100 |
---|---|---|
committer | Michel Zou | 2016-12-29 16:24:21 +0100 |
commit | 8f2f85d855b346ab23fedb3365f31abacfdbaaf2 (patch) | |
tree | 0a257fdebbcaf4cadcd60a15add2b370419c4e3a | |
download | aur-8f2f85d855b346ab23fedb3365f31abacfdbaaf2.tar.gz |
1.9.8
-rw-r--r-- | .SRCINFO | 21 | ||||
-rw-r--r-- | PKGBUILD | 68 | ||||
-rw-r--r-- | theinterp.patch | 60 |
3 files changed, 149 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..00b830456fa6 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,21 @@ +# Generated by mksrcinfo v8 +# Thu Dec 29 15:24:21 UTC 2016 +pkgbase = mingw-w64-hqp + pkgdesc = A solver for sparse nonlinear optimization (mingw-w64) + pkgver = 1.9.8 + pkgrel = 1 + url = http://omuses.github.io/hqp + arch = any + license = LGPL2 + makedepends = mingw-w64-gcc + depends = mingw-w64-tcl + options = !buildflags + options = staticlibs + options = !strip + source = https://github.com/omuses/hqp/archive/v1.9.8.tar.gz + source = theinterp.patch + sha256sums = 46a0fe3721ec1192279594c321e8d33a72e0ff5cf9a1c868aa199e8ea743d103 + sha256sums = SKIP + +pkgname = mingw-w64-hqp + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..ccc752815651 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,68 @@ +pkgname=mingw-w64-hqp +pkgver=1.9.8 +pkgrel=1 +pkgdesc="A solver for sparse nonlinear optimization (mingw-w64)" +arch=('any') +url="http://omuses.github.io/hqp" +license=('LGPL2') +depends=('mingw-w64-tcl') +makedepends=('mingw-w64-gcc') +options=('!buildflags' 'staticlibs' '!strip') +source=("https://github.com/omuses/hqp/archive/v${pkgver}.tar.gz" + theinterp.patch) +sha256sums=('46a0fe3721ec1192279594c321e8d33a72e0ff5cf9a1c868aa199e8ea743d103' + SKIP) + +_architectures="i686-w64-mingw32 x86_64-w64-mingw32" + + +prepare() { + cd "${srcdir}/hqp-${pkgver}" + sed -i 's|SHLIB_SUFFIX=".so"|SHLIB_SUFFIX=".dll"|g' configure + + sed -i 's|MES_DEFS=""|MES_DEFS="-DMESCH_API=__declspec\\(dllexport\\)"|g' configure + sed -i 's|IF_DEFS=""|IF_DEFS="-DIF_API=__declspec\\(dllexport\\)"|g' configure + sed -i 's|HQP_DEFS=""|HQP_DEFS="-DHQP_API=__declspec\\(dllexport\\)"|g' configure + sed -i 's|OMU_DEFS=""|OMU_DEFS="-DOMU_API=__declspec\\(dllexport\\)"|g' configure + sed -i 's|ODC_DEFS=""|ODC_DEFS="-DMESCH_API=__declspec\\(dllexport\\) -DIF_API=__declspec\\(dllexport\\) -DHQP_API=__declspec\\(dllexport\\) -DOMU_API=__declspec\\(dllexport\\)"|g' configure + + # fix undefined references to theInterp + patch -p1 -i "${srcdir}"/theinterp.patch + + # generate import libs + sed -i "s|\$(MKLIB_SUFFIX) \$(OBJS)|\$(MKLIB_SUFFIX) \$(OBJS) -Wl,--out-implib,\$(LIB_PREFIX)\$(LIBRARY).dll.a|g" omu/Makefile hqp/Makefile +} + +build() { +# cd "${srcdir}/hqp-${pkgver}" + for _arch in ${_architectures}; do + # does not support out-of-source builds + rm -rf "${srcdir}"/hqp-${pkgver}-build-${_arch} + cp -r "${srcdir}"/hqp-${pkgver} "${srcdir}"/hqp-${pkgver}-build-${_arch} + pushd "${srcdir}"/hqp-${pkgver}-build-${_arch} + + # cannot use mingw-w64-configure + export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" + export CXXFLAGS=${CFLAGS} + ./configure --host=${_arch} --prefix=/usr/${_arch}-mingw32 --enable-shared --with-tcl=/usr/${_arch}/lib --with-tclinclude=/usr/${_arch}/include --target=MINGW64 --disable-gmalloc + + # run through wine + sed -i "s|./tpc -ts 80|${_arch}-wine ./tpc -ts 80|g" hqp/Makefile + sed -i "s|../hqp/tpc -ts 80|${_arch}-wine ../hqp/tpc -ts 80|g" omu/Makefile + + make TCL_STUB_LIB=/usr/${_arch}/lib/libtclstub86.a CC=${_arch}-gcc SHLIB_SUFFIX='.dll' + popd + done +} + +package() { + for _arch in ${_architectures}; do + cd "${srcdir}/hqp-${pkgver}-build-${_arch}" + make INSTALL_PREFIX="${pkgdir}"/usr/${_arch} install + install -d "$pkgdir"/usr/${_arch}/bin/ + mv "$pkgdir"/usr/${_arch}/lib/*.dll "$pkgdir"/usr/${_arch}/bin/ + cp lib/*.dll.a "$pkgdir"/usr/${_arch}/lib/ + ${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll + ${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a + done +} diff --git a/theinterp.patch b/theinterp.patch new file mode 100644 index 000000000000..2237a56e5fe7 --- /dev/null +++ b/theinterp.patch @@ -0,0 +1,60 @@ +diff -ur hqp-1.9.8.orig/omu/Omu.h hqp-1.9.8/omu/Omu.h +--- hqp-1.9.8.orig/omu/Omu.h 2016-12-29 13:19:08.977071743 +0100 ++++ hqp-1.9.8/omu/Omu.h 2016-12-29 13:21:10.797077859 +0100 +@@ -35,7 +35,11 @@ + /* include underlying HQP */ + #include <Hqp.h> + ++static Tcl_Interp *Omu_Interp__; ++ + /** initialize Tcl module Omuses */ + extern "C" OMU_API int Omu_Init(Tcl_Interp *interp); + ++extern "C" Tcl_Interp *Omu_GetInterp(); ++ + #endif +diff -ur hqp-1.9.8.orig/omu/Omu_Init.C hqp-1.9.8/omu/Omu_Init.C +--- hqp-1.9.8.orig/omu/Omu_Init.C 2016-12-29 13:19:08.977071743 +0100 ++++ hqp-1.9.8/omu/Omu_Init.C 2016-12-29 13:28:12.097099013 +0100 +@@ -78,10 +78,19 @@ + //-------------------------------------------------------------------------- + const char *Omu_Version = VERSION; + ++// Omu_Interp__ = 0; ++ ++extern "C" Tcl_Interp *Omu_GetInterp() ++{ ++ return Omu_Interp__; ++} ++ + //-------------------------------------------------------------------------- + extern "C" int Hqp_Init(Tcl_Interp *interp); + extern "C" int OMU_API Omu_Init(Tcl_Interp *interp) + { ++ Omu_Interp__ = interp; ++ + // initialize stubs + if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { + return TCL_ERROR; +diff -ur hqp-1.9.8.orig/omu/Omu_Model.C hqp-1.9.8/omu/Omu_Model.C +--- hqp-1.9.8.orig/omu/Omu_Model.C 2016-12-29 13:19:08.980405076 +0100 ++++ hqp-1.9.8/omu/Omu_Model.C 2016-12-29 13:24:28.240421106 +0100 +@@ -225,6 +225,7 @@ + void Omu_Model::setup_model(double t0) + { + int i; ++ Tcl_Interp *theInterp = Omu_GetInterp(); + + // setup S-function + if (_SS) { +diff -ur hqp-1.9.8.orig/omu/Prg_DynamicEst.C hqp-1.9.8/omu/Prg_DynamicEst.C +--- hqp-1.9.8.orig/omu/Prg_DynamicEst.C 2016-12-29 13:19:08.980405076 +0100 ++++ hqp-1.9.8/omu/Prg_DynamicEst.C 2016-12-29 13:30:40.780439812 +0100 +@@ -227,6 +227,7 @@ + iv_set(_mdl_u_order, 1); + iv_zero(_mdl_y_active); + if (_mdl_is_fmu) { ++ Tcl_Interp *theInterp = Omu_GetInterp(); + // take over default values from model description + if(Tcl_VarEval(theInterp, "mdl_p_nominal ${::fmu::", _mdl_name, + "::parameterNominalValues}", NULL) != TCL_OK) |