Skip to content

Commit 2e51c4e

Browse files
committed
Make xz mandatory
1 parent f1005b2 commit 2e51c4e

File tree

5 files changed

+18
-44
lines changed

5 files changed

+18
-44
lines changed

CMakeLists.txt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ option(ENABLE_FFMPEG "Enable ffmpeg support for ELSE and Gem audio/video objects
1717
option(ENABLE_GEM "Enable Gem support" ON)
1818
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
1919
option(ENABLE_PERFETTO "Enable Perfetto profiling (advanced)" OFF)
20-
option(ENABLE_XZ "Enable xz compression (smaller binary, long configure time)" ON)
2120
option(MACOS_LEGACY "Enable support for old macOS versions (lowers OSX_DEPLOYMENT TARGET and disables Metal" OFF)
2221
option(VERBOSE "" OFF)
2322

@@ -73,7 +72,6 @@ if(QUICK_BUILD)
7372
set(ENABLE_SFIZZ OFF)
7473
set(ENABLE_GEM OFF)
7574
set(ENABLE_FFMPEG OFF)
76-
set(ENABLE_XZ OFF)
7775
endif()
7876

7977
if(BSD)
@@ -135,7 +133,7 @@ if(NOT PREPARE_DOCUMENTATION_RESULT EQUAL 0)
135133
endif()
136134

137135
message(STATUS "Packaging resources")
138-
execute_process(COMMAND ${Python3_EXECUTABLE} package_resources.py ${ENABLE_GEM} ${ENABLE_XZ} ${CMAKE_CURRENT_BINARY_DIR}/Resources WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Scripts RESULT_VARIABLE PACKAGE_RESOURCES_RESULT)
136+
execute_process(COMMAND ${Python3_EXECUTABLE} package_resources.py ${ENABLE_GEM} ${CMAKE_CURRENT_BINARY_DIR}/Resources WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Scripts RESULT_VARIABLE PACKAGE_RESOURCES_RESULT)
139137

140138
if(NOT PACKAGE_RESOURCES_RESULT EQUAL 0)
141139
message(FATAL_ERROR "Resource packaging failed with error code ${PACKAGE_RESOURCES_RESULT}")
@@ -271,9 +269,7 @@ set(PLUGDATA_COMPILE_DEFINITIONS
271269
if(ENABLE_SFIZZ)
272270
list(APPEND PLUGDATA_COMPILE_DEFINITIONS ENABLE_SFIZZ=1)
273271
endif()
274-
if(ENABLE_XZ)
275-
list(APPEND PLUGDATA_COMPILE_DEFINITIONS ENABLE_XZ=1)
276-
endif()
272+
277273
if(ENABLE_FFMPEG)
278274
list(APPEND PLUGDATA_COMPILE_DEFINITIONS ENABLE_FFMPEG=1)
279275
endif()
@@ -332,12 +328,9 @@ set(libs
332328
BinaryData
333329
nanovg
334330
webpdecoder
331+
liblzma
335332
)
336333

337-
if(ENABLE_XZ)
338-
list(APPEND libs liblzma)
339-
endif()
340-
341334
if(UNIX AND NOT APPLE)
342335
list(APPEND libs curl X11)
343336
if(LINUX)

Libraries/CMakeLists.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@ if(MSVC)
2828
target_compile_options(webpdecoder PUBLIC "/MT$<$<STREQUAL:$<CONFIGURATION>,Debug>:d>")
2929
set_target_properties(webpdecoder PROPERTIES CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$" )
3030
endif()
31-
if(ENABLE_XZ)
32-
_message(STATUS "Configuring liblzma")
33-
set(XZ_TOOL_XZDEC OFF CACHE BOOL "")
34-
set(XZ_TOOL_LZMADEC OFF CACHE BOOL "")
35-
set(XZ_TOOL_XZ OFF CACHE BOOL "")
36-
set(XZ_ENCODERS "" CACHE STRING "")
37-
set(XZ_DECODERS "lzma2" CACHE STRING "")
38-
add_subdirectory(xz) # for decompressing .tar.xz
39-
endif()
31+
_message(STATUS "Configuring liblzma")
32+
set(XZ_TOOL_XZDEC OFF CACHE BOOL "")
33+
set(XZ_TOOL_LZMADEC OFF CACHE BOOL "")
34+
set(XZ_TOOL_XZ OFF CACHE BOOL "")
35+
set(XZ_ENCODERS "" CACHE STRING "")
36+
add_subdirectory(xz) # for decompressing .tar.xz
4037
set(MESSAGE_QUIET OFF)
4138

4239

Resources/Scripts/package_resources.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
}
2121

2222
package_gem = value_mappings[sys.argv[1].upper()]
23-
use_xz = value_mappings[sys.argv[2].upper()]
2423
output_dir = sys.argv[3]
2524

2625
# Utility filesystem functions
@@ -76,16 +75,12 @@ def existsAsDir(path):
7675
return os.path.isdir(path)
7776

7877
def makeArchive(name, root_dir, base_dir):
79-
if use_xz:
80-
archive_path = os.path.abspath(name)
81-
preset = 9 | lzma.PRESET_EXTREME # max compression
82-
with lzma.open(archive_path, "wb", preset=preset) as xz_out:
83-
with tarfile.open(fileobj=xz_out, mode="w|") as tar:
84-
full_path = os.path.join(root_dir, base_dir)
85-
tar.add(full_path, arcname=base_dir)
86-
else:
87-
shutil.make_archive(name, "zip", root_dir, base_dir)
88-
moveFile("./Filesystem.zip", "./Filesystem")
78+
archive_path = os.path.abspath(name)
79+
preset = 9 | lzma.PRESET_EXTREME # max compression
80+
with lzma.open(archive_path, "wb", preset=preset) as xz_out:
81+
with tarfile.open(fileobj=xz_out, mode="w|") as tar:
82+
full_path = os.path.join(root_dir, base_dir)
83+
tar.add(full_path, arcname=base_dir)
8984

9085
def split(a, n):
9186
k, m = divmod(len(a), n)
@@ -328,7 +323,7 @@ def generate_binary_data(output_dir, file_list):
328323

329324
makeArchive("Filesystem", "./", "./plugdata_version")
330325
with open(project_root + "/Resources/Fonts/InterUnicode.ttf", 'rb') as f_in:
331-
with lzma.open(output_dir + "/InterUnicode.ttf.xz", 'wb') as f_out:
326+
with lzma.open(output_dir + "/InterUnicode.ttf.xz", 'wb', preset=5) as f_out:
332327
shutil.copyfileobj(f_in, f_out)
333328
removeDir(output_dir + "/plugdata_version")
334329

Source/PluginProcessor.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
#include <memory>
88
#include <fstream>
99

10-
#if ENABLE_XZ
1110
#include <xz/src/liblzma/api/lzma.h>
12-
#endif
13-
1411
#include <juce_gui_basics/juce_gui_basics.h>
1512
#include <juce_audio_basics/juce_audio_basics.h>
1613
#include <juce_dsp/juce_dsp.h>
@@ -264,7 +261,6 @@ void PluginProcessor::initialiseFilesystem()
264261
versionDataDir.getParentDirectory().createDirectory();
265262
auto const tempVersionDataDir = versionDataDir.getParentDirectory().getChildFile("plugdata_version");
266263

267-
#if ENABLE_XZ
268264
// Decompress .xz data using liblzma
269265
HeapArray<uint8_t> decompressedData;
270266
decompressedData.reserve(40 * 1024 * 1024);
@@ -335,11 +331,6 @@ void PluginProcessor::initialiseFilesystem()
335331
DBG("Failed to extract tar archive");
336332
return;
337333
}
338-
#else
339-
MemoryInputStream memstream(allData.data(), allData.size(), false);
340-
auto file = ZipFile(memstream);
341-
file.uncompressTo(tempVersionDataDir.getParentDirectory());
342-
#endif
343334
// Create filesystem for this specific version
344335
tempVersionDataDir.moveFileTo(versionDataDir);
345336
}

Source/Utility/Fonts.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
#include <BinaryData.h>
33
#include <juce_gui_basics/juce_gui_basics.h>
44
#include <juce_gui_extra/juce_gui_extra.h>
5-
#include "Utility/Config.h"
6-
7-
#if ENABLE_XZ
85
#include <xz/src/liblzma/api/lzma.h>
9-
#endif
6+
7+
#include "Utility/Config.h"
108

119
enum FontStyle {
1210
Regular,

0 commit comments

Comments
 (0)