MacPorts: How do I rebuild of a specific port?

4

How do I force MacPorts to rebuild a specific port? I manually made a change to a MacPorts makefile to link in a specific library, but the missing symbol still cannot be found. Perhaps I need to rebuild, but how do I accomplish that without cleaning out the port (which deletes the file I modified)?

Motivation

Using MacPorts, I'm trying to install Qt (i.e., the qt4-mac-devel port) in Mac OS X Mountain Lion, but it fails with an undefined symbol (_objc_msgSend_fixup). A MacPorts ticket with a similar problem led me to inspect the offending QtWebKit.pro file under:

QT4_SRC=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac-devel/qt4-mac-devel/work/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/WebKit/qt/

The else predicate on line 254 checks for Darwin 11 or the 10.7 SDK (both of which are in Lion and unavailable in Mountain Lion). There is no predicate in the if-else list for Mountain Lion's WebKit.

254:  } else: equals(DARWIN_MAJOR_VERSION, "11") | contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10.7.sdk") {
255:    LIBS += $$SOURCE_DIR/../WebKitLibraries/libWebKitSystemInterfaceLion.a
256:  }
257:}

As a dirty quick fix, I changed line 254 to be an unconditional else. When I try to test this by re-running the port install command, I see the same original error. I'm pretty sure MacPorts is not even looking at my change because I reran the command after entering garbage text into the file and renaming the file. So, I'm now looking for a way to force the rebuild.

Things I've tried

  • Rebuild with the -s flag (to rebuild from source): sudo port install -s qt4-mac-devel
  • Rebuild after touching all Qt source files: find ${QT4_SRC} -name "*.cpp" -exec touch {} \;
  • Clean the port and then rebuild (no go...port clean deletes the QtWebKit.pro file, which contains my necessary changes)

Any suggestions? Thanks.

tony19

Posted 2012-08-09T22:27:29.697

Reputation: 463

Possible duplicate of Stack Overflow question http://stackoverflow.com/questions/10690159/sneaky-patching-source-with-macports/11907135

– Vortexfive – 2012-08-20T11:11:49.813

Answers

2

I would advise to create a local portfile for qt4-mac-devel and add your changes as a patch that is applied during the build process.

  1. Create a local portfile repository: howto
  2. Copy the qt4-mac-devel portfile directory (a directory called "qt4-mac-devel" (path "/opt/local/var/macports/sources/rsync.macports.org/release/ports/aqua/qt4-mac-devel/") containing the file "Portfile" and directory "files") into your local portfile repository
  3. Create a patch with your changes of the qt4-mac-devel source code and add it to the "files" directory.
  4. Edit your local qt4-mac-devel Portfile to include the line patchfiles yourpatch.diff
  5. Run portindex again in your local portfile repository
  6. Install qt4-mac-devel with port install -s qt4-mac-devel

I hope this can help.

Vortexfive

Posted 2012-08-09T22:27:29.697

Reputation: 148