Ticket #36552: patch-Portfile.diff

File patch-Portfile.diff, 2.5 KB (added by NicosPavlov, 12 years ago)

Patch to kdelibs4 portfile with no_root variant

  • Portfile

    old new  
    66
    77name                kdelibs4
    88version             4.8.3
    9 revision            3
     9revision            4
    1010categories          kde kde4
    1111maintainers         sharky michaelld
    1212license             GPL-2+
     
    7676"
    7777}
    7878
     79set startup_root ""
     80
    7981pre-activate {
    8082    if {![catch {set vers [lindex [registry_active kde4-runtime] 0]}]
    8183        && [vercmp [lindex $vers 1] 4.8.1] < 0} {
     
    9193    xinstall -d ${destroot}${prefix}/include/nepomuk
    9294    eval xinstall -m 644 [glob ${worksrcpath}/nepomuk/core/*.h] \
    9395        ${destroot}${prefix}/include/nepomuk
     96   
     97    xinstall -d -m 755 ${destroot}${prefix}/Library/LaunchAgents
     98    xinstall -m 644 ${filespath}/org.macports.kdecache.plist \
     99        ${destroot}${prefix}/Library/LaunchAgents
     100    reinplace "s|%PREFIX%|${prefix}|g" \
     101        ${destroot}${prefix}/Library/LaunchAgents/org.macports.kdecache.plist
     102    reinplace "s|%APPLICATIONS_DIR%|${applications_dir}|g" \
     103        ${destroot}${prefix}/Library/LaunchAgents/org.macports.kdecache.plist
     104   
     105    xinstall -d -m 755 ${destroot}${startup_root}/Library/LaunchAgents
     106    ln -s ${prefix}/Library/LaunchAgents/org.macports.kdecache.plist ${destroot}${startup_root}/Library/LaunchAgents
     107}
     108
     109post-activate {
     110    if { ![variant_isset no_root] } {
     111        file attributes ${prefix}/Library/LaunchAgents/org.macports.kdecache.plist -owner root -group wheel
     112    }
     113}
     114
     115notes " ##########################################################################
     116 # An agent to provide communication between KDE programs must be started.
     117 # To start it run the following command:
     118 # launchctl load -w ${startup_root}/Library/LaunchAgents/org.macports.kdecache.plist
     119 ##########################################################################"
     120
     121variant no_root description {Run the kde case agent as MacPorts install user.} {
     122    pre-fetch {
     123        if { ${install.user}=="root" || ${install.group}=="wheel" } {
     124            ui_error "The kde cache agent should not be run as root."
     125            error "Please do not use this variant with your MacPorts configuration."
     126        }
     127    }
     128
     129    set startup_root  [join [lrange [exec /usr/bin/dscl . -read Users/${install.user} NFSHomeDirectory] 1 end]]
     130    # Files are installed into user's startup directory.
     131    destroot.violate_mtree  yes
    94132}
    95133
    96134livecheck.url       http://kde.mirrors.hoobly.com/stable/latest/src/