Changes between Initial Version and Version 1 of howto/ShareArchives


Ignore:
Timestamp:
Jun 25, 2008, 3:09:37 AM (16 years ago)
Author:
alex.malinovich@…
Comment:

Original writeup

Legend:

Unmodified
Added
Removed
Modified
  • howto/ShareArchives

    v1 v1  
     1[wiki:howto <- Back to the HOWTO section]
     2
     3= Sharing Archives =
     4
     5 * Audience: Users who want to share binary archives between machines
     6 * Requires: MacPorts >= ?? (whenever archive support was added)
     7
     8== Introduction ==
     9
     10For those of you fortunate enough to have access to more than one Mac to work from, here's a quick way to save yourself '''a lot''' of compiling time. What we're basically going to do here is configure macports to use the archive system, and then copy over archives as we need them. (Or, you can use rsync to always keep the two in sync.) The other thing we'll also go over is how to share archives between two machines that use a different architecture.
     11
     12== Common Configuration Steps ==
     13
     14=== '''Enable Archive Mode''' ===
     15
     16For starters, lets edit your macports.conf file and enable archive mode. Your macports.conf is found in ${prefix}/etc/macports/macports.conf. For most people, this will be /opt/local/etc/macports/macports.conf. Edit this file in your editor of choice and look for "portarchivemode". It will probably be set to "no" by default. Change it to a "yes" and then save the file.
     17
     18== Share archives between identical architectures ==
     19
     20If you're using two machines that are both the same architecture (i386 or powerpc) then you have it relatively easy. Lets say that you want to copy a compiled copy of sqlite3 over to your other machine. We'll use the terms 'source' and 'target' to describe the two machines here. The source is the one that already has it installed.
     21=== Build the archive on the source machine ===
     22{{{
     23sudo port archive sqlite3
     24}}}
     25=== Install the archive on the target machine ===
     26Now if you look on your source machine in ${prefix}/var/macports/packages/darwin/${arch} (where ${arch} is either i386 or powerpc) you should find a file named 'sqlite3-x.x.x_x.i386.tgz'. (The x's are the version number.) Copy that file to the same location on your target machine. Now on the target do:
     27{{{
     28sudo port unarchive sqlite3
     29}}}
     30followed by:
     31{{{
     32sudo port install sqlite3
     33}}}
     34And you're done! Easy huh? :)
     35
     36Note: AFAIK the unarchive step should '''not''' be necessary, but I've been unable to get it to work without it. If you have more information on this please feel free to post it here.
     37
     38== Share archives between '''different''' architectures ==
     39
     40'''WARNING!!!''' Sharing archives between different architectures ''could'', in theory, seriously b0rk your system! You have been warned!
     41
     42Now, here's the fun part. Say you have an i386 machine and a powerpc machine. Chances are that the i386 machine is a fair bit faster. But you can't share binaries between them... or can you? Thanks to the '''+universal''' variant, it's possible. Here's a good primer on [[wiki:howto/buildUniversal building universal binaries]].
     43
     44Unfortunately, just doing this is not enough. The archive system still knows where the archive was built, so by default a powerpc system will not use an i386 archive and vice versa. So what do we do? Well, we start with the simple steps. We'll be using the same example as above (sqlite3) going from a source i386 machine to a target powerpc machine.
     45
     46=== Build the archive on the source machine ===
     47{{{
     48sudo port archive sqlite3 +universal
     49}}}
     50=== Install the archive on the target machine ===
     51Now we're going to copy the file to the same location on the target machine. On our source machine we're going to find the file {{{/opt/local/var/macports/packages/darwin/i386/sqlite3-x.x.x_x+universal.i386.tgz}}} We're going to copy that file to the target machine. But the target won't have the appropriate directory, since it's a different architecture. So we're going to copy it into {{{/opt/local/var/macports/packages/darwin/powerpc/}}} instead.
     52
     53You'll also notice that the archive has the architecture in the name. So we'll need to change that as well. Just rename the file and change i386 to powerpc.
     54
     55Finally, we can proceed with the installation:
     56{{{
     57sudo port unarchive sqlite3 +universal
     58}}}
     59followed by:
     60{{{
     61sudo port install sqlite3 +universal
     62}}}
     63Note that we're specifying the variant in both cases. Otherwise the commands wouldn't find the archive file and this wouldn't work. (Because the archive file has +universal in the name.)
     64
     65So that's it! Enjoy! :)
     66[wiki:howto <- Back to the HOWTO section]