Ticket #42342: Portfile-LibreCAD.diff

File Portfile-LibreCAD.diff, 2.8 KB (added by librecad@…, 11 years ago)

Patch for LibreCAD's portfile

  • Portfile

    old new  
    3232                    port:freetype
    3333
    3434if {${os.platform} eq "darwin" && ${os.major} < 13} {
    35     depends_lib
    36     pre-fetch {
    37         ui_error "${name} 2.x only works with OS X 10.9 Mavericks or later."
    38         ui_error "You might want to try a 1.x series release instead."
    39         error "incompatible OS X version"
    40     }
     35                    configure.compiler macports-gcc-4.8
     36                    configure.env-append QMAKE_STDLIB="-stdlib=c++"
     37                    # -r ensure's that we will build all Makefiles when QMake get's executed
     38                    configure.pre_args -r
     39
     40                    # Fixing -Xarch_X86_64 issues within the makefile
     41                    post-configure  {
     42                      ui_info "Removing -Xarch_x86_64 from Makefile"
     43                      foreach fixfile [exec find ${worksrcpath} -name Makefile] {
     44                         ui_info "Fixing packlist ${fixfile}"
     45                         reinplace "s|-Xarch_x86_64||" ${fixfile}
     46                      }
     47                    }
    4148}
    4249
    4350variant universal {}
     
    4754                    LINK="${configure.cxx} [get_canonical_archflags cxx]"
    4855
    4956destroot {
    50     system -W ${worksrcpath} "macdeployqt LibreCAD.app"
    51     copy ${worksrcpath}/LibreCAD.app ${destroot}${applications_dir}
     57    if {${os.platform} eq "darwin" && ${os.major} < 13} {
     58
     59        # copy libgcc files over to within the application, a bug in macdeployqt prevent's this from happening correctly
     60        set librecad "${worksrcpath}/LibreCAD.app/Contents/MacOS/LibreCAD"
     61        file mkdir ${worksrcpath}/LibreCAD.app/Contents
     62        file mkdir ${worksrcpath}/LibreCAD.app/Contents/Frameworks
     63        foreach dep [exec otool -L ${librecad} | grep libgcc] {
     64            if [string match -nocase "*/libgcc*.dylib" ${dep}] {
     65                ui_info "Copy libgcc files over from ${dep} to ${worksrcpath}/LibreCAD.app/Contents/Frameworks"
     66                file copy ${dep} ${worksrcpath}/LibreCAD.app/Contents/Frameworks/
     67            }
     68        }
     69
     70        # Set these libgcc libraries to local
     71        # TODO: Put these in the foreach loop
     72        system "install_name_tool -change /opt/local/lib/libgcc/libstdc++.6.dylib \
     73            @executable_path/../Frameworks/libstdc++.6.dylib ${librecad}"
     74        system "install_name_tool -change /opt/local/lib/libgcc/libgcc_s.1.dylib \
     75            @executable_path/../Frameworks/libgcc_s.1.dylib ${librecad}"
     76
     77        system -W ${worksrcpath} "macdeployqt LibreCAD.app"
     78        copy ${worksrcpath}/LibreCAD.app ${destroot}${applications_dir}
     79    } else {
     80        system -W ${worksrcpath} "macdeployqt LibreCAD.app"
     81        copy ${worksrcpath}/LibreCAD.app ${destroot}${applications_dir}
     82    }
    5283}