diff --git a/overlay/ports/libmad/CMakeLists.txt b/overlay/ports/libmad/CMakeLists.txt index f2eb811fbb3a45..5ee54a8cda4168 100644 --- a/overlay/ports/libmad/CMakeLists.txt +++ b/overlay/ports/libmad/CMakeLists.txt @@ -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} @@ -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 @@ -78,3 +84,4 @@ install( FILES mad.h DESTINATION include ) + diff --git a/overlay/ports/libmad/mad.pc.in b/overlay/ports/libmad/mad.pc.in new file mode 100644 index 00000000000000..6dd5792ff29d5e --- /dev/null +++ b/overlay/ports/libmad/mad.pc.in @@ -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} diff --git a/overlay/ports/libmad/portfile.cmake b/overlay/ports/libmad/portfile.cmake index ff1e3b1ac8dae0..a45e6a0cc7b8b9 100644 --- a/overlay/ports/libmad/portfile.cmake +++ b/overlay/ports/libmad/portfile.cmake @@ -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 @@ -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)