[mpg123] Allow cross-compiling, fix previous builds tainting rebuilds (#11535)

* [mpg123] Allow cross-compiling, fix previous builds tainting rebuilds

* [mpg123] Rewrite to use vcpkg_configure_make

* Update ports/mpg123/portfile.cmake

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* [mpg123] Use vcpkg_execute_required_process

* [mpg123] Bump CONTROL version

* [mpg123] Remove unneeded legacy lines and strip out trailing newline from dumpmachine

* pre-install yasm on OSX.

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
This commit is contained in:
Kevin Lu 2020-08-01 16:56:56 -04:00 committed by GitHub
parent 021db935f6
commit 5512eafd80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 86 deletions

View File

@ -1,4 +1,5 @@
Source: mpg123
Version: 1.25.8-12
Version: 1.25.8
Port-Version: 13
Homepage: https://sourceforge.net/projects/mpg123/
Description: mpg123 is a real time MPEG 1.0/2.0/2.5 audio player/decoder for layers 1, 2 and 3 (MPEG 1.0 layer 3 also known as MP3).

View File

@ -116,97 +116,38 @@ elseif(VCPKG_TARGET_IS_WINDOWS)
${SOURCE_PATH}/src/libmpg123/mpg123.h.in
DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
file(REMOVE_RECURSE ${SOURCE_PATH}/build/debug)
file(REMOVE_RECURSE ${SOURCE_PATH}/build/release)
################
# Debug build
################
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process(
COMMAND "${SOURCE_PATH}/configure" --prefix=${SOURCE_PATH}/build/debug --enable-debug=yes --enable-static=yes --disable-dependency-tracking --with-default-audio=coreaudio --with-module-suffix=.so
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME config-${TARGET_TRIPLET}-dbg
)
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done.")
message(STATUS "Installing ${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process(
COMMAND make -j install
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME build-${TARGET_TRIPLET}-dbg
)
message(STATUS "Installing ${TARGET_TRIPLET}-dbg done.")
################
# Release build
################
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process(
COMMAND make distclean
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME config-${TARGET_TRIPLET}-dbg
)
vcpkg_execute_required_process(
COMMAND "${SOURCE_PATH}/configure" --prefix=${SOURCE_PATH}/build/release --enable-static=yes --disable-dependency-tracking --with-default-audio=coreaudio --with-module-suffix=.so
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME config-${TARGET_TRIPLET}-rel
)
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done.")
message(STATUS "Installing ${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process(
COMMAND make -j install
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME build-${TARGET_TRIPLET}-rel
)
message(STATUS "Installing ${TARGET_TRIPLET}-rel done.")
file(
INSTALL
"${SOURCE_PATH}/build/debug/include/fmt123.h"
"${SOURCE_PATH}/build/debug/include/mpg123.h"
"${SOURCE_PATH}/build/debug/include/out123.h"
DESTINATION
${CURRENT_PACKAGES_DIR}/include
elseif(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_LINUX)
set(MPG123_OPTIONS
--disable-dependency-tracking
)
if(EXISTS "${SOURCE_PATH}/build/debug/lib64/libmpg123.a")
file(
INSTALL
"${SOURCE_PATH}/build/debug/lib64/libmpg123.a"
"${SOURCE_PATH}/build/debug/lib64/libout123.a"
DESTINATION
${CURRENT_INSTALLED_DIR}/debug/lib
# Find cross-compiler prefix
if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
endif()
if(CMAKE_C_COMPILER)
vcpkg_execute_required_process(
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME dumpmachine-${TARGET_TRIPLET}
)
else()
file(
INSTALL
"${SOURCE_PATH}/build/debug/lib/libmpg123.a"
"${SOURCE_PATH}/build/debug/lib/libout123.a"
DESTINATION
${CURRENT_INSTALLED_DIR}/debug/lib
file(READ ${CURRENT_BUILDTREES_DIR}/dumpmachine-${TARGET_TRIPLET}-out.log MPG123_HOST)
string(REPLACE "\n" "" MPG123_HOST "${MPG123_HOST}")
message(STATUS "Cross-compiling with ${CMAKE_C_COMPILER}")
message(STATUS "Detected autoconf triplet --host=${MPG123_HOST}")
set(MPG123_OPTIONS
--host=${MPG123_HOST}
${MPG123_OPTIONS}
)
endif()
if(EXISTS "${SOURCE_PATH}/build/release/lib64/libmpg123.a")
file(
INSTALL
"${SOURCE_PATH}/build/release/lib64/libmpg123.a"
"${SOURCE_PATH}/build/release/lib64/libout123.a"
DESTINATION
${CURRENT_PACKAGES_DIR}/lib
)
else()
file(
INSTALL
"${SOURCE_PATH}/build/release/lib/libmpg123.a"
"${SOURCE_PATH}/build/release/lib/libout123.a"
DESTINATION
${CURRENT_PACKAGES_DIR}/lib
)
endif()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS ${MPG123_OPTIONS}
)
vcpkg_install_make()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
endif()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -22,6 +22,7 @@ jobs:
brew list libtool || brew install libtool
brew list bison || brew install bison
brew list gfortran || brew cask install gfortran
brew list yasm || brew install yasm
displayName: 'Install brew dependencies'
- bash: |
sudo mkdir /Users/vagrant/Data/downloads || 0