diff -ur allinoneruby-0.1.1.tar.gz/allinoneruby/README allinoneruby-0.2.0.tar.gz/allinoneruby/README --- allinoneruby-0.1.1.tar.gz/allinoneruby/README 2004-07-26 23:13:29.000000000 +0200 +++ allinoneruby-0.2.0.tar.gz/allinoneruby/README 2004-12-08 10:21:38.000000000 +0100 @@ -2,7 +2,9 @@ The latter is just for playing with the internals. Both are available on the site. - Usage: ruby init.rb [-d|-w|--ruby|--rubyw] + Usage: ruby init.rb [-d|-w|--ruby|--rubyw] [-s|--site] + +On Linux, there´s no difference between ruby and rubyw. For more information, see -http://www.erikveen.dds.nl/allinoneruby/ . +http://www.erikveen.dds.nl/allinoneruby/index.html . diff -ur allinoneruby-0.1.1.tar.gz/allinoneruby/ev/dependencies.rb allinoneruby-0.2.0.tar.gz/allinoneruby/ev/dependencies.rb --- allinoneruby-0.1.1.tar.gz/allinoneruby/ev/dependencies.rb 2004-08-04 23:58:20.000000000 +0200 +++ allinoneruby-0.2.0.tar.gz/allinoneruby/ev/dependencies.rb 2004-12-27 13:34:11.000000000 +0100 @@ -1,6 +1,6 @@ def dlls(file, path=File.dirname(file)) - # Only the dependencies in the same directory as the executable. + # Only the dependencies in the same directory as the executable or the given directory. todo = [] res = [] @@ -30,3 +30,44 @@ res end + +def ldds(file, notthedefaults=true) + + # All dependencies. + + todo = [] + res = [] + tempfile = "/tmp/ev.dependencies.%d.tmp" % Process.pid + + todo << File.expand_path(file) + + while todo.length > 0 + todo2 = todo + todo = [] + + todo2.each do |file| + File.copy(file, tempfile) # Libraries on Debian are no executables. + File.chmod(0755, tempfile) + + `ldd #{tempfile}`.split(/\r*\n/).collect{|line| line.split(/\s+/)[3]}.each do |lib| + if not lib.nil? and File.file?(lib) and not res.include?(lib) + todo << lib + res << lib + end + end + + File.delete(tempfile) + end + end + + # http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/rlibraries.html + # http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/IA32/spec/rlibraries.html + + lsb_common = ["libX11.so.6", "libXt.so.6", "libGL.so.1", "libXext.so.6", "libICE.so.6", "libSM.so.6", "libdl.so.2", "libcrypt.so.1", "libz.so.1", "libncurses.so.5", "libutil.so.1", "libpthread.so.0", "libpam.so.0", "libgcc_s.so.1"] + lsb_ia32 = ["libm.so.6", "libdl.so.2", "libcrypt.so.1", "libc.so.6", "libpthread.so.0", "ld-lsb.so.1"] + lsb = lsb_common + lsb_ia32 + + res.delete_if{|s| lsb.include?(File.basename(s))} if notthedefaults + + res +end diff -ur allinoneruby-0.1.1.tar.gz/allinoneruby/ev/ftools.rb allinoneruby-0.2.0.tar.gz/allinoneruby/ev/ftools.rb --- allinoneruby-0.1.1.tar.gz/allinoneruby/ev/ftools.rb 2004-08-04 23:58:20.000000000 +0200 +++ allinoneruby-0.2.0.tar.gz/allinoneruby/ev/ftools.rb 2004-12-27 13:34:11.000000000 +0100 @@ -54,9 +54,11 @@ end def self.find(entry=nil, mask=nil) - entry = @dir if entry.nil? + entry = "." if entry.nil? - entry.gsub!(/[\/\\]*$/, "") unless entry.nil? + entry = entry.gsub!(/[\/\\]*$/, "") unless entry.nil? + + mask = /^#{mask}$/i if mask.kind_of?(String) res = [] @@ -65,11 +67,19 @@ res += ["%s/" % entry] if mask.nil? or entry =~ mask - Dir.chdir(entry) - Dir.new(".").each do |e| - res += Dir.find(e, mask).collect{|e| entry+"/"+e} unless [".", ".."].include?(e) + begin + Dir.chdir(entry) + + begin + Dir.new(".").each do |e| + res += Dir.find(e, mask).collect{|e| entry+"/"+e} unless [".", ".."].include?(e) + end + ensure + Dir.chdir(pdir) end - Dir.chdir(pdir) + rescue Errno::EACCES => error + puts error + end else res += [entry] if mask.nil? or entry =~ mask end @@ -82,6 +92,7 @@ def self.rollbackup(file, mode=nil) backupfile = file + ".RB.BACKUP" controlfile = file + ".RB.CONTROL" + res = nil File.touch(file) unless File.file?(file) @@ -107,10 +118,10 @@ if block_given? if mode.nil? - yield + res = yield else File.open(file, mode) do |f| - yield(f) + res = yield(f) end end end @@ -122,15 +133,17 @@ # Return, like File.open - if block_given? - return nil - else - return File.open(file, (mode or "r")) - end + res = File.open(file, (mode or "r")) unless block_given? + + res end def self.touch(file) - File.open(file, "a"){|f|} + if File.exists?(file) + File.utime(Time.now, File.mtime(file), file) + else + File.open(file, "a"){|f|} + end end def self.which(file) diff -ur allinoneruby-0.1.1.tar.gz/allinoneruby/ev/oldandnewlocation.rb allinoneruby-0.2.0.tar.gz/allinoneruby/ev/oldandnewlocation.rb --- allinoneruby-0.1.1.tar.gz/allinoneruby/ev/oldandnewlocation.rb 2004-08-04 23:58:20.000000000 +0200 +++ allinoneruby-0.2.0.tar.gz/allinoneruby/ev/oldandnewlocation.rb 2004-12-27 13:34:11.000000000 +0100 @@ -1,5 +1,27 @@ +temp = (ENV["TMPDIR"] or ENV["TMP"] or ENV["TEMP"] or "/tmp").gsub(/\\/, "/") +dir = "#{temp}/oldandnewlocation.#{Process.pid}" + ENV["OLDDIR"] = Dir.pwd unless ENV.include?("OLDDIR") ENV["NEWDIR"] = File.dirname($0) unless ENV.include?("NEWDIR") +ENV["TEMPDIR"] = dir unless ENV.include?("TEMPDIR") + +class Dir + def self.rm_rf(entry) + if File.ftype(entry) == "directory" + pdir = Dir.pwd + + Dir.chdir(entry) + Dir.new(".").each do |e| + Dir.rm_rf(e) if not [".", ".."].include?(e) + end + Dir.chdir(pdir) + + Dir.delete(entry) + else + File.delete(entry) + end + end +end begin oldlocation @@ -42,3 +64,37 @@ res end end + +begin + tmplocation +rescue NameError + dir = ENV["TEMPDIR"] + + Dir.rm_rf(dir) if File.directory?(dir) + Dir.mkdir(dir) + + at_exit do + if File.directory?(dir) + Dir.chdir(dir) + Dir.chdir("..") + Dir.rm_rf(dir) + end + end + + def tmplocation(file="") + dir = ENV["TEMPDIR"] + res = nil + + if block_given? + pdir = Dir.pwd + + Dir.chdir(dir) + res = yield + Dir.chdir(pdir) + else + res = File.expand_path(file, dir) unless file.nil? + end + + res + end +end diff -ur allinoneruby-0.1.1.tar.gz/allinoneruby/init.rb allinoneruby-0.2.0.tar.gz/allinoneruby/init.rb --- allinoneruby-0.1.1.tar.gz/allinoneruby/init.rb 2004-07-31 02:10:58.000000000 +0200 +++ allinoneruby-0.2.0.tar.gz/allinoneruby/init.rb 2004-12-26 20:09:53.000000000 +0100 @@ -10,8 +10,16 @@ s end +def linux? + not windows? and not cygwin? # Hack ??? +end + def windows? - not (target_os.downcase =~ /32/).nil? # Hack ??? + not (target_os.downcase =~ /32/).nil? # Hack ??? +end + +def cygwin? + not (target_os.downcase =~ /cyg/).nil? # Hack ??? end def target_os @@ -21,68 +29,141 @@ rubyw = false rubyw = false if (ARGV.include?("-d") or ARGV.include?("--ruby")) rubyw = true if (ARGV.include?("-w") or ARGV.include?("--rubyw")) +site = false +site = true if (ARGV.include?("-s") or ARGV.include?("--site")) ARGV.delete_if{|s| s =~ /^-/} +exefile = (ARGV.shift or (windows? ? "allinoneruby.exe" : "allinoneruby.bin")) + bindir1 = Config::CONFIG["bindir"] libdir1 = Config::CONFIG["libdir"] -bindir2 = "bin/" -libdir2 = "lib/" -exefile = (ARGV.shift or "allinoneruby.exe") +bindir2 = tmplocation("bin/") +libdir2 = tmplocation("lib/") rubylibdir1 = Config::CONFIG["rubylibdir"] +sitelibdir1 = Config::CONFIG["sitelibdir"] -raise "#{bindir2} already exists." if File.directory?(bindir2) -raise "#{libdir2} already exists." if File.directory?(libdir2) +Dir.mkdir(bindir2) unless File.directory?(bindir2) +Dir.mkdir(libdir2) unless File.directory?(libdir2) -Dir.mkdir(bindir2) -Dir.mkdir(libdir2) +if linux? + rubyexe = "#{bindir1}/ruby" +else + rubyexe = "#{bindir1}/ruby.exe" + rubywexe = "#{bindir1}/rubyw.exe" +end -rubyexe = "#{bindir1}/ruby.exe" -rubywexe = "#{bindir1}/rubyw.exe" +if linux? + tocopy = ldds(rubyexe) + tocopy << rubyexe if File.file?(rubyexe) +else + tocopy = dlls(rubyexe) + tocopy << rubyexe if File.file?(rubyexe) + tocopy << rubywexe if File.file?(rubywexe) +end -([rubyexe, rubywexe] + dlls(rubyexe)).each do |s1| +tocopy.each do |s1| file = File.basename(s1) s2 = File.expand_path(file, bindir2) - puts "Copying #{s1} ..." - File.copy(s1, s2) + $stderr.puts "Copying #{s1} ..." + File.copy(s1, s2) unless File.file?(s2) end -file = rubylibdir1[libdir1.length..-1].gsub(/^[\/\\]*/, "") -s1 = rubylibdir1 -s2 = File.expand_path(file, libdir2) +begin + file = rubylibdir1[libdir1.length..-1].gsub(/^[\/\\]*/, "") + s1 = rubylibdir1 + s2 = File.expand_path(file, libdir2) -puts "Copying #{s1}/ ..." -Dir.copy(s1, s2) + $stderr.puts "Copying #{s1}/ ..." + Dir.copy(s1, s2) unless File.directory?(s2) +end + +if site + file = sitelibdir1[libdir1.length..-1].gsub(/^[\/\\]*/, "") + s1 = sitelibdir1 + s2 = File.expand_path(file, libdir2) + + $stderr.puts "Copying #{s1}/ ..." + Dir.copy(s1, s2) unless File.directory?(s2) +end + +if linux? + tocopy = Dir.find(libdir2, /\.so$/).collect{|file| ldds(file)}.flatten.sort.uniq +else + tocopy = Dir.find(libdir2, /\.so$/).collect{|file| dlls(file, bindir1)}.flatten.sort.uniq +end -Dir.find(libdir2, /\.so$/).collect{|file| dlls(file, bindir1)}.flatten.sort.uniq.each do |s1| +tocopy.each do |s1| file = File.basename(s1) s2 = File.expand_path(file, bindir2) - puts "Copying #{s1} ..." - File.copy(s1, s2) + $stderr.puts "Copying #{s1} ..." + File.copy(s1, s2) unless File.file?(s2) end -puts "Creating #{exefile} ..." +eeeexe = "eee.exe" +eeeexe = "eeew.exe" if rubyw +eeeexe = "eee.bin" if linux? +appexe = exefile -File.open("allinoneruby.eee", "w") do |f| - f.puts "r bin" - f.puts "r lib" +$stderr.puts "Creating #{appexe} ..." + +if linux? + File.open(tmplocation("eee.sh"), "w") do |f| + f.puts "PDIR=$1;shift" + f.puts "DIR=$(pwd)" + f.puts "cd $PDIR" + f.puts " chmod +x bin/ruby" + f.puts " export PATH=$(pwd)/bin:$PATH" + f.puts " export LD_LIBRARY_PATH=$(pwd)/bin:LD_LIBRARY_PATH" + f.puts "cd $DIR" + f.puts "$*" + end +end + +File.open(tmplocation("eee.rb"), "w") do |f| + f.puts "lib = File.expand_path(File.dirname(__FILE__)) + ´/lib´" + f.puts "lib.sub!(/^.:/, ´/cygdrive/%s´ % $&[0..0].downcase) if lib =~ /^.:/" if cygwin? + f.puts "$:.clear" + $:.each do |s| + f.puts "$: << \"%s\"" % s.sub(libdir1, ´#{lib}´) + end +end +File.open(tmplocation("app.eee"), "w") do |f| rubyexe = "ruby.exe" rubyexe = "rubyw.exe" if rubyw + rubyexe = "ruby" if linux? - f.puts "c %tempdir%/#{bindir2}/#{rubyexe} %quotedparms%" + f.puts "r bin" + f.puts "r lib" + f.puts "f eee.sh" if linux? + f.puts "f eee.rb" + if linux? + f.puts "c source %tempdir%/eee.sh %tempdir% %tempdir%/bin/#{rubyexe} -r %tempdir%/eee.rb %quotedparms%" + elsif cygwin? + f.puts "c %tempdir%\\bin\\#{rubyexe} -r %tempdir1%/eee.rb %quotedparms%" + else + f.puts "c %tempdir%\\bin\\#{rubyexe} -r %tempdir%\\eee.rb %quotedparms%" + end end -eeeexe = "eee.exe" -eeeexe = "eeew.exe" if rubyw +from = newlocation(eeeexe) +to = tmplocation(eeeexe) -system(backslashes("./eee allinoneruby.eee #{exefile} #{eeeexe}")) +File.copy(from, to) unless from == to +File.chmod(0755, to) if linux? -oldlocation do - from = newlocation(exefile) - to = oldlocation(exefile) +tmplocation do + ENV["EEEEXE"] = eeeexe + ENV["EEEDIR"] = Dir.pwd - File.copy(from, to) unless from == to + system(backslashes("#{newlocation(linux? ? "eee.bin" : "eee")} app.eee #{appexe}")) end + +from = tmplocation(appexe) +to = oldlocation(appexe) + +File.copy(from, to) unless from == to +File.chmod(0755, to) if linux? Binary files allinoneruby-0.1.1.tar.gz/allinoneruby/eee.bin and allinoneruby-0.2.0.tar.gz/allinoneruby/eee.bin differ Binary files allinoneruby-0.1.1.tar.gz/allinoneruby/eee.exe and allinoneruby-0.2.0.tar.gz/allinoneruby/eee.exe differ Binary files allinoneruby-0.1.1.tar.gz/allinoneruby/eeew.exe and allinoneruby-0.2.0.tar.gz/allinoneruby/eeew.exe differ