-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
for #270 - update windows builds for ruby 2.4.5 and above
- Loading branch information
Cecil
committed
May 1, 2019
1 parent
2764631
commit 57014d0
Showing
16 changed files
with
1,437 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
# xmsw cross build | ||
# TODO: missing curl | ||
# TODO: massage for mxe deps and locations. (basedll..) | ||
cf =(ENV['ENV_CUSTOM'] || "#{APP['VAGRANT']}msw-custom.yaml") | ||
gtk_version = '3' | ||
if File.exists? cf | ||
custmz = YAML.load_file(cf) | ||
ShoesDeps = custmz['Deps'] | ||
EXT_RUBY = custmz['Ruby'] | ||
GtkDeps = custmz['GtkLoc'] ? custmz['GtkLoc'] : ShoesDeps | ||
ENABLE_MS_THEME = custmz['MS-Theme'] == true | ||
APP['GDB'] = 'basic' if custmz['Debug'] == true | ||
APP['GEMLOC'] = custmz['Gemloc'] if custmz['Gemloc'] | ||
APP['EXTLOC'] = custmz['Extloc'] if custmz['Extloc'] | ||
APP['EXTLIST'] = custmz['Exts'] if custmz['Exts'] | ||
APP['GEMLIST'] = custmz['Gems'] if custmz['Gems'] | ||
APP['INCLGEMS'] = custmz['InclGems'] if custmz['InclGems'] | ||
APP['VIDEO'] = true | ||
#APP['GTK'] = 'gtk+-3.0' | ||
APP['INSTALLER'] = custmz['Installer'] == 'qtifw'? 'qtifw' : 'nsis' | ||
APP['INSTALLER_LOC'] = custmz['InstallerLoc'] | ||
else | ||
abort "missing #{TGT_ARCH}-custom.yaml" | ||
end | ||
|
||
require_relative '../../switch_ruby' | ||
|
||
# Ruby doesn't do triplets like everyone else. | ||
arch_2_file = {'i386-mingw32.shared' => 'i386-mingw32'} | ||
# Match what Gem:: does (not what you think it should do) | ||
arch_2_gem = {'i386-mingw32.shared' => 'x86-mingw32', # mxe compiled ruby | ||
'i386-mingw32' => 'x86-mingw32' } # hand compiled ruby | ||
|
||
SHOES_TGT_ARCH = RbConfig::CONFIG['arch'] | ||
SHOES_GEM_ARCH = arch_2_gem[RbConfig::CONFIG['arch']] | ||
APP['RUBY_V'] = RbConfig::CONFIG['ruby_version'] | ||
# dll locations for mxe | ||
bindll = "#{ShoesDeps}/bin" | ||
basedll = "#{ShoesDeps}/basedll" | ||
gtkdll = "#{GtkDeps}/bin" | ||
APP['LIBPATHS'] = [bindll, "#{EXT_RUBY}/bin"] | ||
|
||
WINVERSION = "#{APP['VERSION']}-msw-32" | ||
WINFNAME = "#{APPNAME}-#{WINVERSION}" | ||
|
||
RUBY_HTTP = true | ||
|
||
DLEXT = "dll" | ||
# RbConfig doesn't have good values for these: | ||
CC = RbConfig::CONFIG['CC'] #"i686-w64-mingw32-gcc" | ||
STRIP = "#{RbConfig::CONFIG['STRIP']} -x" #"i686-w64-mingw32-strip -x" | ||
WINDRES = RbConfig::CONFIG['WINDRES'] #"i686-w64-mingw32-windres" | ||
PKG_CONFIG = "pkg-config" | ||
|
||
|
||
ENV['PKG_CONFIG_PATH'] = "#{ShoesDeps}/lib/pkgconfig" | ||
#gtk_pkg_path = "#{GtkDeps}/lib/pkgconfig/gtk+-3.0.pc" | ||
pkgruby ="#{EXT_RUBY}/lib/pkgconfig/#{RbConfig::CONFIG["ruby_pc"]}" | ||
|
||
WIN32_CFLAGS = [] | ||
WIN32_LDFLAGS = [] | ||
WIN32_LIBS = [] | ||
|
||
if APP['GDB'] | ||
WIN32_CFLAGS << "-g3 -O0" | ||
else | ||
WIN32_CFLAGS << "-O -Wall" | ||
end | ||
|
||
|
||
#GTK_CFLAGS = `#{PKG_CONFIG} --cflags gtk+-3.0 --define-variable=prefix=#{ShoesDeps}`.chomp | ||
#GTK_LDFLAGS = `#{PKG_CONFIG} --libs #{gtk_pkg_path} --define-variable=prefix=#{ShoesDeps}`.chomp | ||
CAIRO_CFLAGS = `#{PKG_CONFIG} --cflags glib-2.0 --define-variable=prefix=#{ShoesDeps}`.chomp + | ||
`#{PKG_CONFIG} --cflags cairo --define-variable=prefix=#{ShoesDeps}`.chomp | ||
CAIRO_LDFLAGS = `#{PKG_CONFIG} --libs cairo --define-variable=prefix=#{ShoesDeps}`.chomp | ||
PANGO_CFLAGS = `#{PKG_CONFIG} --cflags pango --define-variable=prefix=#{ShoesDeps}`.chomp | ||
PANGO_LDFLAGS = `#{PKG_CONFIG} --libs pango --define-variable=prefix=#{ShoesDeps}`.chomp | ||
PANGOCAIRO_CFLAGS = `#{PKG_CONFIG} --cflags pangocairo --define-variable=prefix=#{ShoesDeps}`.chomp | ||
PANGOCAIRO_LDFLAGS = `#{PKG_CONFIG} --libs pangocairo --define-variable=prefix=#{ShoesDeps}`.chomp | ||
|
||
#RUBY_LDFLAGS = " -Wl,-export-all-symbols -L#{EXT_RUBY}/lib -lmsvcrt-ruby230 " | ||
RUBY_LDFLAGS = " -Wl,-export-all-symbols -L#{EXT_RUBY}/lib -l#{RbConfig::CONFIG["RUBY_SO_NAME"]} " | ||
|
||
WIN32_CFLAGS << "-DSHOES_WIN32 -DRUBY_HTTP -DVIDEO" | ||
WIN32_CFLAGS << "-Wno-unused-but-set-variable -Wno-attributes" | ||
WIN32_CFLAGS << "-D__MINGW_USE_VC2005_COMPAT -DXMD_H -D_WIN32_IE=0x0500 -D_WIN32_WINNT=0x0501 -DWINVER=0x0501 -DCOBJMACROS" | ||
#WIN32_CFLAGS << GTK_CFLAGS | ||
WIN32_CFLAGS << CAIRO_CFLAGS | ||
WIN32_CFLAGS << PANGO_CFLAGS | ||
WIN32_CFLAGS << PANGOCAIRO_CFLAGS | ||
WIN32_CFLAGS << "-I#{ShoesDeps}/include/librsvg-2.0/librsvg " | ||
WIN32_CFLAGS << `pkg-config --cflags #{pkgruby} --define-variable=prefix=#{EXT_RUBY}`.chomp | ||
WIN32_CFLAGS << "-Ishoes" | ||
|
||
WIN32_LDFLAGS << "-lshell32 -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lcomctl32" | ||
WIN32_LDFLAGS << "-lgif -ljpeg -lfontconfig" | ||
WIN32_LDFLAGS << "-L#{ShoesDeps}/bin" | ||
WIN32_LDFLAGS << "-fPIC -shared" | ||
#WIN32_LDFLAGS << GTK_LDFLAGS | ||
WIN32_LDFLAGS << CAIRO_LDFLAGS | ||
WIN32_LDFLAGS << PANGO_LDFLAGS | ||
WIN32_LDFLAGS << PANGOCAIRO_LDFLAGS | ||
WIN32_LDFLAGS << RUBY_LDFLAGS | ||
|
||
WIN32_LIBS << RUBY_LDFLAGS | ||
WIN32_LIBS << CAIRO_LDFLAGS | ||
WIN32_LIBS << PANGO_LDFLAGS | ||
WIN32_LIBS << PANGOCAIRO_LDFLAGS | ||
WIN32_LIBS << "-L#{ShoesDeps}/lib -lrsvg-2 -lyaml -lpthread" | ||
|
||
# Cleaning up duplicates. Clunky? Hell yes! | ||
wIN32_CFLAGS = WIN32_CFLAGS.join(' ').split(' ').uniq | ||
wIN32_LDFLAGS = WIN32_LDFLAGS.join(' ').split(' ').uniq | ||
wIN32_LIBS = WIN32_LIBS.join(' ').split(' ').uniq | ||
|
||
LINUX_CFLAGS = wIN32_CFLAGS.join(' ') | ||
LINUX_LDFLAGS = wIN32_LDFLAGS.join(' ') | ||
LINUX_LIBS = wIN32_LIBS.join(' ') | ||
|
||
|
||
# keys for SOLOCS are globed so libgio libgio-2 libgio-2.0 are the same | ||
# see win_dep_find_and_copy() in Rakefile. Values in the hash are no longer used | ||
SOLOCS = { | ||
"#{RbConfig::CONFIG["RUBY_SO_NAME"]}" => "#{EXT_RUBY}/foobar-not-here/msvcrt-ruby230.dll", | ||
'libgif-7' => "#{bindll}/libgif-7.dll", | ||
'libjpeg-9' => "#{bindll}/libjpeg-9.dll", | ||
'libyaml-0-2' => "#{bindll}/libyaml-0-2.dll", | ||
'libiconv-2' => "#{bindll}/libiconv-2.dll", | ||
'libeay32' => "#{bindll}/libeay32.dll", | ||
'libgdbm-6' => "#{bindll}/libgdbm-4.dll", | ||
'ssleay32' => "#{bindll}/ssleay32.dll", | ||
'libepoxy-0' => "#{bindll}/libepoxy-0.dll", | ||
#'libgmp-10' => "#{basedll}/libgmp-10.dll", | ||
#'libgcc_s_dw2-1' => "#{basedll}/libgcc_s_dw2-1.dll", | ||
'libgcc_s_sjlj-1' => "{basedll}/libgcc_s_sjlj-1.dll", | ||
'libsqlite3' => "#{bindll}/libsqlite3-0.dll", | ||
'libexpat-1' => "", | ||
'libbz2' => "", | ||
'libpcre-1' => "", | ||
'libtiff-5' => '', | ||
'liblzma-5' => '', | ||
} | ||
|
||
|
||
SOLOCS.merge!( | ||
{ | ||
# 'libatk-1.0-0' => "#{bindll}/libatk-1.0-0.dll", | ||
'libcairo-2' => "#{bindll}/libcairo-2.dll", | ||
'libcairo-gobject-2' => "#{bindll}/libcairo-gobject-2.dll", | ||
'libffi-6' => "#{bindll}/libffi-6.dll", | ||
'libfontconfig-1' => "#{bindll}/libfontconfig-1.dll", | ||
'libfreetype-6' => "#{bindll}/libfreetype-6.dll", | ||
# 'libgdk_pixbuf-2.' => "#{bindll}/libgdk_pixbuf-2.0-0.dll", | ||
# 'libgio-2.0-0' => "#{bindll}/libgio-2.0-0.dll", | ||
'libglib-2.0-0' => "#{bindll}/libglib-2.0-0.dll", | ||
# 'libgmodule-2' => "#{bindll}/libgmodule-2.0-0.dll", | ||
'libgobject-2' => "#{bindll}/libgobject-2.0-0.dll", | ||
# 'libgdk-3-0' => "#{gtkdll}/libgdk-3-0.dll", | ||
# 'libgtk-3-0' => "#{gtkdll}/libgtk-3-0.dll", | ||
# 'libpixman-1-0' => "#{bindll}/libpixman-1-0.dll", | ||
# 'libintl-8' => "#{bindll}/libintl-8.dll", | ||
'libpango-1.0-0' => "#{bindll}/libpango-1.0-0.dll", | ||
'libpangocairo-1' => "#{bindll}/libpangocairo-1.0-0.dll", | ||
'libpangoft2-1' => "#{bindll}/libpangoft2-1.0-0.dll", | ||
'libpangowin32-1' => "#{bindll}/libpangowin32-1.0-0.dll", | ||
'libharfbuzz-0' => "#{bindll}/libharfbuzz-0.dll", | ||
'libpng16-16' => "#{bindll}/libpng16-16.dll", | ||
'libcroco-0.6-3' => "#{bindll}/libcroco-0.6-3.dll", | ||
'librsvg-2-2' => "#{bindll}/librsvg-2-2.dll", | ||
'libxml2' => "#{bindll}/libxml2-2.dll", | ||
'libgthread-2' => "#{bindll}/libgthread-2.0-0.dll", | ||
'zlib1' => "#{bindll}/zlib1.dll", | ||
'libwinpthread-1' => "#{basedll}/libwinpthread-1.dll", | ||
} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# package ShoesDeps into just the minimum to upload | ||
# expect symlink trouble with include/x --> lib/x/include/ ? | ||
desc "package mingw dependencies" | ||
task :packdeps do | ||
# ugly - build a ShoesDeps.zip in dist | ||
rm_rf 'mingwdeps' | ||
mkdir_p 'mingwdeps' | ||
cp "#{ShoesDeps}/README.txt", 'mingwdeps' | ||
bin = 'mingwdeps/bin' | ||
mkdir_p bin | ||
Dir.glob("#{ShoesDeps}/bin/*.dll") { |f| | ||
cp f, bin | ||
} | ||
Dir.glob("#{ShoesDeps}/bin/fc*.exe") {|f| | ||
cp f, bin | ||
} | ||
cp "#{ShoesDeps}/bin//gtk-update-icon-cache.exe", bin | ||
cp "#{ShoesDeps}/bin/pkg-config.exe", bin | ||
sh "cp -a #{ShoesDeps}/include mingwdeps" | ||
cp_r "#{ShoesDeps}/etc", 'mingwdeps' | ||
cp_r "#{ShoesDeps}/lib", 'mingwdeps' | ||
mkdir_p 'mingwdeps/share' | ||
cp_r "#{ShoesDeps}/share/fontconfig", 'mingwdeps/share' | ||
cp_r "#{ShoesDeps}/share/glib-2.0", 'mingwdeps/share' | ||
cp_r "#{ShoesDeps}/share/themes", 'mingwdeps/share' | ||
cp_r "#{ShoesDeps}/share/xml", 'mingwdeps/share' | ||
cp_r "#{ShoesDeps}/share/fontconfig", 'mingwdeps/share' | ||
cp_r "#{ShoesDeps}/share/icons", 'mingwdeps/share' | ||
Dir.chdir('mingwdeps') do | ||
sh "zip -r ShoesDeps.zip README.txt etc lib share include bin" | ||
end | ||
puts "Done" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# This is a big gulp of copying. | ||
require 'fileutils' | ||
module Make | ||
include FileUtils | ||
|
||
# Windows cross compile. Copy the static stuff, Copy the ruby libs | ||
# Then copy the deps. | ||
def static_setup (so_list) | ||
$stderr.puts "setup: dir=#{`pwd`}" | ||
rbvt = APP['RUBY_V'] | ||
rbvm = rbvt[/^\d+\.\d+/] | ||
# remove leftovers from previous rake. | ||
#rm_rf "#{TGT_DIR}/lib" | ||
#rm_rf "#{TGT_DIR}/etc" | ||
#rm_rf "#{TGT_DIR}/share" | ||
#rm_rf "#{TGT_DIR}/conf.d" | ||
mkdir_p "#{TGT_DIR}/fonts" | ||
cp_r "fonts", "#{TGT_DIR}" | ||
mkdir_p "#{TGT_DIR}/lib" | ||
cp "lib/shoes.rb", "#{TGT_DIR}/lib" | ||
cp_r "lib/shoes", "#{TGT_DIR}/lib" | ||
cp_r "lib/exerb", "#{TGT_DIR}/lib" | ||
cp_r "lib/package", "#{TGT_DIR}/lib" | ||
cp_r "samples", "#{TGT_DIR}/samples" | ||
cp_r "static", "#{TGT_DIR}/static" | ||
cp "README.md", "#{TGT_DIR}/README.txt" | ||
cp "CHANGELOG", "#{TGT_DIR}/CHANGELOG.txt" | ||
cp "COPYING", "#{TGT_DIR}/COPYING.txt" | ||
#mkdir_p "#{TGT_DIR}/lib" | ||
cp_r "#{EXT_RUBY}/lib/ruby", "#{TGT_DIR}/lib", remove_destination: true | ||
# copy include files | ||
mkdir_p "#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}" | ||
cp_r "#{EXT_RUBY}/include/ruby-#{rbvt}/", "#{TGT_DIR}/lib/ruby/include" | ||
if APP['LIBPATHS'] | ||
win_dep_find_and_copy( APP['LIBPATHS'], so_list) | ||
else | ||
so_list.each_value do |path| | ||
cp "#{path}", "#{TGT_DIR}" | ||
end | ||
end | ||
if rbvm != '2.3' | ||
ssl_copy() | ||
end | ||
# copy/setup etc/share | ||
mkdir_p "#{TGT_DIR}/share/glib-2.0/schemas" | ||
cp "#{ShoesDeps}/share/glib-2.0/schemas/gschemas.compiled" , | ||
"#{TGT_DIR}/share/glib-2.0/schemas" | ||
cp_r "#{ShoesDeps}/share/fontconfig", "#{TGT_DIR}/share" | ||
cp_r "#{ShoesDeps}/share/themes", "#{TGT_DIR}/share" | ||
cp_r "#{ShoesDeps}/share/xml", "#{TGT_DIR}/share" | ||
cp_r "#{ShoesDeps}/share/icons", "#{TGT_DIR}/share" | ||
|
||
cp_r "#{ShoesDeps}/etc", TGT_DIR | ||
if ENABLE_MS_THEME | ||
ini_path = "#{TGT_DIR}/etc/gtk-3.0" | ||
mkdir_p ini_path | ||
File.open "#{ini_path}/settings.ini", mode: 'w' do |f| | ||
f.write "[Settings]\n" | ||
f.write "#gtk-theme-name=win32" | ||
end | ||
end | ||
#mkdir_p "#{TGT_DIR}/lib" | ||
#cp_r "#{ShoesDeps}/lib/gtk-3.0", "#{TGT_DIR}/lib" | ||
bindir = "#{ShoesDeps}/bin" | ||
if File.exist?("#{bindir}/gtk-update-icon-cache-3.0.exe") | ||
cp "#{bindir}/gtk-update-icon-cache-3.0.exe", | ||
"#{TGT_DIR}/gtk-update-icon-cache.exe" | ||
else | ||
#cp "#{bindir}/gtk-update-icon-cache.exe", TGT_DIR | ||
end | ||
cp APP['icons']['win32'], "shoes/appwin32.ico" | ||
end | ||
|
||
# if ruby is from RubyInstaller then copy some dlls from there | ||
def ssl_copy() | ||
if File.exist? "#{EXT_RUBY}/lib/engines" | ||
puts "SSL copying from RubyInstaller #{ShoesDeps} - NOT from mxe" | ||
abort | ||
elsif File.exist? "#{ShoesDeps}/bin/engines" | ||
puts "SSL copying from MXE" | ||
mkdir_p "#{TGT_DIR}/lib" | ||
cp_r "#{ShoesDeps}/bin/engines/padlock.dll", TGT_DIR | ||
cp "#{ShoesDeps}/bin/libcrypto-1_1.dll", TGT_DIR | ||
cp "#{ShoesDeps}/bin/libssl-1_1.dll", TGT_DIR | ||
else | ||
puts "Can't find the openssl-1.1 libs" | ||
abort | ||
end | ||
end | ||
end | ||
|
Oops, something went wrong.