Skip to content

Commit

Permalink
windows: create GPL package and LGPL package
Browse files Browse the repository at this point in the history
  • Loading branch information
mfkl committed Sep 16, 2024
1 parent 57019f4 commit 97b66b1
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ Thumbs.db
*.lib
*.sbr
*.dylib
build/**
build/**/*.dll
build/**/*.jar
build/**/*.so
build/**/*.dylib
obj/
build/**
mac/**
[Rr]elease*/
_ReSharper*/
Expand Down
26 changes: 26 additions & 0 deletions VideoLAN.LibVLC.Windows.GPL.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>VideoLAN.LibVLC.Windows.GPL</id>
<title>VideoLAN.LibVLC.Windows.GPL</title>
<version>3.0.11</version>
<authors>VideoLAN</authors>
<owners>VideoLAN</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>LibVLC is a modular multimedia framework</summary>
<description>LibVLC is a modular multimedia framework that can render video and output audio as well as encode and stream.
As it is native code, you will need to use a wrapper library such as LibVLCSharp to use it from .NET.
This package contains GPL plugin DLLs from official releases. Make sure you comply with the GPL license.</description>
<tags>libvlc;vlc;videolan;native;c/c++;video;audio;player;media;mediaplayer;codec;ffmpeg;xamarin;graphics;ios;android;linux;windows;macos;cross-platform</tags>
<projectUrl>https://code.videolan.org/videolan/libvlc-nuget</projectUrl>
<license type="expression">GPL-2.0-or-later</license>
<icon>icon.png</icon>
<releaseNotes>https://code.videolan.org/videolan/vlc/blob/master/NEWS</releaseNotes>
</metadata>
<files>
<file src="build\VideoLAN.LibVLC.Windows.GPL.targets" target="build\VideoLAN.LibVLC.Windows.GPL.targets"/>
<file src="build\win7-x64\native\**" target="build\x64"/>
<file src="build\win7-x86\native\**" target="build\x86"/>
<file src="icon.png" target="" />
</files>
</package>
98 changes: 98 additions & 0 deletions build/VideoLAN.LibVLC.Windows.GPL.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VlcWindowsX64TargetDir Condition=" '$(VlcWindowsX64TargetDir)' == '' ">libvlc\win-x64</VlcWindowsX64TargetDir>
<VlcWindowsX86TargetDir Condition=" '$(VlcWindowsX86TargetDir)' == '' ">libvlc\win-x86</VlcWindowsX86TargetDir>
<VlcWindowsX64Enabled Condition="'$(VlcWindowsX64Enabled)' == '' AND ('$(Platform)' == 'x64' OR '$(Platform)' == 'AnyCPU')">true</VlcWindowsX64Enabled>
<VlcWindowsX86Enabled Condition="'$(VlcWindowsX86Enabled)' == '' AND ('$(Platform)' == 'x86' OR '$(Platform)' == 'AnyCPU')">true</VlcWindowsX86Enabled>
</PropertyGroup>

<ItemGroup>
<!-- If no VlcWindows[...]IncludeFiles was declared previously, include all plugins by default by specifying ** (escaped, so %2A%2A) -->
<VlcWindowsX64IncludeFiles Condition="'@(VlcWindowsX64IncludeFiles)'==''" Include="libvlc.%2A;libvlccore.%2A;hrtfs\%2A%2A;lua\%2A%2A;plugins\%2A%2A" />
<VlcWindowsX86IncludeFiles Condition="'@(VlcWindowsX86IncludeFiles)'==''" Include="libvlc.%2A;libvlccore.%2A;hrtfs\%2A%2A;lua\%2A%2A;plugins\%2A%2A" />
</ItemGroup>

<Target Name="CollectVlcFilesToCopyWindows" BeforeTargets="BeforeBuild">
<!-- We need a target in order to make batching work -->
<!-- Some useful links to understand how it works:
http://sedotech.com/Resources#Batching (4 parts of excellent explanation of Batching. Link 2 is dead, but can be found in parts 3 and above)
http://sedodream.com/2010/10/21/MSBuildFilterListTake2.aspx
-->

<!-- First, transform the escaped, relative, platform-independant file path into real path, relative to 32/64 folders -->

<!-- x64 -->
<ItemGroup Condition="'$(VlcWindowsX64Enabled)' == 'true'">
<!-- Expand selectors and compute absolute paths for include, exclude and MainLibraries -->
<VlcWindowsX64IncludeFilesFullPath Include="$([MSBuild]::Unescape($(MSBuildThisFileDirectory)..\build\x64\%(VlcWindowsX64IncludeFiles.Identity)))" />
<VlcWindowsX64ExcludeFilesFullPath Include="$([MSBuild]::Unescape($(MSBuildThisFileDirectory)..\build\x64\%(VlcWindowsX64ExcludeFiles.Identity)))" Condition="'%(VlcWindowsX64ExcludeFiles.Identity)'!=''" />

<!-- We have gathered all the full path of what should be copied and what should be skipped, let's include that as Content that gets copied -->
<Content Include="@(VlcWindowsX64IncludeFilesFullPath)" Exclude="@(VlcWindowsX64ExcludeFilesFullPath)">
<Link>$(VlcWindowsX64TargetDir)\$([MSBuild]::MakeRelative($(MSBuildThisFileDirectory)..\build\x64\, %(FullPath)))</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<!-- x86 -->
<ItemGroup Condition="'$(VlcWindowsX86Enabled)' == 'true'">
<!-- Expand selectors and compute absolute paths for include, exclude and MainLibraries -->
<VlcWindowsX86IncludeFilesFullPath Include="$([MSBuild]::Unescape($(MSBuildThisFileDirectory)..\build\x86\%(VlcWindowsX86IncludeFiles.Identity)))" />
<VlcWindowsX86ExcludeFilesFullPath Include="$([MSBuild]::Unescape($(MSBuildThisFileDirectory)..\build\x86\%(VlcWindowsX86ExcludeFiles.Identity)))" Condition="'%(VlcWindowsX86ExcludeFiles.Identity)'!=''" />

<!-- We have gathered all the full path of what should be copied and what should be skipped, let's include that as Content that gets copied -->
<Content Include="@(VlcWindowsX86IncludeFilesFullPath)" Exclude="@(VlcWindowsX86ExcludeFilesFullPath)">
<Link>$(VlcWindowsX86TargetDir)\$([MSBuild]::MakeRelative($(MSBuildThisFileDirectory)..\build\x86\, %(FullPath)))</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Target>

<ItemDefinitionGroup>
<ClCompile Condition="'$(Language)' == 'C++' and ('$(Platform)' == 'x64' or '$(Platform)' == 'x86') and '$(OS)'=='Windows_NT'">
<AdditionalIncludeDirectories>
$(MSBuildThisFileDirectory)\$(Platform)\include\;%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>

<ItemDefinitionGroup>
<Link Condition="'$(Language)' == 'C++' and ('$(Platform)' == 'x64' or '$(Platform)' == 'x86') and '$(OS)'=='Windows_NT'">
<AdditionalDependencies>libvlc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)\$(Platform)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>

<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)\$(Platform)\*.dll"
Condition="'$(Language)' == 'C++' and ('$(Platform)' == 'x64' or '$(Platform)' == 'x86') and '$(OS)'=='Windows_NT'">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)\$(Platform)\plugins\**"
Condition="'$(Language)' == 'C++' and '$(OS)'=='Windows_NT' and ('$(Platform)' == 'x86' or '$(Platform)' == 'x64')">
<Link>plugins\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)\$(Platform)\hrtfs\**"
Condition="'$(Language)' == 'C++' and '$(OS)'=='Windows_NT' and ('$(Platform)' == 'x86' or '$(Platform)' == 'x64')">
<Link>hrtfs\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)\$(Platform)\lua\**"
Condition="'$(Language)' == 'C++' and '$(OS)'=='Windows_NT' and ('$(Platform)' == 'x86' or '$(Platform)' == 'x64')">
<Link>lua\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
82 changes: 74 additions & 8 deletions package-nuget-win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,63 @@ downloadUrlx86="https://get.videolan.org/vlc/$version/win32/vlc-$version-win32.7
downloadUrlx64="https://get.videolan.org/vlc/$version/win64/vlc-$version-win64.7z"

packageName="VideoLAN.LibVLC.Windows"
packageNameGPL="VideoLAN.LibVLC.Windows.GPL"

echo "downloading x86 binaries..." $downloadUrlx86
x86PluginsLocation="build/win7-x86/native/plugins"
x64PluginsLocation="build/win7-x64/native/plugins"

# GPL plugin list
gpl_plugins=(
"access/libaccess_realrtsp_plugin.dll"
"access/libdvdnav_plugin.dll"
"access/libdvdread_plugin.dll"
"access/libvnc_plugin.dll"
"access/libdshow_plugin.dll"
"audio_filter/libdolby_surround_decoder_plugin.dll"
"audio_filter/libheadphone_channel_mixer_plugin.dll"
"audio_filter/libmad_plugin.dll"
"audio_filter/libmono_plugin.dll"
"audio_filter/libsamplerate_plugin.dll"
"codec/liba52_plugin.dll"
"codec/libaribsub_plugin.dll"
"codec/libdca_plugin.dll"
"codec/libfaad_plugin.dll"
"codec/liblibmpeg2_plugin.dll"
"codec/libt140_plugin.dll"
"codec/libx264_plugin.dll"
"codec/libx265_plugin.dll"
"control"
"demux/libmpc_plugin.dll"
"demux/libreal_plugin.dll"
"demux/libsid_plugin.dll"
"gui"
"logger/libfile_logger_plugin.dll"
"misc/libaudioscrobbler_plugin.dll"
"misc/libexport_plugin.dll"
"misc/liblogger_plugin.dll"
"misc/libstats_plugin.dll"
"misc/libvod_rtsp_plugin.dll"
"packetizer/libpacketizer_a52_plugin.dll"
"services_discovery/libmediadirs_plugin.dll"
"services_discovery/libpodcast_plugin.dll"
"services_discovery/libsap_plugin.dll"
"stream_out/libstream_out_cycle_plugin.dll"
"stream_out/libstream_out_rtp_plugin.dll"
"video_filter/libpostproc_plugin.dll"
"video_filter/librotate_plugin.dll"
)

# echo "downloading x86 binaries..." $downloadUrlx86
curl -Lsfo x86.7z $downloadUrlx86

echo "downloading x64 binaries..." $downloadUrlx64
# echo "downloading x64 binaries..." $downloadUrlx64
curl -Lsfo x64.7z $downloadUrlx64

echo "downloading NuGet..."
curl -Lsfo nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
if [ ! -f "nuget.exe" ]; then
echo "downloading NuGet..."
curl -Lsfo nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
fi

echo "unzipping vlc..."
7z x x86.7z -o./x86
7z x x64.7z -o./x64
Expand All @@ -31,14 +79,32 @@ cp -R ./x64/vlc-$version/{libvlc.dll,libvlccore.dll,hrtfs,lua,plugins} build/win
cp ./x64/vlc-$version/sdk/lib/{libvlc.lib,libvlccore.lib,vlc.lib,vlccore.lib} build/win7-x64/native/
cp -R ./x64/vlc-$version/sdk/include build/win7-x64/native/

echo "packaging GPL version..."

mono nuget.exe pack "$packageNameGPL".nuspec -Version "$version"

echo "removing GPL plugins from x86..."

# remove x86 GPL plugins
for file in "${gpl_plugins[@]}"; do
rm -rf "$x86PluginsLocation/$file"
done

echo "removing GPL plugins from x64..."

# remove x64 GPL plugins
for file in "${gpl_plugins[@]}"; do
rm -rf "$x64PluginsLocation/$file"
done

echo "packaging LGPL version..."

mono nuget.exe pack "$packageName".nuspec -Version "$version"

echo "cleaning up..."
rm ./x86.7z
rm -rf ./x86
rm ./x64.7z
rm -rf ./x64

echo "packaging"

mono nuget.exe pack "$packageName".nuspec -Version "$version"

echo "done"

0 comments on commit 97b66b1

Please sign in to comment.