# 
# ***** BEGIN LICENSE BLOCK *****
# Source last modified: $Id: Umakefil,v 1.64.2.16 2005/02/10 18:39:00 rggammon Exp $
# 
# Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
# 
# The contents of this file, and the files included with this file,
# are subject to the current version of the RealNetworks Public
# Source License (the "RPSL") available at
# http://www.helixcommunity.org/content/rpsl unless you have licensed
# the file under the current version of the RealNetworks Community
# Source License (the "RCSL") available at
# http://www.helixcommunity.org/content/rcsl, in which case the RCSL
# will apply. You may also obtain the license terms directly from
# RealNetworks.  You may not use this file except in compliance with
# the RPSL or, if you have a valid RCSL with RealNetworks applicable
# to this file, the RCSL.  Please see the applicable RPSL or RCSL for
# the rights, obligations and limitations governing use of the
# contents of the file.
# 
# Alternatively, the contents of this file may be used under the
# terms of the GNU General Public License Version 2 or later (the
# "GPL") in which case the provisions of the GPL are applicable
# instead of those above. If you wish to allow use of your version of
# this file only under the terms of the GPL, and not to allow others
# to use your version of this file under the terms of either the RPSL
# or RCSL, indicate your decision by deleting the provisions above
# and replace them with the notice and other provisions required by
# the GPL. If you do not delete the provisions above, a recipient may
# use your version of this file under the terms of any one of the
# RPSL, the RCSL or the GPL.
# 
# This file is part of the Helix DNA Technology. RealNetworks is the
# developer of the Original Code and owns the copyrights in the
# portions it created.
# 
# This file, and the files included with this file, is distributed
# and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
# KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
# ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
# ENJOYMENT OR NON-INFRINGEMENT.
# 
# Technology Compatibility Kit Test Suite(s) Location:
#    http://www.helixcommunity.org/content/tck
# 
# Contributor(s):
# 
# ***** END LICENSE BLOCK *****
# 

UmakefileVersion(2,1)

# XXXNH: even though the version number might be >= 1.0/10.0 we haven't
# fully tested on all platforms, so display the "gold" label for those that are
# actually gold and "experimental" for all others.

platform_build_status = "experimental"
if sysinfo.id in ("linux-2.2-libc6-gcc32-i586", "linux-2.2-libc6-i386"):
        platform_build_status = "gold"

# RGG: The full resource directory is datadir + package.
# for the tarball installer, this'll do.
# datadir = "."
# package = "."

# Uncomment this for something more standard:
project_defs =[ ( "PACKAGE_DATA_DIR",    "/usr/share" ),
        ( "LIBDIR",     "/usr/lib" ),
        ( "SYSCONFDIR", "/etc" ),
        ( "PREFIX",     "/usr" ),
        ( "LOCALEDIR",  "/usr/share/locale" ),
	( "PLATFORM_BUILD_STATUS", platform_build_status ) ]

if project.IsDefined('HELIX_FEATURE_REAL_BRANDING'):
    project.AddDefines("PACKAGE=\"realplay\"")
else:
    project.AddDefines("PACKAGE=\"hxplay\"")

# Libglade support
if project.IsDefined('HELIX_FEATURE_LIBGLADE'):
        project.AddDefines('USE_LIBGLADE');
        project.AddDefines('LIBGLADE_DISABLE_DEPRECATED')

else:
        project.AddSources("support.c",
                           "clipdetails_interface.c",
                           "main_interface.c",
                           "preferences_interface.c",
                           "uri_interface.c",
                           "about_interface.c",
                           "contextmenu_interface.c",
                           "auth_interface.c",
                           "transport_interface.c",
                           "plugins_interface.c",
                           "error_interface.c",
                           "upgrade_interface.c",
                           "favorites_interface.c",
                           "statistics_interface.c",
                           "setup_interface.c",
                           "unsupportedbrowser_interface.c")

        if project.IsDefined('HELIX_FEATURE_HARDWARE_COLOR_CONTROLS'):
                project.AddSources("vidctrls_interface.c")


if project.IsDefined('HELIX_FEATURE_GNOME'):
        pkg_modules = pkg_modules + " libgnome-2.0 libgnomeui-2.0"
        project.AddDefines('USE_GNOME')
        project.AddDefines('GNOME_DISABLE_DEPRECATED',
                           'GCONF_DISABLE_DEPRECATED')


# Method 1: Uncomment to use pkg-config to find libgtkhx
# You'll have to install gtk-helix.pc for this to work
# pkg_modules = pkg_modules + gtk-helix 

# Method 2: Dynamically link, use the relative path
# project.AddDynamicLibraries('-L%s' % project.target_dir)
# project.AddDynamicLibraries('-lgtkhx')

# Method 3: Statically link
project.AddModuleLibraries("player/common/gtk[libgtkhx]")

# XXXRGG: If we're linking statically, I think we need to add
# the rest of the libraries here. pyar isn't merging .a's 
# together at the libgtkhx.a level.
project.AddModuleLibraries("common/runtime[runtlib]",
                           "common/system[syslib]",
                           "common/container[contlib]",
                           "common/runtime[runtlib]",
                           "common/dbgtool[debuglib]",
                           "common/util[utillib]",
                           "player/hxclientkit[hxclientlib]",
                           "player/mime/util[mimelib]")


# project.AddDefines('HELIX_FEATURE_RP_SIGN_IN')

if project.IsDefined('HELIX_FEATURE_RP_SIGN_IN'):
        project.AddModuleLibraries("common_rn/r1signin[r1signin]",
                                   "common_rn/r1misc[r1misc]",
                                   "common/fileio[fileiolib]",
                                   "common/lang/xml[xmllib]",
                                   "client/common/container[contclntlib]")
        project.AddModuleIncludes ("common_rn/r1signin/pub",
                                   "common_rn/r1misc/pub",
                                   "common/lang/xml/pub")
        project.AddSources("signin.cpp")

        
        if not project.IsDefined('HELIX_FEATURE_LIBGLADE'):
                project.AddSources("signin_interface.c")

# Add includes
project.AddModuleIncludes("common/include",
                          "player/common/gtk/pub",
                          "player/app/gtk/pub")

# Includes needed by guids.cpp
project.AddModuleIncludes("client/include",
                          "common/dbgtool/pub",
                          "common/runtime/pub",
                          "common/util/pub",
                          "client/include",
                          "filesystem/memory/pub",
                          "filesystem/http",
                          "player/hxclientkit/pub",
                          "player/mime/include",
                          "player/mime/util/pub")


# Take a stab at setting some autoconf/glade defines
for (n,v) in project_defs:
    v = "\"%s\"" % v
    project.AddDefines("%s=%s" % (n, v))

if project.IsDefined('HELIX_FEATURE_EMBEDDED_PLAYER'):
        project.AddSources("playeripc.cpp",
                           "embeddedapp.cpp",
                           "hxstatusinfopanel.cpp",
                           "hxstatustacctrl.cpp",
                           "hxstatuscongestion.cpp")

if project.IsDefined('HELIX_FEATURE_HARDWARE_COLOR_CONTROLS'):
        project.AddSources("vidctrls.cpp")

project.AddSources("mainapp.cpp",
                   "remote.cpp",
                   "prefsdialog.cpp",
                   "mimetypes.cpp",
                   "commonapp.cpp",
                   "libgladeemu.cpp",
                   "hxstatus.cpp",
                   "hxstatustop.cpp",
                   "hxstatuspositionfield.cpp",
                   "hxstatuspositionslider.cpp",
                   "hxstatusfield.cpp",
                   "hxbandwidthgraph.cpp",
                   "favorites.cpp",
                   "statistics.cpp",
                   "setup.cpp",
                   "about.cpp",
                   "auth.cpp",
                   "clipdetails.cpp",
                   "error.cpp",
                   "upgrade.cpp",
                   "plugins.cpp",
                   "open.cpp",
                   "guids.cpp",
                   "contextmenu.cpp",
                   "sysinfo.cpp",
                   "switchboard.cpp",
                   "mailcap.cpp")

if project.IsDefined('HELIX_FEATURE_REAL_BRANDING'):
    project.AddDefines('APP_NAME_SHORT="realplay"')
    project.AddDefines('APP_NAME_LONG="RealPlayer"')
    project.AddDefines('APP_NAME_FULL="RealPlayer 10"')
    project.AddDefines('APP_PREFIX_LC="rp"')
    project.AddDefines('APP_URL="http://www.real.com"')
    project.AddDefines('APP_FG_COLOR="#336699"')

    ProgramTarget("realplay.bin")
    project.AddCopyTargets("realplay")
    verfile = "realplayer.ver"
    readme_src = "README.realplay.in"
    readme_dest = "README.realplay"

    distcode = "RX%s1"    

else:
    project.AddDefines('APP_NAME_SHORT="hxplay"')
    project.AddDefines('APP_NAME_LONG="Helix Player"')
    project.AddDefines('APP_NAME_FULL="Helix Player"')
    project.AddDefines('APP_PREFIX_LC="hx"')
    project.AddDefines('APP_URL="https://player.helixcommunity.org"')
    project.AddDefines('APP_FG_COLOR="#003300"')

    ProgramTarget("hxplay.bin")
    project.AddCopyTargets("hxplay")
    verfile = "hxplayer.ver"
    readme_src = "README.hxplay.in"
    readme_dest = "README.hxplay"

    distcode = "HX%s1"

if sysinfo.platform_qualifier == "redhat8":
    distcode = distcode + "D" # download
elif sysinfo.platform_qualifier == "nld":
    distcode = distcode + "NL" # Novell Linux Desktop
elif sysinfo.platform_qualifier == "rhel4":
    distcode = distcode + "RH" # RedHat
elif sysinfo.platform_qualifier == "fedora3":
    distcode = distcode + "FC" # Fedora
elif sysinfo.platform_qualifier == "jds3":
    distcode = distcode + "SJ" # Sun Java Desktop
elif sysinfo.platform_qualifier == "turbo10":
    distcode = distcode + "TL" # Turbo Linux
elif sysinfo.platform_qualifier == "debian3":
    distcode = distcode + "DG" # Debian/GNU
elif sysinfo.platform_qualifier == "xandros3":
    distcode = distcode + "XA" # Xandros 3.0
elif sysinfo.platform_qualifier == "linspire45":
    distcode = distcode + "LI" # Linspire 4.5
elif sysinfo.platform_qualifier == "linspire5":
    distcode = distcode + "LI" # Linspire 5.0
else:
    distcode = distcode + "O"  # Other
project.AddDefines('DISTCODE="' + distcode + '"')

DependTarget()

# update release notes in locale dirs
for entry in os.listdir("locale"):
    path = os.path.join("locale", entry)
    if os.path.isdir(path):
        src_path = os.path.join(path, readme_src)
        if os.path.isfile(src_path):
            dest_path = os.path.join(path, readme_dest)
            UpdateReleaseNotes(src_path, dest_path, verfile)

# update default release notes
UpdateReleaseNotes(readme_src, readme_dest, verfile)

