問題
PKGBUILDを書いてmakepkg
してパッケージをインストールしたら、/msys64/msys64/mingw64
がinstall prefixになってしまった。/msys64/msys64/
とは一体・・・。
ビルド出力より抜粋
-- Install configuration: ""
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/msys64/mingw64/lib/liblpsolve55.dll.a
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/msys64/mingw64/bin/liblpsolve55.dll
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/msys64/mingw64/include/lpsolve/lp_bit.h
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/msys64/mingw64/include/lpsolve/lp_crash.h
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/msys64/mingw64/include/lpsolve/lp_explicit.h
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/msys64/mingw64/include/lpsolve/lp_fortify.h
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/msys64/mingw64/include/lpsolve/lp_Hash.h
原因
PKGBUILDのbuild()
でcmakeを呼び出していたが、
PKGBUILD_build()
${MINGW_PREFIX}/bin/cmake.exe \
-G"MSYS Makefiles" \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-DLIB_TYPE=SHARED \
../lp_solve_5.5
のように呼び出していた。このときMINGW_PREFIX
は/mingw64
である。
しかし、
にもあるように、msys2は引数展開を行うため、CMAKE_INSTALL_PREFIX
はC:\msys2\mingw64
になってしまう(msys2の場所依存)。
解決策
PKGBUILD_build()
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake.exe \
-G"MSYS Makefiles" \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-DLIB_TYPE=SHARED \
../lp_solve_5.5
展開を阻止しましょう。
ビルド出力より抜粋
-- Install configuration: ""
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/mingw64/lib/liblpsolve55.dll.a
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/mingw64/bin/liblpsolve55.dll
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/mingw64/include/lpsolve/lp_bit.h
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/mingw64/include/lpsolve/lp_crash.h
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/mingw64/include/lpsolve/lp_explicit.h
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/mingw64/include/lpsolve/lp_fortify.h
-- Installing: C:/msys64/home/yumetodo/patches/mingw-w64-lpsolve/pkg/mingw-w64-x86_64-lpsolve/mingw64/include/lpsolve/lp_Hash.h