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.
data/ext/extconf.rb DELETED
@@ -1,177 +0,0 @@
1
-
2
- require 'mkmf'
3
-
4
- case RUBY_PLATFORM
5
- when /darwin/
6
- $PLATFORM = :macos
7
- when /linux/
8
- $PLATFORM = :linux
9
- if `cat /etc/os-release` =~ /raspbian/
10
- $PLATFORM = :linux_rpi
11
- end
12
- when /bsd/
13
- $PLATFORM = :bsd
14
- when /mingw/
15
- $PLATFORM = :windows
16
- else
17
- $PLATFORM = nil
18
- end
19
- $errors = [] # Holds errors
20
-
21
- # Helper functions #############################################################
22
-
23
- # Print installation errors
24
- def print_errors
25
- puts "
26
- #{"== #{"Ruby 2D Installation Errors".error} =======================================\n"}
27
- #{$errors.join("\n ")}\n
28
- #{"======================================================================"}"
29
- end
30
-
31
- # Add compiler and linker flags
32
- def add_flags(type, flags)
33
- case type
34
- when :c
35
- $CFLAGS << " #{flags} "
36
- when :ld
37
- $LDFLAGS << " #{flags} "
38
- end
39
- end
40
-
41
- # Check for SDL libraries
42
- def check_sdl
43
- unless have_library('SDL2') && have_library('SDL2_mixer')
44
-
45
- $errors << "Couldn't find packages needed."
46
-
47
- case $platform
48
- when :linux, :linux_rpi
49
- # Fedora and CentOS
50
- if system('which yum')
51
- $errors << "Install the following packages using `yum` (or `dnf`) and try again:\n" <<
52
- " SDL2-devel SDL2_mixer-devel".bold
53
-
54
- # Arch
55
- elsif system('which pacman')
56
- $errors << "Install the following packages using `pacman` and try again:\n" <<
57
- " sdl2 sdl2_mixer".bold
58
-
59
- # openSUSE
60
- elsif system('which zypper')
61
- $errors << "Install the following packages using `zypper` and try again:\n" <<
62
- " libSDL2-devel libSDL2_mixer-devel".bold
63
-
64
- # Ubuntu, Debian, and Mint
65
- # `apt` must be last because openSUSE has it aliased to `zypper`
66
- elsif system('which apt')
67
- $errors << "Install the following packages using `apt` and try again:\n" <<
68
- " libsdl2-dev libsdl2-mixer-dev".bold
69
- end
70
- when :bsd
71
- $errors << "Install the following packages using `pkg` and try again:\n" <<
72
- " sdl2 sdl2_mixer".bold
73
- end
74
-
75
- $errors << "" << "See #{"ruby2d.com".bold} for additional help."
76
- print_errors; exit
77
- end
78
- end
79
-
80
- # Set Raspberry Pi flags
81
- def set_rpi_flags
82
- if $platform == :linux_rpi
83
- add_flags(:c, '-I/opt/vc/include')
84
- add_flags(:ld, '-L/opt/vc/lib -lbrcmGLESv2')
85
- end
86
- end
87
-
88
- # Set flags for Linux and BSD
89
- def set_linux_bsd_flags
90
- check_sdl
91
- set_rpi_flags
92
- add_flags(:ld, "-lSDL2 -lSDL2_mixer -lm")
93
- if $PLATFORM == :linux then add_flags(:ld, '-lGL') end
94
- end
95
-
96
-
97
- # Use SDL and other libraries installed by the user (not those bundled with the gem)
98
- def use_usr_libs
99
- case $PLATFORM
100
- when :macos
101
- add_flags(:c, `sdl2-config --cflags`)
102
- add_flags(:c, '-I/opt/homebrew/include')
103
- add_flags(:ld, `sdl2-config --libs`)
104
- add_flags(:ld, '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf')
105
- add_flags(:ld, '-Wl,-framework,OpenGL')
106
- when :windows
107
- add_flags(:ld, '-lSDL2 -lSDL2_mixer')
108
- add_flags(:ld, '-lopengl32 -lglew32')
109
- when :linux_rpi
110
- set_linux_bsd_flags
111
- end
112
- end
113
-
114
-
115
- # Configure native extension ###################################################
116
-
117
- # Build Ruby 2D native extention using libraries installed by user
118
- # To use install flag: `gem install ruby2d -- dev`
119
- if ARGV.include? 'dev'
120
- use_usr_libs
121
-
122
- # Use libraries provided by the gem (default)
123
- else
124
- add_flags(:c, '-std=c11')
125
-
126
- case $PLATFORM
127
- when :macos
128
- add_flags(:c, '-I../assets/include')
129
- ldir = "#{Dir.pwd}/../assets/macos/universal/lib"
130
-
131
- add_flags(:ld, "#{ldir}/libSDL2.a #{ldir}/libSDL2_mixer.a")
132
- add_flags(:ld, "#{ldir}/libmpg123.a #{ldir}/libogg.a #{ldir}/libFLAC.a #{ldir}/libvorbis.a #{ldir}/libvorbisfile.a #{ldir}/libmodplug.a")
133
- add_flags(:ld, "-lz -liconv -lstdc++")
134
- add_flags(:ld, "-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,GameController -Wl,-framework,ForceFeedback -Wl,-framework,OpenGL -Wl,-framework,AudioToolbox -Wl,-framework,CoreAudio -Wl,-framework,IOKit -Wl,-framework,CoreHaptics -Wl,-framework,CoreVideo -Wl,-framework,Metal")
135
-
136
- when :windows
137
- add_flags(:c, '-I../assets/include')
138
-
139
- if RUBY_PLATFORM =~ /ucrt/
140
- ldir = "#{Dir.pwd}/../assets/windows/mingw-w64-ucrt-x86_64/lib"
141
- else
142
- ldir = "#{Dir.pwd}/../assets/windows/mingw-w64-x86_64/lib"
143
- end
144
-
145
- # Start linker flags (needed to avoid circular dependencies)
146
- add_flags(:ld, "-Wl,--start-group")
147
-
148
- # SDL2
149
- add_flags(:ld, "#{ldir}/libSDL2.a")
150
-
151
- # SDL2_mixer
152
- add_flags(:ld, "#{ldir}/libSDL2_mixer.a")
153
- add_flags(:ld, "#{ldir}/libmpg123.a #{ldir}/libFLAC.a #{ldir}/libvorbis.a #{ldir}/libvorbisfile.a #{ldir}/libogg.a "\
154
- "#{ldir}/libmodplug.a #{ldir}/libopus.a #{ldir}/libopusfile.a #{ldir}/libsndfile.a")
155
-
156
- # Other dependencies
157
- add_flags(:ld, "#{ldir}/libglew32.a #{ldir}/libstdc++.a #{ldir}/libz.a")
158
- add_flags(:ld, '-lmingw32 -lopengl32 -lole32 -loleaut32 -limm32 -lversion -lwinmm -lrpcrt4 -mwindows -lsetupapi -ldwrite')
159
-
160
- # End linker flags
161
- add_flags(:ld, "-Wl,--end-group")
162
-
163
- when :linux, :linux_rpi, :bsd
164
- set_linux_bsd_flags
165
-
166
- # If can't detect the platform, use libraries installed by the user
167
- else
168
- use_usr_libs
169
- end
170
- end
171
-
172
- $CFLAGS.gsub!(/\n/, ' ') # remove newlines in flags, they can cause problems
173
- $LDFLAGS.gsub!(/\n/, ' ') # remove newlines in flags, they can cause problems
174
-
175
- # Create Makefile
176
- create_header
177
- create_makefile('audio')
data/ext/mkmf.log DELETED
@@ -1,7 +0,0 @@
1
- extconf.h is:
2
- /* begin */
3
- 1: #ifndef EXTCONF_H
4
- 2: #define EXTCONF_H
5
- 3: #endif
6
- /* end */
7
-
data/lib/audio.bundle DELETED
Binary file
File without changes
File without changes