From 55f825071351985f37cac07d97e2ab2c7d3811bd Mon Sep 17 00:00:00 2001 From: zi-m <53815290+zi-m@users.noreply.github.com> Date: Fri, 23 Aug 2019 18:19:28 +0200 Subject: [PATCH] [mp3lame] Add new port (#7830) * mp3lame * "WindowsStore" and "arm" are not supported * "WindowsStore" and "arm" are not supported * simplify portfile.cmake * add ARM * add /APPCONTAINER * add MSBUILD_PLATFORM * remove "mp3lame does not support ARM" * arm64 support * arm64 support --- ...001-msvc-upgrade-solution-up-to-vc11.patch | 1018 +++++++++++++++++ ports/mp3lame/CONTROL | 4 + ports/mp3lame/Config.cmake.in | 60 + ports/mp3lame/portfile.cmake | 152 +++ ports/mp3lame/usage | 4 + 5 files changed, 1238 insertions(+) create mode 100644 ports/mp3lame/00001-msvc-upgrade-solution-up-to-vc11.patch create mode 100644 ports/mp3lame/CONTROL create mode 100644 ports/mp3lame/Config.cmake.in create mode 100644 ports/mp3lame/portfile.cmake create mode 100644 ports/mp3lame/usage diff --git a/ports/mp3lame/00001-msvc-upgrade-solution-up-to-vc11.patch b/ports/mp3lame/00001-msvc-upgrade-solution-up-to-vc11.patch new file mode 100644 index 000000000..07778093b --- /dev/null +++ b/ports/mp3lame/00001-msvc-upgrade-solution-up-to-vc11.patch @@ -0,0 +1,1018 @@ +diff --git a/vc_solution/arch_nasm.props b/vc_solution/arch_nasm.props +new file mode 100644 +index 0000000..13174c9 +--- /dev/null ++++ b/vc_solution/arch_nasm.props +@@ -0,0 +1,15 @@ ++ ++ ++ ++ ++ ++ ++ <_ProjectFileVersion>11.0.61030.0 ++ ++ ++ ++ TAKEHIRO_IEEE754_HACK;HAVE_NASM;MMX_choose_table;%(PreprocessorDefinitions) ++ ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/arch_sse2.props b/vc_solution/arch_sse2.props +new file mode 100644 +index 0000000..1f97d57 +--- /dev/null ++++ b/vc_solution/arch_sse2.props +@@ -0,0 +1,17 @@ ++ ++ ++ ++ ++ ++ ++ <_ProjectFileVersion>11.0.61030.0 ++ ++ ++ ++ HAVE_XMMINTRIN_H;MIN_ARCH_SSE;%(PreprocessorDefinitions) ++ StreamingSIMDExtensions2 ++ Fast ++ ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/arch_x87.props b/vc_solution/arch_x87.props +new file mode 100644 +index 0000000..3268c6b +--- /dev/null ++++ b/vc_solution/arch_x87.props +@@ -0,0 +1,15 @@ ++ ++ ++ ++ ++ ++ ++ <_ProjectFileVersion>11.0.61030.0 ++ ++ ++ ++ TAKEHIRO_IEEE754_HACK;%(PreprocessorDefinitions) ++ ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/vc11_lame.sln b/vc_solution/vc11_lame.sln +new file mode 100644 +index 0000000..9453bb0 +--- /dev/null ++++ b/vc_solution/vc11_lame.sln +@@ -0,0 +1,41 @@ ++ ++Microsoft Visual Studio Solution File, Format Version 12.00 ++# Visual Studio 2012 ++Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lame", "vc11_lame_lame.vcxproj", "{EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}" ++ ProjectSection(ProjectDependencies) = postProject ++ {92BD50AA-04D6-4FBF-ACE1-468FAF6778F2} = {92BD50AA-04D6-4FBF-ACE1-468FAF6778F2} ++ EndProjectSection ++EndProject ++Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp3lame-static", "vc11_libmp3lame.vcxproj", "{20536101-3B0E-43EF-94F9-080D595DAC57}" ++EndProject ++Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp3lame", "vc11_libmp3lame_dll.vcxproj", "{92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}" ++EndProject ++Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmpghip-static", "vc11_mpglib.vcxproj", "{E2DAB91A-8248-4625-8A85-2C2C2A390DD8}" ++EndProject ++Global ++ GlobalSection(SolutionConfigurationPlatforms) = preSolution ++ Debug|Win32 = Debug|Win32 ++ Release|Win32 = Release|Win32 ++ EndGlobalSection ++ GlobalSection(ProjectConfigurationPlatforms) = postSolution ++ {EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.Debug|Win32.ActiveCfg = Debug|Win32 ++ {EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.Debug|Win32.Build.0 = Debug|Win32 ++ {EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.Release|Win32.ActiveCfg = Release|Win32 ++ {EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38}.Release|Win32.Build.0 = Release|Win32 ++ {20536101-3B0E-43EF-94F9-080D595DAC57}.Debug|Win32.ActiveCfg = Debug|Win32 ++ {20536101-3B0E-43EF-94F9-080D595DAC57}.Debug|Win32.Build.0 = Debug|Win32 ++ {20536101-3B0E-43EF-94F9-080D595DAC57}.Release|Win32.ActiveCfg = Release|Win32 ++ {20536101-3B0E-43EF-94F9-080D595DAC57}.Release|Win32.Build.0 = Release|Win32 ++ {92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.Debug|Win32.ActiveCfg = Debug|Win32 ++ {92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.Debug|Win32.Build.0 = Debug|Win32 ++ {92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.Release|Win32.ActiveCfg = Release|Win32 ++ {92BD50AA-04D6-4FBF-ACE1-468FAF6778F2}.Release|Win32.Build.0 = Release|Win32 ++ {E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.Debug|Win32.ActiveCfg = Debug|Win32 ++ {E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.Debug|Win32.Build.0 = Debug|Win32 ++ {E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.Release|Win32.ActiveCfg = Release|Win32 ++ {E2DAB91A-8248-4625-8A85-2C2C2A390DD8}.Release|Win32.Build.0 = Release|Win32 ++ EndGlobalSection ++ GlobalSection(SolutionProperties) = preSolution ++ HideSolutionNode = FALSE ++ EndGlobalSection ++EndGlobal +diff --git a/vc_solution/vc11_lame_config.props b/vc_solution/vc11_lame_config.props +new file mode 100644 +index 0000000..fd60017 +--- /dev/null ++++ b/vc_solution/vc11_lame_config.props +@@ -0,0 +1,32 @@ ++ ++ ++ ++ ++ ++ ++ <_ProjectFileVersion>11.0.61030.0 ++ $(SolutionDir)..\output\$(Configuration)\ ++ $(SolutionDir)..\obj\$(Configuration)\$(ProjectName)\ ++ false ++ ++ ++ ++ $(IntDir)$(ProjectName).bsc ++ ++ ++ _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATED;%(PreprocessorDefinitions) ++ true ++ true ++ $(IntDir) ++ true ++ Level4 ++ 4995;4996;%(DisableSpecificWarnings) ++ ++ ++ $(OutDir);%(AdditionalLibraryDirectories) ++ $(OutDir)$(TargetName).pdb ++ true ++ ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/vc11_lame_lame.vcxproj b/vc_solution/vc11_lame_lame.vcxproj +new file mode 100644 +index 0000000..faf101a +--- /dev/null ++++ b/vc_solution/vc11_lame_lame.vcxproj +@@ -0,0 +1,128 @@ ++ ++ ++ ++ ++ Debug ++ Win32 ++ ++ ++ Release ++ Win32 ++ ++ ++ ++ lame ++ {EEF5B49E-DBD1-4E1B-8B86-C5D64FCBAD38} ++ lame ++ ++ ++ ++ Application ++ v110 ++ false ++ ++ ++ Application ++ v110 ++ false ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <_ProjectFileVersion>11.0.61030.0 ++ ++ ++ ++ ..\output\Debug/lame.tlb ++ ++ ++ ++ Disabled ++ ../;../mpglib;../libmp3lame;../include;%(AdditionalIncludeDirectories) ++ _DEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) ++ MultiThreadedDebugDLL ++ ProgramDatabase ++ ++ ++ _DEBUG;_APP=$(TargetFileName);%(PreprocessorDefinitions) ++ 0x0409 ++ ++ ++ $(OutDir)lame.exe ++ true ++ Console ++ false ++ /APPCONTAINER /machine:x86 %(AdditionalOptions) ++ NotSet ++ ++ ++ ++ ++ ..\output\Release/lame.tlb ++ ++ ++ ++ Full ++ AnySuitable ++ true ++ Speed ++ ..;../mpglib;../libmp3lame;../include;../;%(AdditionalIncludeDirectories) ++ NDEBUG;WIN32;_WIN32;_CONSOLE;_WINDOWS;HAVE_MPGLIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) ++ MultiThreadedDLL ++ ++ ++ NDEBUG;_APP=$(TargetFileName);%(PreprocessorDefinitions) ++ 0x0409 ++ ++ ++ $(OutDir)lame.exe ++ Console ++ false ++ /APPCONTAINER /machine:x86 %(AdditionalOptions) ++ NotSet ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ {20536101-3b0e-43ef-94f9-080d595dac57} ++ false ++ ++ ++ ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/vc11_libmp3lame.vcxproj b/vc_solution/vc11_libmp3lame.vcxproj +new file mode 100644 +index 0000000..d4636b0 +--- /dev/null ++++ b/vc_solution/vc11_libmp3lame.vcxproj +@@ -0,0 +1,188 @@ ++ ++ ++ ++ ++ Debug ++ Win32 ++ ++ ++ Release ++ Win32 ++ ++ ++ ++ libmp3lame-static ++ {20536101-3B0E-43EF-94F9-080D595DAC57} ++ libmp3lame ++ ++ ++ ++ StaticLibrary ++ v110 ++ false ++ ++ ++ StaticLibrary ++ v110 ++ false ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <_ProjectFileVersion>11.0.61030.0 ++ ++ ++ ++ Full ++ AnySuitable ++ true ++ Speed ++ ../mpglib;../include;..;%(AdditionalIncludeDirectories) ++ NDEBUG;_WINDOWS;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H;%(PreprocessorDefinitions) ++ MultiThreadedDLL ++ ++ ++ 0x0409 ++ ++ ++ $(OutDir)libmp3lame-static.lib ++ ++ ++ ++ ++ Disabled ++ ../mpglib;../include;..;%(AdditionalIncludeDirectories) ++ _DEBUG;_WINDOWS;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H;%(PreprocessorDefinitions) ++ MultiThreadedDebugDLL ++ $(OutDir)$(TargetName).pdb ++ OldStyle ++ ++ ++ 0x0409 ++ ++ ++ $(OutDir)libmp3lame-static.lib ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Level1 ++ Level1 ++ ++ ++ ++ ++ ++ ++ ++ ../libmp3lame;%(AdditionalIncludeDirectories) ++ ../libmp3lame;%(AdditionalIncludeDirectories) ++ ++ ++ ++ ++ ++ Performing Custom Build Step on %(Filename) ++ copy ..\configMS.h ..\config.h ++ ++ ..\config.h;%(Outputs) ++ Performing Custom Build Step on %(Filename) ++ copy ..\configMS.h ..\config.h ++ ++ ..\config.h;%(Outputs) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ true ++ true ++ ++ ++ true ++ true ++ ++ ++ true ++ true ++ ++ ++ true ++ true ++ ++ ++ true ++ true ++ ++ ++ true ++ true ++ ++ ++ true ++ true ++ ++ ++ true ++ true ++ ++ ++ ++ ++ {e2dab91a-8248-4625-8a85-2c2c2a390dd8} ++ false ++ ++ ++ ++ ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/vc11_libmp3lame_dll.vcxproj b/vc_solution/vc11_libmp3lame_dll.vcxproj +new file mode 100644 +index 0000000..9dad9d5 +--- /dev/null ++++ b/vc_solution/vc11_libmp3lame_dll.vcxproj +@@ -0,0 +1,125 @@ ++ ++ ++ ++ ++ Debug ++ Win32 ++ ++ ++ Release ++ Win32 ++ ++ ++ ++ libmp3lame ++ {92BD50AA-04D6-4FBF-ACE1-468FAF6778F2} ++ libmp3lameDLL ++ ++ ++ ++ DynamicLibrary ++ v110 ++ false ++ ++ ++ DynamicLibrary ++ v110 ++ false ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <_ProjectFileVersion>11.0.61030.0 ++ ++ ++ ++ ..\output\Release/libmp3lame_dll.tlb ++ ++ ++ ++ Full ++ AnySuitable ++ true ++ Speed ++ ../libmp3lame;../;../mpglib;../include;..;%(AdditionalIncludeDirectories) ++ NDEBUG;_WINDOWS;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H;%(PreprocessorDefinitions) ++ MultiThreadedDLL ++ ++ ++ _VC80_UPGRADE=0x0600;_DLL=$(TargetFileName);%(PreprocessorDefinitions) ++ 0x0409 ++ ++ ++ false ++ ++ ++ $(OutDir)libmp3lame.dll ++ ..\include\lame.def ++ $(OutDir)libmp3lame.lib ++ /APPCONTAINER /machine:x86 %(AdditionalOptions) ++ false ++ NotSet ++ ++ ++ ++ ++ ..\output\Debug/libmp3lame_dll.tlb ++ ++ ++ ++ Disabled ++ ../libmp3lame;../;../mpglib;../include;..;%(AdditionalIncludeDirectories) ++ _DEBUG;_WINDOWS;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H;%(PreprocessorDefinitions) ++ MultiThreadedDebugDLL ++ ProgramDatabase ++ ++ ++ _VC80_UPGRADE=0x0600;_DLL=$(TargetFileName);_DEBUG;%(PreprocessorDefinitions) ++ 0x0409 ++ ++ ++ false ++ ++ ++ $(OutDir)libmp3lame.dll ++ ..\include\lame.def ++ true ++ $(OutDir)libmp3lame.lib ++ /APPCONTAINER /machine:x86 %(AdditionalOptions) ++ false ++ NotSet ++ ++ ++ ++ ++ true ++ true ++ ++ ++ ++ ++ ++ ++ ++ {20536101-3b0e-43ef-94f9-080d595dac57} ++ false ++ ++ ++ ++ ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/vc11_mpglib.vcxproj b/vc_solution/vc11_mpglib.vcxproj +new file mode 100644 +index 0000000..a455bca +--- /dev/null ++++ b/vc_solution/vc11_mpglib.vcxproj +@@ -0,0 +1,116 @@ ++ ++ ++ ++ ++ Debug ++ Win32 ++ ++ ++ Release ++ Win32 ++ ++ ++ ++ libmpghip-static ++ {E2DAB91A-8248-4625-8A85-2C2C2A390DD8} ++ libmpghip ++ ++ ++ ++ StaticLibrary ++ v110 ++ false ++ ++ ++ StaticLibrary ++ v110 ++ false ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <_ProjectFileVersion>11.0.61030.0 ++ ++ ++ ++ Full ++ AnySuitable ++ true ++ Speed ++ ../libmp3lame;../include;..;%(AdditionalIncludeDirectories) ++ NDEBUG;HAVE_MPGLIB;_WINDOWS;USE_LAYER_2;WIN32;HAVE_CONFIG_H;%(PreprocessorDefinitions) ++ MultiThreadedDLL ++ ++ ++ 0x0409 ++ ++ ++ $(OutDir)libmpghip-static.lib ++ ++ ++ ++ ++ Disabled ++ ../libmp3lame;../include;..;%(AdditionalIncludeDirectories) ++ _DEBUG;_WINDOWS;USE_LAYER_2;HAVE_MPGLIB;WIN32;HAVE_CONFIG_H;%(PreprocessorDefinitions) ++ MultiThreadedDebugDLL ++ $(OutDir)$(TargetName).pdb ++ OldStyle ++ ++ ++ 0x0409 ++ ++ ++ $(OutDir)libmpghip-static.lib ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Performing Custom Build Step on %(Filename) ++ copy ..\configMS.h ..\config.h ++ ++ ..\config.h;%(Outputs) ++ Performing Custom Build Step on %(Filename) ++ copy ..\configMS.h ..\config.h ++ ++ ..\config.h;%(Outputs) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/vc11_nasm.props b/vc_solution/vc11_nasm.props +new file mode 100644 +index 0000000..0f8542f +--- /dev/null ++++ b/vc_solution/vc11_nasm.props +@@ -0,0 +1,24 @@ ++ ++ ++ ++ Midl ++ CustomBuild ++ ++ ++ _SelectedFiles;$(NASMDependsOn) ++ ++ ++ ++ $(IntDir)%(Filename).obj ++ win32 ++ %(RootDir)%(Directory) ++ WIN32 ++ nasmw [BinFormat] [IncludeDir] [Defines] -o [OutFile] %(FullPath) ++ [OutFile] ++ Assembling %(Filename)... ++ false ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/vc11_nasm.targets b/vc_solution/vc11_nasm.targets +new file mode 100644 +index 0000000..3158d8d +--- /dev/null ++++ b/vc_solution/vc11_nasm.targets +@@ -0,0 +1,85 @@ ++ ++ ++ ++ ++ ++ _NASM ++ ++ ++ ++ $(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml ++ ++ ++ ++ ++ ++ ++ ++ @(NASM, '|') ++ ++ ++ ++ ++ ++ ++ ++ ++ $(ComputeLinkInputsTargets); ++ ComputeNASMOutput; ++ ++ ++ $(ComputeLibInputsTargets); ++ ComputeNASMOutput; ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +\ No newline at end of file +diff --git a/vc_solution/vc11_nasm.xml b/vc_solution/vc11_nasm.xml +new file mode 100644 +index 0000000..390d570 +--- /dev/null ++++ b/vc_solution/vc11_nasm.xml +@@ -0,0 +1,149 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ General ++ ++ ++ ++ ++ Command Line ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Execute Before ++ ++ ++ Specifies the targets for the build customization to run before. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Execute After ++ ++ ++ Specifies the targets for the build customization to run after. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Additional Options ++ ++ ++ Additional Options ++ ++ ++ ++ ++ ++ ++ +\ No newline at end of file diff --git a/ports/mp3lame/CONTROL b/ports/mp3lame/CONTROL new file mode 100644 index 000000000..1702751d9 --- /dev/null +++ b/ports/mp3lame/CONTROL @@ -0,0 +1,4 @@ +Source: mp3lame +Version: 3.100 +Homepage: http://lame.sourceforge.net/ +Description: LAME is a high quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL. diff --git a/ports/mp3lame/Config.cmake.in b/ports/mp3lame/Config.cmake.in new file mode 100644 index 000000000..9630b9ea1 --- /dev/null +++ b/ports/mp3lame/Config.cmake.in @@ -0,0 +1,60 @@ + +get_filename_component(_mp3lame_root "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_mp3lame_root "${_mp3lame_root}" PATH) +get_filename_component(_mp3lame_root "${_mp3lame_root}" PATH) + +set(_mp3lame_rel_lib "${_mp3lame_root}/lib/@MP3LAME_LIB@") +set(_mp3lame_dbg_lib "${_mp3lame_root}/debug/lib/@MP3LAME_LIB@") + +if (EXISTS "${_mp3lame_rel_lib}" OR EXISTS "${_mp3lame_dbg_lib}") + + add_library(mp3lame::mp3lame UNKNOWN IMPORTED) + set_target_properties(mp3lame::mp3lame + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_mp3lame_root}/include") + + if (EXISTS "${_mp3lame_rel_lib}") + set_target_properties(mp3lame::mp3lame + PROPERTIES IMPORTED_LOCATION_RELEASE "${_mp3lame_rel_lib}") + set_property(TARGET mp3lame::mp3lame APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + endif() + if (EXISTS "${_mp3lame_dbg_lib}") + set_target_properties(mp3lame::mp3lame + PROPERTIES IMPORTED_LOCATION_DEBUG "${_mp3lame_dbg_lib}") + set_property(TARGET mp3lame::mp3lame APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + endif() + + set(_mp3lame_mpghip_rel_lib "${_mp3lame_root}/lib/libmpghip-static.lib") + set(_mp3lame_mpghip_dbg_lib "${_mp3lame_root}/debug/lib/libmpghip-static.lib") + + if (EXISTS "${_mp3lame_mpghip_rel_lib}" OR EXISTS "${_mp3lame_mpghip_dbg_lib}") + + add_library(mp3lame::mpghip UNKNOWN IMPORTED) + + if (EXISTS "${_mp3lame_rel_lib}") + set_target_properties(mp3lame::mpghip + PROPERTIES IMPORTED_LOCATION_RELEASE "${_mp3lame_mpghip_rel_lib}") + set_property(TARGET mp3lame::mpghip APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + endif() + if (EXISTS "${_mp3lame_dbg_lib}") + set_target_properties(mp3lame::mpghip + PROPERTIES IMPORTED_LOCATION_DEBUG "${_mp3lame_mpghip_dbg_lib}") + set_property(TARGET mp3lame::mpghip APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + endif() + + set_target_properties(mp3lame::mp3lame PROPERTIES INTERFACE_LINK_LIBRARIES mp3lame::mpghip) + + endif() + + unset(_mp3lame_mpghip_rel_lib) + unset(_mp3lame_mpghip_dbg_lib) + +else() + + set(mp3lame_FOUND FALSE) + +endif() + +unset(_mp3lame_rel_lib) +unset(_mp3lame_dbg_lib) + +unset(_mp3lame_root) diff --git a/ports/mp3lame/portfile.cmake b/ports/mp3lame/portfile.cmake new file mode 100644 index 000000000..a9b9e17e4 --- /dev/null +++ b/ports/mp3lame/portfile.cmake @@ -0,0 +1,152 @@ +include(vcpkg_common_functions) + +set(VERSION 3.100) + +vcpkg_download_distfile(ARCHIVE_FILE + URLS "https://downloads.sourceforge.net/project/lame/lame/${VERSION}/lame-${VERSION}.tar.gz" + FILENAME "lame-3.100.tar.gz" + SHA512 0844b9eadb4aacf8000444621451277de365041cc1d97b7f7a589da0b7a23899310afd4e4d81114b9912aa97832621d20588034715573d417b2923948c08634b +) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE_FILE} + REF ${VERSION} + PATCHES 00001-msvc-upgrade-solution-up-to-vc11.patch +) + +if(VCPKG_TARGET_IS_WINDOWS) + + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(platform "ARM64") + set(machine "ARM64") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + set(platform "ARM") + set(machine "ARM") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(platform "x64") + set(machine "x64") + else() + set(platform "Win32") + set(machine "x86") + endif() + + file(READ "${SOURCE_PATH}/vc_solution/vc11_lame.sln" sln_con) + string(REPLACE "|Win32" "|${platform}" sln_con "${sln_con}") + string(REPLACE "\"vc11_" "\"${machine}_vc11_" sln_con "${sln_con}") + file(WRITE "${SOURCE_PATH}/vc_solution/${machine}_vc11_lame.sln" "${sln_con}") + + + file(GLOB vcxprojs RELATIVE "${SOURCE_PATH}/vc_solution" "${SOURCE_PATH}/vc_solution/vc11_*.vcxproj") + foreach(vcxproj ${vcxprojs}) + file(READ "${SOURCE_PATH}/vc_solution/${vcxproj}" vcxproj_con) + + if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + string(REPLACE "DLL" "" vcxproj_con "${vcxproj_con}") + endif() + + string(REPLACE "/machine:x86" "/machine:${machine}" vcxproj_con "${vcxproj_con}") + string(REPLACE "Win32" "${platform}" vcxproj_con "${vcxproj_con}") + string(REPLACE "|Win32" "|${platform}" vcxproj_con "${vcxproj_con}") + string(REPLACE "Include=\"vc11_" "Include=\"${machine}_vc11_" vcxproj_con "${vcxproj_con}") + + if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + string(REPLACE "/APPCONTAINER" "" vcxproj_con "${vcxproj_con}") + endif() + + file(WRITE "${SOURCE_PATH}/vc_solution/${machine}_${vcxproj}" "${vcxproj_con}") + endforeach() + + vcpkg_install_msbuild( + SOURCE_PATH ${SOURCE_PATH} + PROJECT_SUBPATH "vc_solution/${machine}_vc11_lame.sln" + TARGET "lame" + PLATFORM "${platform}" + ) + + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libmp3lame.lib) + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libmp3lame.lib) + endif() + set(MP3LAME_LIB "libmp3lame-static.lib") + else() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libmp3lame-static.lib) + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libmpghip-static.lib) + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libmp3lame-static.lib) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libmpghip-static.lib) + endif() + set(MP3LAME_LIB "libmp3lame.lib") + endif() + +else() + + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(OPTIONS --enable-static=yes --enable-shared=no) + set(MP3LAME_LIB "libmp3lame.a") + else() + set(OPTIONS --enable-shared=yes --enable-static=no) + set(MP3LAME_LIB "libmp3lame.so") + endif() + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND ${SOURCE_PATH}/configure ${OPTIONS} --with-pic=yes --prefix=${CURRENT_PACKAGES_DIR}/debug + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME configure-${TARGET_TRIPLET}-dbg + ) + message(STATUS "Building ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND make -j install "CFLAGS=${CFLAGS}" "LDFLAGS=${LDFLAGS}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME install-${TARGET_TRIPLET}-dbg + ) + + file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/debug/bin + ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/share + ) + endif() + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + + message(STATUS "Configuring ${TARGET_TRIPLET}-rel") + vcpkg_execute_required_process( + COMMAND ${SOURCE_PATH}/configure ${OPTIONS} --with-pic=yes --prefix=${CURRENT_PACKAGES_DIR} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME configure-${TARGET_TRIPLET}-rel + ) + + message(STATUS "Building ${TARGET_TRIPLET}-rel") + vcpkg_execute_required_process( + COMMAND make -j install "CFLAGS=${CFLAGS}" "LDFLAGS=${LDFLAGS}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME install-${TARGET_TRIPLET}-rel + ) + + if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + endif() + + endif() + +endif() + +file(COPY ${SOURCE_PATH}/include/lame.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/lame) +configure_file(${SOURCE_PATH}/COPYING ${CURRENT_PACKAGES_DIR}/share/mp3lame/copyright COPYONLY) +configure_file(${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in ${CURRENT_PACKAGES_DIR}/share/mp3lame/mp3lame-config.cmake @ONLY) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/mp3lame) diff --git a/ports/mp3lame/usage b/ports/mp3lame/usage new file mode 100644 index 000000000..6efb86c53 --- /dev/null +++ b/ports/mp3lame/usage @@ -0,0 +1,4 @@ +The package mp3lame provides CMake targets: + + find_package(mp3lame CONFIG REQUIRED) + target_link_libraries(main PRIVATE mp3lame::mp3lame)