Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
7c85a1ff
Commit
7c85a1ff
authored
Mar 08, 2020
by
Reckordp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Increase flexibility of CrossBuild
parent
dd6f5e46
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
6 deletions
+75
-6
mrbgems/mruby-io/mrbgem.rake
mrbgems/mruby-io/mrbgem.rake
+15
-3
mrbgems/mruby-socket/mrbgem.rake
mrbgems/mruby-socket/mrbgem.rake
+14
-2
tasks/toolchains/android.rake
tasks/toolchains/android.rake
+46
-1
No files found.
mrbgems/mruby-io/mrbgem.rake
View file @
7c85a1ff
...
...
@@ -7,9 +7,21 @@ MRuby::Gem::Specification.new('mruby-io') do |spec|
case
RUBY_PLATFORM
when
/mingw|mswin|msys/
spec
.
linker
.
libraries
+=
[
'Ws2_32'
]
#spec.cc.include_paths += ["C:/Windows/system/include"]
spec
.
linker
.
library_paths
+=
[
"C:/Windows/system"
]
really_for_window
=
true
if
build
.
kind_of?
(
MRuby
::
CrossBuild
)
if
%w(x86_64-w64-mingw32 i686-w64-mingw32)
.
include?
(
build
.
host_target
)
really_for_window
=
true
else
really_for_window
=
false
end
end
if
really_for_window
spec
.
linker
.
libraries
+=
[
'Ws2_32'
]
#spec.cc.include_paths += ["C:/Windows/system/include"]
spec
.
linker
.
library_paths
+=
[
"C:/Windows/system"
]
end
end
if
build
.
kind_of?
(
MRuby
::
CrossBuild
)
&&
%w(x86_64-w64-mingw32 i686-w64-mingw32)
.
include?
(
build
.
host_target
)
spec
.
linker
.
libraries
+=
[
'ws2_32'
]
...
...
mrbgems/mruby-socket/mrbgem.rake
View file @
7c85a1ff
...
...
@@ -8,8 +8,20 @@ MRuby::Gem::Specification.new('mruby-socket') do |spec|
# If Windows, use winsock
if
(
/mswin|mingw|win32/
=~
RUBY_PLATFORM
)
then
spec
.
linker
.
libraries
<<
"wsock32"
spec
.
linker
.
libraries
<<
"ws2_32"
really_for_window
=
true
if
build
.
kind_of?
(
MRuby
::
CrossBuild
)
if
%w(x86_64-w64-mingw32 i686-w64-mingw32)
.
include?
(
build
.
host_target
)
really_for_window
=
true
else
really_for_window
=
false
end
end
if
really_for_window
spec
.
linker
.
libraries
<<
"wsock32"
spec
.
linker
.
libraries
<<
"ws2_32"
end
end
spec
.
add_dependency
(
'mruby-io'
,
:core
=>
'mruby-io'
)
...
...
tasks/toolchains/android.rake
View file @
7c85a1ff
...
...
@@ -10,6 +10,7 @@ class MRuby::Toolchain::Android
~/Android/Sdk/ndk-bundle
%LOCALAPPDATA%/Android/android-sdk/ndk-bundle
%LOCALAPPDATA%/Android/android-ndk
%LOCALAPPDATA%/Android/Sdk/ndk/*
~/Library/Android/sdk/ndk-bundle
~/Library/Android/ndk
}
...
...
@@ -40,6 +41,19 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
end
end
class
SysrootNotReady
<
StandardError
def
message
<<-
EOM
Couldn't find standard header files
Please Move/Copy important file inside
<NDK_HOME>/sysroot/usr/include/
to
<NDK_HOME>/platforms/<ANDROID_VERSION>/<ARCH>/usr/include/
Higher NDK version will be use.
EOM
end
end
attr_reader
:params
def
initialize
(
params
)
...
...
@@ -74,6 +88,25 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
path
.
gsub!
'%LOCALAPPDATA%'
,
ENV
[
'LOCALAPPDATA'
]
||
'%LOCALAPPDATA%'
path
.
gsub!
'\\'
,
'/'
path
.
gsub!
'~'
,
Dir
.
home
||
'~'
path
.
gsub!
(
'*'
)
do
next
nil
unless
path
[
-
1
]
==
"*"
dirs
=
Dir
.
glob
(
path
).
collect
do
|
d
|
m
=
d
.
match
(
/(\d+)\.(\d+)\.(\d+)$/
)
m
?
[
m
[
1
],
m
[
2
],
m
[
3
]].
collect
{
|
v
|
v
.
to_i
}
:
nil
end
dirs
.
compact!
dirs
.
sort!
do
|
before
,
after
|
f
=
0
if
(
f
=
(
after
.
first
<=>
before
.
first
))
!=
0
next
f
elsif
(
f
=
(
after
[
1
]
<=>
before
[
1
]))
!=
0
next
f
else
next
after
.
last
<=>
before
.
last
end
end
dirs
.
empty?
?
nil
.
to_s
:
dirs
.
first
.
join
(
"."
)
end
File
.
directory?
(
path
)
}
||
raise
(
AndroidNDKHomeNotFound
)
)
...
...
@@ -146,7 +179,8 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
end
def
sysroot
@sysroot
||=
home_path
.
join
(
'platforms'
,
platform
,
return
@sysroot
if
@sysroot
sysroot_path
=
home_path
.
join
(
'platforms'
,
platform
,
case
arch
when
/armeabi/
then
'arch-arm'
when
/arm64-v8a/
then
'arch-arm64'
...
...
@@ -156,6 +190,11 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
when
/mips/
then
'arch-mips'
end
).
to_s
if
Dir
.
exist?
(
File
.
join
(
sysroot_path
,
"usr"
,
"include"
))
return
@sysroot
=
sysroot_path
else
raise
(
SysrootNotReady
)
end
end
def
platform
...
...
@@ -259,6 +298,12 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
def
cflags
flags
=
[]
case
RUBY_PLATFORM
when
/mswin|mingw|win32/
# Build for Android dont need window flag
flags
+=
%W(-U_WIN32 -U_WIN64)
end
flags
+=
%W(-MMD -MP -D__android__ -DANDROID --sysroot="
#{
sysroot
}
")
flags
+=
ctarget
case
toolchain
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment