[MacPorts] #21955: gtkmm does not build

MacPorts noreply at macports.org
Sat Oct 24 13:37:21 PDT 2009


#21955: gtkmm does not build
----------------------------+-----------------------------------------------
 Reporter:  hwr@…           |       Owner:  devans@…           
     Type:  defect          |      Status:  new                
 Priority:  Normal          |   Milestone:                     
Component:  ports           |     Version:  1.8.1              
 Keywords:                  |        Port:  gtkmm              
----------------------------+-----------------------------------------------

Comment(by macosx12345@…):

 I suggest the following changes (improvements?) to the script above:

 - use portfile=`port file $lib` instead of portfile=`locate $lib/Portfile
 | grep -v old` (then, there is no need to rebuild the locate database
 since we don't use locate)

 - do not use locate to find the sources.conf file, but rather some trick
 like:
         portprefix=`port dir wget | sed -e 's/var\/macports\/sources.*//'`
         sourcesconf=$portprefix/etc/macports/sources.conf
 (and make sure wget is installed before calling checksourcesconf() )
  Indeed, if there are several versions of Mac OS X on the hard disk (say
 10.4 and 10.5), using locate we are going to find the sources.conf file of
 the first one, which might not be the running one (I had the problem). I
 think the trick hereabove is more robust.

  By the way, suggestion for the maintainers of MacPorts: give a way to get
 the prefix from the port command (something like "port prefix" would
 return "/opt/local") or, maybe better, add a command like "echo" that
 expands the global TCL variables used in portfiles instead of the
 pseudoports (if this command is "tclexpand", then "port tclexpand
 '$prefix'" would return "/opt/local").

 - do not assume that the local repository is in $HOME but read the
 sources.conf file to find where it is (and complains if there is none, as
 did the script). The best would be to check all local repositories listed
 in sources.conf and see if there is one where the user has write access
 but... Here we assume there is only one.

 - accordingly, make all operations (cp, patch, and so on) in $localrep
 instead of explicitly using $HOME .

  Then, the script looks like:

 {{{
 #!/bin/sh
 #
 # apply diff patches of macports ticket #21955
 # author wf (contact via http://www.bitplan.com)
 # 2009-10-22
 # License: Public domain

 #
 # check the availability of a user specific Local Portfile repository
 # see 4.6 of http://guide.macports.org
 #
 checksourcesconf() {
         # get the sources conf
         echo "looking for sources.conf .."
         portprefix=`port dir wget | sed -e 's/var\/macports\/sources.*//'`
         sourcesconf=$portprefix/etc/macports/sources.conf
         echo "found $sourcesconf"
         echo "looking for local portfile repository"
         localrep=`grep ^file:// $sourcesconf | sed -e 's/^file:\/\///'`
         echo "found $localrep"
         if [ "$localrep" = "" ]
         then
           echo "you might want to add $HOME/ to $sourcesconf as outlined
 in 4.6 Local Portfile Repositories of http://guide.macports.org"
           exit 1
         else
           echo "good ..."
         fi
 }

 #
 # get the relative path of a portfile starting from "release" e.g.
 #
 getRelativePath() {
         # get relative path
         echo $1  | awk '
          # split with path separator
          BEGIN { FS="/";docollect=0 }
          {
            # loop over path parts
            for (i=1;i<NF;i++) {
                    # when collection is active
                    if (docollect) {
          path=path delim $i
                                  delim="/"
                          }
                    if ($i=="ports")
                            docollect=1
            }
                  print path
          }'
 }

 # install wget (if not done yet)
 echo "installing wget with sudo port install wget"
 sudo port install wget
 # do we have a local portfile repository?
 checksourcesconf
 # base url for the three attachments
 base="https://trac.macports.org/raw-attachment/ticket/21955"
 # get the current directory
 current=`pwd`
 # example url
 #  https://trac.macports.org/raw-attachment/ticket/21955/Portfile-
 glibmm.diff
 # get the three libraries
 for lib in gtkmm glibmm pangomm
 do
   # go back to directory where we started
   cd $current
         # the patch file we are looking for
   patch=Portfile-$lib.diff
         # check whether it's already there
   if [ -f $patch ]
         then
           echo "portfile patch $patch already downloaded"
         else
           echo "getting portfile patch $patch"
     wget --no-check-certificate  $base/$patch
         fi
         # apply patch to the given portfile by putting the patch
         # in the local repository
         # get the portfile
   portfile=`port file $lib`
         # if we found a portfile
         if [ "$portfile" = "" ]
         then
           echo "could not find original portfile for $lib"
         else
           echo "extracting relative path from $portfile"
           relpath=`getRelativePath $portfile`
                 echo "found $relpath"
                 echo "creating $relpath in $localrep if it does not exist
 yet"
                 if [ -d $localrep/$relpath ]
                 then
                   echo "$localrep/relpath already exists ... good"
                 else
                   echo "creating local repository path $relpath"
                   mkdir -p $localrep/$relpath
                 fi
                 # copy the portfile and patch file
                 echo "preparing patch of portfile for $lib"
                 cp $portfile $localrep/$relpath
                 cp $current/$patch $localrep/$relpath
                 echo "patching portfile for $lib"
                 cd $localrep/$relpath
                 patch Portfile $patch
    echo "you may later try to install $lib with sudo port install $lib"
         fi
 done
 # recreate ports index
 echo "recreating ports index from repository $localrep"
 cd $localrep
 portindex
 cd $current
 # finished
 }}}

-- 
Ticket URL: <http://trac.macports.org/ticket/21955#comment:14>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list