Skip to content

Commit

Permalink
[speex] Add linux and macOS support. (microsoft#15855)
Browse files Browse the repository at this point in the history
* [speex] Add linux and macOS support.

* [speex] Improve portfile.cmake

* update version record

Co-authored-by: JackBoosY <[email protected]>
  • Loading branch information
Hoikas and JackBoosY authored Jan 28, 2021
1 parent 09fbac7 commit 7f050e0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 19 deletions.
3 changes: 1 addition & 2 deletions ports/speex/CONTROL
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Source: speex
Version: 1.2.0
Port-Version: 7
Port-Version: 8
Homepage: https://github.com/xiph/speex
Description: Speex is an Open Source/Free Software patent-free audio compression format designed for speech.
Supports: !(linux | osx)
43 changes: 27 additions & 16 deletions ports/speex/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
vcpkg_fail_port_install(ON_TARGET "OSX" "Linux")
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND PATCHES "0001-make-pkg-config-lib-name-configurable.patch")
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO xiph/speex
REF Speex-1.2.0
SHA512 612dfd67a9089f929b7f2a613ed3a1d2fda3d3ec0a4adafe27e2c1f4542de1870b42b8042f0dcb16d52e08313d686cc35b76940776419c775417f5bad18b448f
HEAD_REF master
PATCHES
0001-make-pkg-config-lib-name-configurable.patch
PATCHES ${PATCHES}
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)
if(VCPKG_TARGET_IS_WINDOWS)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()

vcpkg_install_cmake()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/speex/speex.h"
"extern const SpeexMode"
"__declspec(dllimport) extern const SpeexMode"
)
endif()
else()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
AUTOCONFIG
)
vcpkg_install_make()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(READ "${CURRENT_PACKAGES_DIR}/include/speex/speex.h" _contents)
string(REPLACE "extern const SpeexMode" "__declspec(dllimport) extern const SpeexMode" _contents "${_contents}")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/speex/speex.h" "${_contents}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
endif()

vcpkg_fixup_pkgconfig()

file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5482,7 +5482,7 @@
},
"speex": {
"baseline": "1.2.0",
"port-version": 7
"port-version": 8
},
"speexdsp": {
"baseline": "1.2.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/s-/speex.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "eaa4e7b1a075051d8ba02bc67a89ae035be1b28c",
"version-string": "1.2.0",
"port-version": 8
},
{
"git-tree": "ee8363b22602ef2b0f74d4d43de88ed32457c4ba",
"version-string": "1.2.0",
Expand Down

0 comments on commit 7f050e0

Please sign in to comment.