Skip to content

Commit

Permalink
[libmad] merge updates from vcpkg upstream to overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Sep 21, 2023
1 parent 5f1e4ab commit da7c834
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
17 changes: 12 additions & 5 deletions overlay/ports/libmad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ set(SOURCES
version.h
)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mad.pc.in" "${PROJECT_BINARY_DIR}/mad.pc" @ONLY)
install(
FILES "${PROJECT_BINARY_DIR}/mad.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
add_library(
mad
${SOURCES}
Expand All @@ -44,14 +49,15 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "(^i.86$)")
target_compile_definitions(mad
PRIVATE FPM_INTEL
)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|^(aarch64|arm64)")
target_compile_definitions(mad
PRIVATE FPM_64BIT
)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
target_compile_definitions(mad
PRIVATE FPM_ARM
)
# This fails with "error: invalid instruction" on armv7-a
#elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
# target_compile_definitions(mad
# PRIVATE FPM_ARM
# )
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
target_compile_definitions(mad
PRIVATE FPM_MIPS
Expand All @@ -78,3 +84,4 @@ install(
FILES mad.h
DESTINATION include
)

10 changes: 10 additions & 0 deletions overlay/ports/libmad/mad.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=@PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: mad
Description: MPEG audio decoder library
Version: @VERSION@
Libs: -L${libdir} -lmad
Cflags: -I${includedir}
9 changes: 8 additions & 1 deletion overlay/ports/libmad/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()

vcpkg_from_sourceforge(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -15,14 +17,19 @@ vcpkg_from_sourceforge(
#The archive only contains a Visual Studio 6.0 era DSP project file, so use a custom CMakeLists.txt
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

file(COPY "${CMAKE_CURRENT_LIST_DIR}/mad.pc.in" DESTINATION "${SOURCE_PATH}")

#Use the msvc++ config.h header
file(COPY "${SOURCE_PATH}/msvc++/config.h" DESTINATION "${SOURCE_PATH}")

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DVERSION=${VERSION}"
)

vcpkg_cmake_install()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()

file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Expand Down

0 comments on commit da7c834

Please sign in to comment.