Ticket #40139: Portfile.10

File Portfile.10, 4.8 KB (added by dliessi (Davide Liessi), 11 years ago)

use py2app instead of cx_Freeze; solves some problems with file association

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id$
3
4PortSystem          1.0
5PortGroup           python 1.0
6PortGroup           github 1.0
7
8github.setup        wbsoft frescobaldi 2.0.11 v
9conflicts           frescobaldi-devel
10categories          editors python
11maintainers         gmail.com:davide.liessi openmaintainer
12description         A LilyPond sheet music text editor
13long_description    Frescobaldi is a LilyPond sheet music text editor. \
14                    It aims to be powerful, yet lightweight and easy to use.
15homepage            http://www.frescobaldi.org/
16platforms           darwin
17supported_archs     noarch
18license             GPL-2+
19
20checksums           rmd160  5033eef310d5b68de3951cf07517416436f47cb7 \
21                    sha256  478177a1292e1232df7fb11cae3a28e67af2186191ad1f976e390029e331139c
22
23subport frescobaldi-devel {
24    github.setup        wbsoft frescobaldi fe104aa2c97f668a1a810d65bb7d6dd661d7f7dd
25
26    # github.setup also sets 'name frescobaldi', overriding the subport name.
27    # With 'name ${subport}', `port lint frescobaldi-devel` gives the following error:
28    # 'Error: Portfile directory frescobaldi does not match port name frescobaldi-devel'.
29    # With 'set PortInfo(name) ${subport}' (see the definition of 'proc subport' in
30    # portutil.tcl) the Portfile works correctly and the error disappears.
31    global PortInfo
32    set PortInfo(name) ${subport}
33
34    conflicts           frescobaldi
35    version             20131101
36    set dev_version     2.0.12
37
38    checksums           rmd160  acaab952f50862b8f9fe9213d80e6f9fe0acb372 \
39                        sha256  1e241a3c064b98e06c07410e3832d3804a975118834fb468669a57328ad0dbd9
40}
41
42build {}
43
44depends_run-append  port:portmidi
45
46variant python26 conflicts python27 description {Use Python 2.6} {
47    python.default_version  26
48    depends_run-append      port:py${python.default_version}-pyqt4 \
49                            port:py${python.default_version}-python-poppler-qt4
50}
51variant python27 conflicts python26 description {Use Python 2.7} {
52    python.default_version  27
53    depends_run-append      port:py${python.default_version}-pyqt4 \
54                            port:py${python.default_version}-python-poppler-qt4
55}
56if {![variant_isset python26]} {
57    default_variants        +python27
58}
59
60variant app description {Make application bundle} {
61    depends_build-append    port:py${python.default_version}-py2app
62
63    if {${name} eq ${subport}} {
64        patchfiles    patch-frescobaldi_app-main.py.diff
65        post-extract {
66            xinstall -m 644 -W ${filespath} \
67                file_open_eventhandler.py \
68                ${worksrcpath}/frescobaldi_app
69        }
70    }
71}
72default_variants    +app
73
74post-destroot {
75    set share_destroot ${destroot}${prefix}/share
76    set share_python ${python.prefix}/share
77
78    set man_dir /man/man1
79    xinstall -d ${share_destroot}${man_dir}
80    ln -s ${share_python}${man_dir}/frescobaldi.1 ${share_destroot}${man_dir}
81
82    set desktop_dir /applications
83    xinstall -d ${share_destroot}${desktop_dir}
84    ln -s ${share_python}${desktop_dir}/frescobaldi.desktop ${share_destroot}${desktop_dir}
85
86    set icons_dir /icons/hicolor/scalable/apps
87    xinstall -d ${share_destroot}${icons_dir}
88    ln -s ${share_python}${icons_dir}/frescobaldi.svg ${share_destroot}${icons_dir}
89
90    set doc_dir ${share_destroot}/doc/${subport}
91    xinstall -d ${doc_dir}
92    xinstall -m 644 -W ${worksrcpath} \
93        COPYING \
94        ChangeLog \
95        README \
96        THANKS \
97        ${doc_dir}
98
99    if {[variant_isset app]} {
100        if {${name} eq ${subport}} {
101            set bundle_version    ${version}
102        } else {
103            set bundle_version    ${dev_version}-dev-${version}
104        }
105
106        xinstall -m 644 -W ${filespath} mac-app.py ${workpath}
107        reinplace "s|%%VERSION%%|${bundle_version}|g" ${workpath}/mac-app.py
108        reinplace "s|%%PREFIX%%|${prefix}|g" ${workpath}/mac-app.py
109
110        system "cd ${workpath} && ${prefix}/bin/python${python.branch} mac-app.py py2app"
111
112        set app_resources   ${workpath}/dist/Frescobaldi.app/Contents/Resources
113        xinstall -m 644 -W ${filespath} frescobaldi.icns ${app_resources}
114
115        foreach l {cs de en es fr gl it nl pl pt ru tr uk} {
116            set app_lproj ${app_resources}/${l}.lproj
117            xinstall -d ${app_lproj}
118            xinstall -m 644 -W ${filespath} InfoPlist.strings ${app_lproj}
119        }
120
121        file copy ${workpath}/dist/Frescobaldi.app ${destroot}${applications_dir}
122    }
123}
124
125python.link_binaries_suffix
126
127notes \
128"You may want to install FluidSynth and obtain a SoundFont
129in order to have audio output from Frescobaldi's MIDI output.
130
131You will need to select FluidSynth's MIDI input port
132in Frescobaldi's MIDI settings (in Preferences)
133while FluidSynth is running."