[ts-gen] Compiling on an OS/X

R P Herrold herrold at owlriver.com
Mon Dec 31 11:04:29 EST 2007


On Mon, 31 Dec 2007, R P Herrold wrote:

Replying to myself, after Jason's help, I think the patch 
would run like this:

-------------------------start the patch------------------

--- ./bin/rdtsc_time.rb-ORIG	2007-12-31 10:25:52.000000000 -0500
+++ ./bin/rdtsc_time.rb	2007-12-31 10:27:20.000000000 -0500
@@ -28,10 +28,10 @@

      def triple()
          return arch =~ /..*x86_64.*/ ? 'i64' :
-               arch =~ /.*i[56]86.*/ ? 'i32' :
+               arch =~ /.*i[56]86.*/ &&
+               arch =~ /^.*Darwin..*/ ? 'i32' :
                 arch =~ /.*sparc64.*/ ? 's64' :
-               arch =~ /.*Darwin..*/ &&
-               arch =~ /.*powerpc.*/ ? 'osx' : '' ;
+               arch =~ /.*Darwin..*/ ? 'osx' : '' ;
      end

  # for 1st and 2nd cases, accumulate lines in list, and
-------------------------end the patch------------------

a copy is temporarily at:

wget -O rdtsc_time.rb-Darwin.patch \
 	http://www.herrold.com/rdtsc_time.rb-Darwin.patch

if one wishes to avoid the scrape and paste.

I altered my build script to have this stanza to apply the 
patch.  It runs a directory above the unpacked tarball, (which 
is what directory $BAS is); I keep patches down a level in a 
directory of their own.

#       ruby patches
#
cp $BAS/bin/rdtsc_time.rb $BAS/bin/rdtsc_time.rb.orig
[ -e ./patch/rdtsc_time.rb-Darwin.patch ] && {
         cp patch/rdtsc_time.rb-Darwin.patch $BAS/bin
         cd $BAS/bin
         patch < rdtsc_time.rb-Darwin.patch 1>&2
         cd ../..
         } || {
         echo "Error: cannot see rdtsc_time.rb-Darwin.patch " 1>&2
         exit 1
         }
echo "+-------------------------------------------------------------+" 1>&2
#

I get a clean build on x86_64 with the patch; as well as on my 
OS/X ppc

emac:~/shim herrold$ scp centos-5:~/shim/rdtsc_time.rb-Darwin.patch .
emac:~/shim herrold$ cd shim-071228
emac:~/shim/shim-071228 herrold$ cp ../rdtsc_time.rb-Darwin.patch .
emac:~/shim/shim-071228 herrold$ patch -p1 < rdtsc_time.rb-Darwin.patch
patching file bin/rdtsc_time.rb

but it breaks on non-Dawrin i[36]86, so I suspect my ruby is 
flawed, in inverting the comparison.

In any event as a temporary workaround, on Darwin 
(irrespective of powerpc or i386 returns), it may work.

Please advise.  We'll get a formal change in the permanent 
sources later this week, once we get it working with a patch.

-- Russ Herrold
-------------- next part --------------
--- ./bin/rdtsc_time.rb-ORIG	2007-12-31 10:25:52.000000000 -0500
+++ ./bin/rdtsc_time.rb	2007-12-31 10:27:20.000000000 -0500
@@ -28,10 +28,10 @@
 
     def triple()
         return arch =~ /..*x86_64.*/ ? 'i64' :
-               arch =~ /.*i[56]86.*/ ? 'i32' :
+               arch =~ /.*i[56]86.*/ &&
+               arch =~ /^.*Darwin..*/ ? 'i32' :
                arch =~ /.*sparc64.*/ ? 's64' :
-               arch =~ /.*Darwin..*/ &&
-               arch =~ /.*powerpc.*/ ? 'osx' : '' ;
+               arch =~ /.*Darwin..*/ ? 'osx' : '' ;
     end
 
 # for 1st and 2nd cases, accumulate lines in list, and


More information about the ts-general mailing list