Skip to content

Commit df7416f

Browse files
committed
Add libromfs: WIP
1 parent a836ce4 commit df7416f

File tree

5 files changed

+113
-1
lines changed

5 files changed

+113
-1
lines changed

platforms/switch/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ if use_nacp
105105
output: [switch_exe_name + '.nacp'],
106106
depends: NACP_DEPS,
107107
)
108+
108109
NRO_FLAGS += '--nacp=' + switch_exe_name + '.nacp'
109110
NRO_DEPS += nacp_file
110111

platforms/wii/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ if use_meta_xml
130130
input: 'meta.xml.in',
131131
output: 'meta.xml',
132132
configuration: wii_meta_xml_conf,
133-
install: true,
134133
)
135134

136135
endif

subprojects/libromfs.wrap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
[wrap-git]
4+
url = https://github.com/yawut/libromfs-wiiu.git
5+
revision = master
6+
depth = 1
7+
patch_directory = libromfs
8+
9+
[provide]
10+
libromfs = libromfs_dep
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
project(
2+
'libromfs',
3+
'c',
4+
version: '0.7.0',
5+
meson_version: '>=1.2.0',
6+
default_options: {
7+
'c_std': ['c11'],
8+
},
9+
)
10+
11+
deps = []
12+
13+
14+
if meson.is_cross_build()
15+
if host_machine.system() == 'wiiu'
16+
17+
object_target = 'elf32-powerpc'
18+
binary_arch = 'powerpc:common'
19+
## deps +='wut'
20+
21+
elif host_machine.system() == 'wii'
22+
23+
object_target = 'elf32-powerpc'
24+
binary_arch = 'powerpc:common'
25+
26+
else
27+
error('not supported platform: ' + host_machine.system())
28+
endif
29+
else
30+
error('only cross build is supported')
31+
endif
32+
33+
romfs_dir = get_option('romfs_dir')
34+
35+
if romfs_dir == ''
36+
error('\'romfs_dir\' option is required')
37+
endif
38+
39+
fs = import('fs')
40+
41+
if not fs.exists(romfs_dir)
42+
error('\'romfs_dir\' should exist, but doesn\'t: \'' + romfs_dir + '\'')
43+
endif
44+
45+
tar = find_program('tar', native: true)
46+
47+
objcopy = find_program('objcopy', native: false)
48+
49+
romfs_tar_name = 'romfs.tar'
50+
romfs_obj_name = 'romfs.o'
51+
52+
53+
romfs_tar = custom_target(
54+
romfs_tar_name,
55+
command: [
56+
tar,
57+
'--format', 'ustar',
58+
'-cvf', '@OUTPUT@',
59+
'-C', romfs_dir,
60+
'.',
61+
],
62+
output: [romfs_tar_name],
63+
)
64+
65+
romfs_object = custom_target(
66+
romfs_obj_name,
67+
command: [
68+
objcopy,
69+
'--input-target', 'binary',
70+
'--output-target', object_target,
71+
'--binary-architecture', binary_arch,
72+
'@INPUT@',
73+
'@OUTPUT@',
74+
],
75+
input: romfs_tar,
76+
output: [romfs_obj_name],
77+
)
78+
79+
inc_dirs = include_directories('include')
80+
81+
libromfs_lib = library(
82+
'libromfs',
83+
files('source/romfs.c'),
84+
include_directories: inc_dirs,
85+
dependencies: deps,
86+
install: true,
87+
objects: romfs_object,
88+
)
89+
90+
libromfs_dep = declare_dependency(
91+
include_directories: inc_dirs,
92+
version: meson.project_version(),
93+
link_with: libromfs_lib,
94+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
3+
option(
4+
'romfs_dir',
5+
type: 'string',
6+
value: '',
7+
description: 'The directory to use as ROM file system',
8+
)

0 commit comments

Comments
 (0)