msys2로 PKGBUILD를 쓸 때 cmake를 사용할 때는 인수 전개에 주의를.

문제



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 작은 자료집 - Qiita
  • bash broken : cannnot escape * · Issue #1347 · Alexpux/MINGW-packages

  • 에 있듯이, msys2는 인수 전개를 실시하기 (위해)때문에, CMAKE_INSTALL_PREFIXC:\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
    

    License



    CC BY 4.0

    좋은 웹페이지 즐겨찾기