PortSystem 1.0

name                NicePlayer
version             0.95
revision            1
categories          aqua multimedia
platforms           macosx
maintainers         nomaintainer
homepage            http://niceplayer.sourceforge.net
description         Multi-engine Fullscreen Video Player
long_description    This program aims to be a Video player designed for \
                    playing movies nicely for a person who likes to watch or \
                    present movies on their computer (such as the casual \
                    viewer or the video artist). This program features full \
                    screen or border-less floating windows, convenient \
                    controls for scrubbing or queuing movies, and on the \
                    fly playlist creation.

master_sites        sourceforge:niceplayer
distname            ${name}_source_${version}
checksums           sha1 3f59c9c501eb94223e972df26758a55bbe8ea26d
use_bzip2           yes
extract.suffix      .tbz2

post-patch {
                    # Remove subversion version extraction while build.
                    # Needs to be updated with every release of the port or
                    # the automatic updater will not work!
                    # The number stored here is the subversion revision.
                    reinplace "s|REV=.*|REV=514|g" \
                      ${worksrcpath}/niceplayer/Versioning/version.sh
}

use_configure       no
build.type          pbx
build.dir           ${workpath}/${name}_source_${version}/niceplayer
build.target        -configuration Release
build.args          build -project ${name}.xcodeproj SYMROOT=${workpath}/build

pre-destroot {
  # Rename the following files because of a bug in macports which fails to
  # uninstall files containg { or }; Ticket #12420
  set scripts "${workpath}/build/Release/${name}.app/Contents/Resources/Default Scripts"
  
  file rename "${scripts}/01 Stretch Aspect Ratio/01 To 16-9 {^*L}.scpt" \
    "${scripts}/01 Stretch Aspect Ratio/01 To 16-9  ⁅^*L⁆.scpt"
  file rename "${scripts}/01 Stretch Aspect Ratio/01 To 4-3 {^*K}.scpt" \
    "${scripts}/01 Stretch Aspect Ratio/01 To 4-3 ⁅^*K⁆.scpt"
  
  file rename "${scripts}/02 Time Control/Go To Time...{^*G}.scpt" \
    "${scripts}/02 Time Control/Go To Time...⁅^*G⁆.scpt"
  file rename "${scripts}/02 Time Control/Title Sequence (Approx) Jump {^*J}.scpt" \
    "${scripts}/02 Time Control/Title Sequence (Approx) Jump⁅^*J⁆.scpt"
  
  file rename "${scripts}/98 Just For Fun/Send to Background {^*B}.scpt" \
    "${scripts}/02 Time Control/Send to Background ⁅^*B⁆.scpt"
  file rename "${scripts}/98 Just For Fun/Set Current Window Transparency {^*T}.scpt" \
    "${scripts}/02 Time Control/Set Current Window Transparency ⁅^*T⁆.scpt"
}

destroot {
                    xinstall -m 755 -d ${destroot}/Applications/MacPorts/
                    file copy ${workpath}/build/Release/${name}.app \
                              ${destroot}/Applications/MacPorts/
}

default_variants +universal
variant universal {}
pre-fetch {
	if {[variant_exists universal] && ![variant_isset universal]} {
		return -code error "${name} is only available in a universal version"
	}
}
