Skip to content

Commit 3993398

Browse files
authored
Merge branch 'master' into path
2 parents bd99505 + d7bacc1 commit 3993398

File tree

138 files changed

+5980
-2676
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+5980
-2676
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ jobs:
2222
msvc: true
2323
buildtype: release
2424
args: >-
25-
-Ddefault_library=static
26-
--force-fallback-for=zlib,harfbuzz,freetype2,fribidi,libpng
27-
-Dfreetype2:harfbuzz=disabled
28-
-Dharfbuzz:freetype=disabled
29-
-Dharfbuzz:cairo=disabled
30-
-Dharfbuzz:glib=disabled
25+
-Ddefault_library=static
26+
--force-fallback-for=zlib,harfbuzz,freetype2,fribidi,libpng
27+
-Dfreetype2:harfbuzz=disabled
28+
-Dharfbuzz:freetype=disabled
29+
-Dharfbuzz:cairo=disabled
30+
-Dharfbuzz:glib=disabled
3131
-Dharfbuzz:gobject=disabled
3232
-Dharfbuzz:tests=disabled
3333
-Dharfbuzz:docs=disabled
@@ -40,14 +40,26 @@ jobs:
4040
# msvc: false
4141
#}
4242
- {
43-
name: Ubuntu Debug,
44-
os: ubuntu-latest,
43+
name: Ubuntu 22 Debug,
44+
os: ubuntu-22.04,
4545
buildtype: debugoptimized,
4646
args: ''
4747
}
4848
- {
49-
name: Ubuntu Release,
50-
os: ubuntu-latest,
49+
name: Ubuntu 22 Release,
50+
os: ubuntu-22.04,
51+
buildtype: release,
52+
args: ''
53+
}
54+
- {
55+
name: Ubuntu 24 Debug,
56+
os: ubuntu-24.04,
57+
buildtype: debugoptimized,
58+
args: ''
59+
}
60+
- {
61+
name: Ubuntu 24 Release,
62+
os: ubuntu-24.04,
5163
buildtype: release,
5264
args: ''
5365
}
@@ -116,17 +128,24 @@ jobs:
116128
brew install pulseaudio # NO OpenAL in github CI
117129
118130
- name: Install dependencies (Linux)
119-
if: matrix.config.os == 'ubuntu-latest'
131+
if: startsWith(matrix.config.os, 'ubuntu-')
120132
run: |
121133
sudo apt-get update
122-
sudo apt-get install ninja-build build-essential libx11-dev libwxgtk3.0-gtk3-dev libfreetype6-dev pkg-config libfontconfig1-dev libass-dev libasound2-dev libffms2-dev intltool libboost-all-dev libhunspell-dev libcurl4-openssl-dev libuchardet-dev
134+
sudo apt-get install ninja-build build-essential libx11-dev libfreetype6-dev pkg-config libfontconfig1-dev libass-dev libasound2-dev libffms2-dev intltool libboost-all-dev libhunspell-dev libcurl4-openssl-dev libuchardet-dev libgtest-dev libgmock-dev ${{ matrix.config.os == 'ubuntu-22.04' && 'libwxgtk3.0-gtk3-dev' || 'libwxgtk3.2-dev' }}
135+
136+
- name: Set compiler (Linux)
137+
if: matrix.config.os == 'ubuntu-22.04'
138+
run: |
139+
# We need to use Clang on Ubuntu 22 to avoid a bug with GCC 11
140+
echo "CC=clang" >> $GITHUB_ENV
141+
echo "CXX=clang++" >> $GITHUB_ENV
123142
124143
- name: Configure
125144
run: meson setup build ${{ matrix.config.args }} -Dbuildtype=${{ matrix.config.buildtype }} ${{ github.ref_type == 'tag' && '-Dofficial_release=true' || '' }}
126145

127146
- name: Build
128147
run: meson compile -C build
129-
148+
130149
- name: Run test
131150
run: meson test -C build --verbose "gtest main"
132151

@@ -149,14 +168,14 @@ jobs:
149168
name: ${{ matrix.config.name }} - installer
150169
path: build/Aegisub-*.exe
151170
if-no-files-found: error
152-
171+
153172
- name: Upload artifacts - portable.zip
154173
uses: actions/upload-artifact@v4
155174
if: matrix.config.os == 'windows-latest'
156175
with:
157176
name: ${{ matrix.config.name }} - portable
158177
path: build/aegisub-portable-64.zip
159-
178+
160179
# macOS artifacts
161180
- name: Generate macOS installer
162181
if: startsWith(matrix.config.os, 'macos-')
@@ -171,3 +190,28 @@ jobs:
171190
name: ${{ matrix.config.name }} - installer
172191
path: build/Aegisub-*.dmg
173192
if-no-files-found: error
193+
194+
# Tarball
195+
- name: Generate tarball
196+
if: matrix.config.os == 'ubuntu-24.04' && matrix.config.buildtype == 'release'
197+
run: |
198+
set -e
199+
200+
# Work around https://github.com/mesonbuild/meson/issues/14005
201+
rm -rf subprojects/luajit/.git
202+
203+
meson dist --include-subprojects -C build
204+
205+
# Make sure the subprojects we need are included
206+
mkdir distcheck
207+
tar -xJf build/meson-dist/*.tar.xz -C distcheck/
208+
test -e distcheck/*/subprojects/luabins/meson.build
209+
test -e distcheck/*/subprojects/luajit/meson.build
210+
211+
- name: Upload artifacts - tarball
212+
uses: actions/upload-artifact@v4
213+
if: matrix.config.os == 'ubuntu-24.04' && matrix.config.buildtype == 'release'
214+
with:
215+
name: Source Tarball
216+
path: build/meson-dist/*.tar.xz
217+
if-no-files-found: error

libaegisub/audio/provider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class writer {
8181
std::ostream& out;
8282

8383
public:
84-
writer(std::filesystem::path const& filename) : outfile(filename, true), out(outfile.Get()) { }
84+
writer(agi::fs::path const& filename) : outfile(filename, true), out(outfile.Get()) { }
8585

8686
template<int N>
8787
void write(const char(&str)[N]) {

libaegisub/audio/provider_dummy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class DummyAudioProvider final : public AudioProvider {
5858
}
5959

6060
public:
61-
DummyAudioProvider(std::filesystem::path const& uri) {
61+
DummyAudioProvider(agi::fs::path const& uri) {
6262
noise = uri.string().find(":noise?") != std::string::npos;
6363
channels = 1;
6464
sample_rate = 44100;
@@ -70,7 +70,7 @@ class DummyAudioProvider final : public AudioProvider {
7070
}
7171

7272
namespace agi {
73-
std::unique_ptr<AudioProvider> CreateDummyAudioProvider(std::filesystem::path const& file, agi::BackgroundRunner *) {
73+
std::unique_ptr<AudioProvider> CreateDummyAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) {
7474
if (!file.string().starts_with("dummy-audio:"))
7575
return {};
7676
return std::make_unique<DummyAudioProvider>(file);

libaegisub/audio/provider_hd.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@
2121
#include <libaegisub/fs.h>
2222
#include <libaegisub/path.h>
2323

24-
#include <filesystem>
2524
#include <boost/interprocess/detail/os_thread_functions.hpp>
2625
#include <ctime>
2726
#include <thread>
2827

2928
namespace {
3029
using namespace agi;
31-
using namespace std::filesystem;
3230

3331
class HDAudioProvider final : public AudioProviderWrapper {
3432
mutable temp_file_mapping file;
@@ -49,7 +47,7 @@ class HDAudioProvider final : public AudioProviderWrapper {
4947
}
5048
}
5149

52-
path CacheFilename(path const& dir) {
50+
fs::path CacheFilename(fs::path const& dir) {
5351
// Check free space
5452
if ((uint64_t)num_samples * bytes_per_sample > fs::FreeSpace(dir))
5553
throw AudioProviderError("Not enough free disk space in " + dir.string() + " to cache the audio");
@@ -59,7 +57,7 @@ class HDAudioProvider final : public AudioProviderWrapper {
5957
}
6058

6159
public:
62-
HDAudioProvider(std::unique_ptr<AudioProvider> src, path const& dir)
60+
HDAudioProvider(std::unique_ptr<AudioProvider> src, fs::path const& dir)
6361
: AudioProviderWrapper(std::move(src))
6462
, file(dir / CacheFilename(dir), num_samples * bytes_per_sample)
6563
{
@@ -83,7 +81,7 @@ class HDAudioProvider final : public AudioProviderWrapper {
8381
}
8482

8583
namespace agi {
86-
std::unique_ptr<AudioProvider> CreateHDAudioProvider(std::unique_ptr<AudioProvider> src, std::filesystem::path const& dir) {
84+
std::unique_ptr<AudioProvider> CreateHDAudioProvider(std::unique_ptr<AudioProvider> src, agi::fs::path const& dir) {
8785
return std::make_unique<HDAudioProvider>(std::move(src), dir);
8886
}
8987
}

libaegisub/common/charset.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#endif
2323

2424
namespace agi::charset {
25-
std::string Detect(std::filesystem::path const& file) {
25+
std::string Detect(agi::fs::path const& file) {
2626
agi::read_file_mapping fp(file);
2727

2828
// First check for known magic bytes which identify the file type

libaegisub/common/file_mapping.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ char *map(int64_t s_offset, uint64_t length, boost::interprocess::mode_t mode,
7272
}
7373

7474
namespace agi {
75-
file_mapping::file_mapping(std::filesystem::path const& filename, bool temporary)
75+
file_mapping::file_mapping(agi::fs::path const& filename, bool temporary)
7676
#ifdef _WIN32
7777
: handle(CreateFileW(filename.wstring().c_str(),
7878
temporary ? read_write : read_only,
@@ -116,7 +116,7 @@ file_mapping::~file_mapping() {
116116
}
117117
}
118118

119-
read_file_mapping::read_file_mapping(std::filesystem::path const& filename)
119+
read_file_mapping::read_file_mapping(agi::fs::path const& filename)
120120
: file(filename, false)
121121
{
122122
offset_t size = 0;
@@ -134,7 +134,7 @@ const char *read_file_mapping::read(int64_t offset, uint64_t length) {
134134
return map(offset, length, read_only, file_size, file, region, mapping_start);
135135
}
136136

137-
temp_file_mapping::temp_file_mapping(std::filesystem::path const& filename, uint64_t size)
137+
temp_file_mapping::temp_file_mapping(agi::fs::path const& filename, uint64_t size)
138138
: file(filename, true)
139139
, file_size(size)
140140
{

libaegisub/common/format.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
#include <libaegisub/format.h>
1818

1919
#include <libaegisub/charset_conv.h>
20-
21-
#include <filesystem>
20+
#include <libaegisub/fs.h>
2221

2322
#ifdef _MSC_VER
2423
#define WCHAR_T_ENC "utf-16le"

libaegisub/common/fs.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace sfs = std::filesystem;
2626

2727
namespace agi::fs {
2828
namespace {
29-
void check_error(std::error_code ec, const char *exp, sfs::path const& src_path, sfs::path const& dst_path) {
29+
void check_error(std::error_code ec, const char *exp, path const& src_path, path const& dst_path) {
3030
if (ec == std::error_code{}) return;
3131
using enum std::errc;
3232
switch (ec.value()) {
@@ -55,7 +55,7 @@ void check_error(std::error_code ec, const char *exp, sfs::path const& src_path,
5555
check_error(ec, #exp, src_path, dst_path);
5656

5757
#define CHECKED_CALL_RETURN(exp, src_path) \
58-
CHECKED_CALL(auto ret = exp, src_path, std::filesystem::path()); \
58+
CHECKED_CALL(auto ret = exp, src_path, agi::fs::path()); \
5959
return ret
6060

6161
#define WRAP_SFS(sfs_name, agi_name) \
@@ -69,6 +69,12 @@ void check_error(std::error_code ec, const char *exp, sfs::path const& src_path,
6969
return sfs::sfs_name(p, ec); \
7070
}
7171

72+
#define WRAP_SFS_AGI_PATH(sfs_name, agi_name) \
73+
auto agi_name(path const& p) -> agi::fs::path { \
74+
CHECKED_CALL(auto ret = sfs::sfs_name(p, ec), p, agi::fs::path()); \
75+
return agi::fs::path(std::move(ret)); \
76+
}
77+
7278
// sasuga windows.h
7379
#undef CreateDirectory
7480

@@ -82,7 +88,8 @@ void check_error(std::error_code ec, const char *exp, sfs::path const& src_path,
8288
WRAP_SFS(last_write_time, ModifiedTime)
8389
WRAP_SFS(create_directories, CreateDirectory)
8490
WRAP_SFS(remove, Remove)
85-
WRAP_SFS(canonical, Canonicalize)
91+
WRAP_SFS_AGI_PATH(canonical, Canonicalize)
92+
WRAP_SFS_AGI_PATH(absolute, Absolute)
8693

8794
uintmax_t Size(path const& p) {
8895
if (DirectoryExists(p))
@@ -104,4 +111,12 @@ void check_error(std::error_code ec, const char *exp, sfs::path const& src_path,
104111
if (filename[filename.size() - ext.size() - 1] != '.') return false;
105112
return boost::iends_with(filename, ext);
106113
}
114+
115+
agi::fs::path CurrentPath() {
116+
return agi::fs::path(std::filesystem::current_path());
117+
}
118+
119+
void CurrentPath(path const& path) {
120+
std::filesystem::current_path(path);
121+
}
107122
}

libaegisub/common/io.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <fstream>
2323

2424
namespace agi::io {
25-
using namespace std::filesystem;
25+
using namespace agi::fs;
2626

2727
std::unique_ptr<std::istream> Open(path const& file, bool binary) {
2828
LOG_D("agi/io/open/file") << file;

libaegisub/common/json.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ json::UnknownElement parse(std::istream &stream) {
3737
}
3838
}
3939

40-
json::UnknownElement file(std::filesystem::path const& file, std::string_view default_config) {
40+
json::UnknownElement file(agi::fs::path const& file, std::string_view default_config) {
4141
try {
4242
if (fs::FileExists(file))
4343
return parse(*io::Open(file));

0 commit comments

Comments
 (0)