native_audio 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dac41bc4a03d88511d741b5229a835d3fffecc553a7400138ac7e9e35c522b31
4
- data.tar.gz: 159abd14b12633bfb445d5477ee4891ab021f536cdabf182f76cb739c0d14c9b
3
+ metadata.gz: 3bf44a7a337d94bcc47dc2cb5904837cd36984e9ea1b80768d1c5f624cc77dc3
4
+ data.tar.gz: ddaece9c35182a2935d4c1d3f1da13d9dbfb7d4f2c0e41b385da8216b2927b05
5
5
  SHA512:
6
- metadata.gz: 896d421b46d33c74e3db78d1498a736ca24163756862aa949d5373fe191f9aa13633ab507229e7aa3f4bef12b2f50e764882c817b323f2e50dff851d1070ea63
7
- data.tar.gz: 33da84bf5a2dea4431758bc8b525d116b5a2190bc1bd952752bfdd9903d69bbfa30872373a6f28635f8d5e964632b078cdb3bbedf8cbb202073ebc058298979d
6
+ metadata.gz: d11e81e4ecd9de4b8eef28dbcc5a9405e6b366117c11971e74bbaa683ea40ce5751be264d23ca04a0f099e02435f5b84eea405cc0fc0f0f0dc26a07d277622a3
7
+ data.tar.gz: 71b722055b3d9ed5054bad005470828a691f7d1082723c0237645930a816923d77de97d4a681a89d68bbbb9b8f818cf987b196f761dea9beba874bf7de394839
@@ -0,0 +1,115 @@
1
+ require 'mkmf'
2
+
3
+ # Get the root directory of the gem (two levels up from ext/audio/)
4
+ ROOT_DIR = File.expand_path('../..', __dir__)
5
+ ASSETS_DIR = File.join(ROOT_DIR, 'assets')
6
+
7
+ # Detect platform
8
+ PLATFORM = case RUBY_PLATFORM
9
+ when /darwin/ then :macos
10
+ when /linux/ then :linux
11
+ when /mingw/ then :windows
12
+ end
13
+
14
+ def add_flags(type, flags)
15
+ case type
16
+ when :c then $CFLAGS << " #{flags} "
17
+ when :ld then $LDFLAGS << " #{flags} "
18
+ end
19
+ end
20
+
21
+ def check_sdl
22
+ return if have_library('SDL2') && have_library('SDL2_mixer')
23
+
24
+ msg = ["SDL2 libraries not found."]
25
+
26
+ if PLATFORM == :linux
27
+ if system('which apt >/dev/null 2>&1')
28
+ msg << "Install with: sudo apt install libsdl2-dev libsdl2-mixer-dev"
29
+ elsif system('which dnf >/dev/null 2>&1') || system('which yum >/dev/null 2>&1')
30
+ msg << "Install with: sudo dnf install SDL2-devel SDL2_mixer-devel"
31
+ elsif system('which pacman >/dev/null 2>&1')
32
+ msg << "Install with: sudo pacman -S sdl2 sdl2_mixer"
33
+ elsif system('which zypper >/dev/null 2>&1')
34
+ msg << "Install with: sudo zypper install libSDL2-devel libSDL2_mixer-devel"
35
+ end
36
+ end
37
+
38
+ abort msg.join("\n")
39
+ end
40
+
41
+ def set_linux_flags
42
+ check_sdl
43
+ add_flags(:ld, "-lSDL2 -lSDL2_mixer -lm")
44
+ end
45
+
46
+ def use_dev_libs
47
+ case PLATFORM
48
+ when :macos
49
+ add_flags(:c, `sdl2-config --cflags`)
50
+ add_flags(:c, '-I/opt/homebrew/include')
51
+ add_flags(:ld, `sdl2-config --libs`)
52
+ add_flags(:ld, '-lSDL2 -lSDL2_mixer')
53
+ when :windows
54
+ add_flags(:ld, '-lSDL2 -lSDL2_mixer')
55
+ when :linux
56
+ set_linux_flags
57
+ end
58
+ end
59
+
60
+ def use_bundled_libs
61
+ add_flags(:c, '-std=c11')
62
+
63
+ case PLATFORM
64
+ when :macos
65
+ add_flags(:c, "-I#{ASSETS_DIR}/include")
66
+ ldir = "#{ASSETS_DIR}/macos/universal/lib"
67
+
68
+ add_flags(:ld, "#{ldir}/libSDL2.a #{ldir}/libSDL2_mixer.a")
69
+ add_flags(:ld, "#{ldir}/libmpg123.a #{ldir}/libogg.a #{ldir}/libFLAC.a")
70
+ add_flags(:ld, "#{ldir}/libvorbis.a #{ldir}/libvorbisfile.a #{ldir}/libmodplug.a")
71
+ add_flags(:ld, "-lz -liconv -lstdc++")
72
+
73
+ frameworks = %w[Cocoa Carbon GameController ForceFeedback
74
+ AudioToolbox CoreAudio IOKit CoreHaptics CoreVideo Metal]
75
+ add_flags(:ld, frameworks.map { |f| "-Wl,-framework,#{f}" }.join(' '))
76
+
77
+ when :windows
78
+ add_flags(:c, "-I#{ASSETS_DIR}/include")
79
+
80
+ ldir = if RUBY_PLATFORM =~ /ucrt/
81
+ "#{ASSETS_DIR}/windows/mingw-w64-ucrt-x86_64/lib"
82
+ else
83
+ "#{ASSETS_DIR}/windows/mingw-w64-x86_64/lib"
84
+ end
85
+
86
+ add_flags(:ld, "-Wl,--start-group")
87
+ add_flags(:ld, "#{ldir}/libSDL2.a #{ldir}/libSDL2_mixer.a")
88
+ add_flags(:ld, "#{ldir}/libmpg123.a #{ldir}/libFLAC.a #{ldir}/libvorbis.a")
89
+ add_flags(:ld, "#{ldir}/libvorbisfile.a #{ldir}/libogg.a #{ldir}/libmodplug.a")
90
+ add_flags(:ld, "#{ldir}/libopus.a #{ldir}/libopusfile.a #{ldir}/libsndfile.a")
91
+ add_flags(:ld, "#{ldir}/libstdc++.a #{ldir}/libz.a")
92
+ add_flags(:ld, '-lmingw32 -lole32 -loleaut32 -limm32')
93
+ add_flags(:ld, '-lversion -lwinmm -lrpcrt4 -mwindows -lsetupapi -ldwrite')
94
+ add_flags(:ld, "-Wl,--end-group")
95
+
96
+ when :linux
97
+ set_linux_flags
98
+
99
+ else
100
+ use_dev_libs
101
+ end
102
+ end
103
+
104
+ # Main configuration
105
+ if ARGV.include?('dev')
106
+ use_dev_libs
107
+ else
108
+ use_bundled_libs
109
+ end
110
+
111
+ $CFLAGS.gsub!(/\n/, ' ')
112
+ $LDFLAGS.gsub!(/\n/, ' ')
113
+
114
+ create_header
115
+ create_makefile('audio')
metadata CHANGED
@@ -1,33 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: native_audio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Hatfull
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-04 00:00:00.000000000 Z
10
+ date: 2026-01-26 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: A simple audio library for Ruby
14
13
  email:
15
14
  - max.hatfull@gmail.com
16
15
  executables: []
17
16
  extensions:
18
- - ext/extconf.rb
17
+ - ext/audio/extconf.rb
19
18
  extra_rdoc_files: []
20
19
  files:
21
- - assets/include/GL/glew.h
22
- - assets/include/GLES2/gl2.h
23
- - assets/include/GLES2/gl2ext.h
24
- - assets/include/GLES2/gl2ext_angle.h
25
- - assets/include/GLES2/gl2platform.h
26
- - assets/include/GLES3/gl3.h
27
- - assets/include/GLES3/gl31.h
28
- - assets/include/GLES3/gl32.h
29
- - assets/include/GLES3/gl3platform.h
30
- - assets/include/KHR/khrplatform.h
31
20
  - assets/include/SDL2/SDL.h
32
21
  - assets/include/SDL2/SDL_assert.h
33
22
  - assets/include/SDL2/SDL_atomic.h
@@ -124,9 +113,7 @@ files:
124
113
  - assets/include/SDL2/close_code.h
125
114
  - assets/macos/universal/lib/libFLAC.a
126
115
  - assets/macos/universal/lib/libSDL2.a
127
- - assets/macos/universal/lib/libSDL2_image.a
128
116
  - assets/macos/universal/lib/libSDL2_mixer.a
129
- - assets/macos/universal/lib/libSDL2_ttf.a
130
117
  - assets/macos/universal/lib/libmodplug.a
131
118
  - assets/macos/universal/lib/libmpg123.a
132
119
  - assets/macos/universal/lib/libogg.a
@@ -135,48 +122,37 @@ files:
135
122
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a
136
123
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a
137
124
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a
138
- - assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a
139
125
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a
140
126
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a
141
127
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a
142
128
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a
143
129
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a
144
130
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a
145
- - assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a
146
131
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a
147
132
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a
148
133
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a
149
134
  - assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a
150
- - assets/windows/mingw-w64-ucrt-x86_64/lib/libzstd.a
151
135
  - assets/windows/mingw-w64-x86_64/lib/libFLAC.a
152
136
  - assets/windows/mingw-w64-x86_64/lib/libSDL2.a
153
137
  - assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a
154
- - assets/windows/mingw-w64-x86_64/lib/libglew32.a
155
138
  - assets/windows/mingw-w64-x86_64/lib/libmodplug.a
156
139
  - assets/windows/mingw-w64-x86_64/lib/libmpg123.a
157
140
  - assets/windows/mingw-w64-x86_64/lib/libogg.a
158
141
  - assets/windows/mingw-w64-x86_64/lib/libopus.a
159
142
  - assets/windows/mingw-w64-x86_64/lib/libopusfile.a
160
143
  - assets/windows/mingw-w64-x86_64/lib/libsndfile.a
161
- - assets/windows/mingw-w64-x86_64/lib/libssp.a
162
144
  - assets/windows/mingw-w64-x86_64/lib/libstdc++.a
163
145
  - assets/windows/mingw-w64-x86_64/lib/libvorbis.a
164
146
  - assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a
165
147
  - assets/windows/mingw-w64-x86_64/lib/libz.a
166
- - assets/windows/mingw-w64-x86_64/lib/libzstd.a
167
- - ext/Makefile
168
- - ext/audio.c
169
- - ext/audio.o
170
- - ext/extconf.h
171
- - ext/extconf.rb
172
- - ext/mkmf.log
173
- - lib/audio.bundle
148
+ - ext/audio/audio.c
149
+ - ext/audio/extconf.h
150
+ - ext/audio/extconf.rb
174
151
  - lib/native_audio.rb
175
152
  homepage: https://github.com/rubyrpg/native_audio
176
153
  licenses:
177
154
  - MIT
178
155
  metadata: {}
179
- post_install_message:
180
156
  rdoc_options: []
181
157
  require_paths:
182
158
  - lib
@@ -191,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
167
  - !ruby/object:Gem::Version
192
168
  version: '0'
193
169
  requirements: []
194
- rubygems_version: 3.5.22
195
- signing_key:
170
+ rubygems_version: 3.6.2
196
171
  specification_version: 4
197
172
  summary: A simple audio library for Ruby
198
173
  test_files: []