[26571] users/pipping

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 28 08:37:10 PDT 2007


Revision: 26571
          http://trac.macosforge.org/projects/macports/changeset/26571
Author:   pipping at macports.org
Date:     2007-06-28 08:37:10 -0700 (Thu, 28 Jun 2007)

Log Message:
-----------
= merge.rb =
handle header files(1)
add /usr/lib/libiconv.2.dylib to whitelist
minimal cleanup

(1) maybe this can be beautified a little by checking if the differences
exist only between 32bit and 64bit, then making use of `#ifdef __LP64__` instead

= build.coreutils.sh =
build coreutils for *four* architectures
clean up / push whatever possible into a loop

Modified Paths:
--------------
    users/pipping/build_coreutils.sh
    users/pipping/merge.rb

Modified: users/pipping/build_coreutils.sh
===================================================================
--- users/pipping/build_coreutils.sh	2007-06-28 15:22:46 UTC (rev 26570)
+++ users/pipping/build_coreutils.sh	2007-06-28 15:37:10 UTC (rev 26571)
@@ -8,39 +8,26 @@
 cd $TARGET
 curl -O ftp://ftp.gnu.org/gnu/coreutils/coreutils-6.9.tar.bz2
 
+for arch in ppc ppc64 i386 x86_64 ; do
+  cd $TARGET
+  mkdir build_${arch}
+  tar -C build_${arch} -xjf coreutils-6.9.tar.bz2
+  cd build_${arch}/coreutils-6.9
 
-mkdir build_ppc
-tar -C build_ppc -xjf coreutils-6.9.tar.bz2
-cd build_ppc/coreutils-6.9
+  export CPPFLAGS="-I/Developer/SDKs/MacOSX10.4u.sdk/usr/include -arch ${arch}"
+  export LDFLAGS="-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib -arch ${arch}"
 
-env \
-    CPPFLAGS="-I/Developer/SDKs/MacOSX10.4u.sdk/usr/include -arch ppc" \
-    LDFLAGS="-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib -arch ppc" \
-  ./configure \
-    --quiet \
-    --host=powerpc-apple-darwin8 \
-    ac_cv_c_bigendian=yes && 
-  make $MAKEOPTS && 
-  make $MAKEOPTS install DESTDIR=$TARGET/ppc
+  if [ "${arch}" == "${arch/ppc/}" ]; then
+    ./configure --quiet --host=${arch}-apple-darwin ac_cv_c_bigendian=yes
+  else
+    ./configure --quiet --host=${arch}-apple-darwin ac_cv_c_bigendian=no
+  fi
 
-cd $TARGET
-rm -rf build_ppc
+  make $MAKEOPTS
+  make $MAKEOPTS install DESTDIR=$TARGET/${arch}
 
+  cd $TARGET
+  rm -rf build_${arch}
+done
 
-mkdir build_i386
-tar -C build_i386 -xjf coreutils-6.9.tar.bz2
-cd build_i386/coreutils-6.9
-env \
-      CPPFLAGS="-I/Developer/SDKs/MacOSX10.4u.sdk/usr/include -arch i386" \
-      LDFLAGS="-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib -arch i386" \
-  ./configure \
-    --quiet \
-    --host=i686-apple-darwin8 \
-    ac_cv_c_bigendian=no &&
-  make $MAKEOPTS &&
-  make $MAKEOPTS install DESTDIR=$TARGET/i386
-
-cd $TARGET
-rm -rf build_i386
-
 rm coreutils-6.9.tar.bz2

Modified: users/pipping/merge.rb
===================================================================
--- users/pipping/merge.rb	2007-06-28 15:22:46 UTC (rev 26570)
+++ users/pipping/merge.rb	2007-06-28 15:37:10 UTC (rev 26571)
@@ -26,7 +26,7 @@
 require 'set'
 
 ###
-# we need GNU file with Apple's patches applied, available here:
+# we need GNU File with Apple's patches applied, available here:
 # http://www.opensource.apple.com/darwinsource/Current/file-6.2/patches/
 FILE="/usr/bin/file"
 
@@ -72,15 +72,15 @@
       opts.on('-v', '--verbose', 'enable verbose output') do
         self[:verbose] = true
       end
-      
+
       opts.on_tail('-h', '--help', 'display this help and exit') do
         puts opts
         exit
       end
     end
 
-    opts.parse!(args)   
-  end  
+    opts.parse!(args)
+  end
 end
 
 arguments = MergeArguments.new(ARGV)
@@ -111,7 +111,7 @@
   )
   if !File.exist?(lipotarget) or args[:force]
     puts lipocmd if args[:verbose]
-    system lipocmd if !args[:dry_run]
+    system lipocmd unless args[:dry_run]
   end
 end
 
@@ -173,7 +173,13 @@
                   case File.basename path
                   # TODO: more cases
                   when /\.h$/, /\.hpp$/
-                    # TODO: deal with header files
+                    open(File.join(arguments[:output], path), 'w') {|file|
+                      ARGS.each {|arch|
+                        file.printf "#ifdef __%s__\n", arch
+                        file.puts open(File.join(arguments[:root],arch,path), 'r').read
+                        file.puts '#endif'
+                      }
+                    }
                   else
                     file_output = %x{#{FILE} -b "#{File.join(arguments[:root],ARGS[0],path)}"}.chomp
                     case file_output
@@ -200,18 +206,27 @@
                         }
                           links=Hash.new
                           ARGS.each {|my_arch|
-                            links[my_arch]=%x{#{
-                              my_arch =~ /64$/ ? 'otool64' : 'otool'
-                            } -arch #{my_arch} -LX #{
-                              File.join(arguments[:root],my_arch,path)}
-                            }.split("\n").collect {|x|
-                              x.lstrip.gsub(
+                            links[my_arch]=%x{
+                              #{
+                                my_arch =~ /64$/ ? 'otool64' : 'otool'
+                              } -arch #{my_arch} -LX #{
+                                File.join(arguments[:root],my_arch,path)
+                              }
+                            }.split("\n").collect {|depline|
+                              depline.lstrip.gsub(
                                 / \(compatibility version \d+(\.\d+)*, current version \d+(\.\d+)*\)/, ''
                               )
                             }.to_set
                           }
+                          # TODO: should /usr/lib be excluded completely?
+                          # pro: no need for an explicit whitelist(?)
+                          # question: do we care if something was linked
+                          # against /usr/lib/<libncurses,...>?
+                          # if another file was instead linked against
+                          # /opt/local/lib/<...> *that* would show up!
                           whitelist=%w{
                             /usr/lib/libgcc_s.1.dylib
+                            /usr/lib/libiconv.2.dylib
                             /usr/lib/libmx.A.dylib
                             /usr/lib/libmx.A_debug.dylib
                             /usr/lib/libmx.A_profile.dylib

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070628/d187a437/attachment.html


More information about the macports-changes mailing list