Operasetup

What does operasetup do?

The script modules/hardcore/scripts/operasetup.py runs several other sub-scripts and performs several operations. They are:

If any of the scripts change one if its output files, the file modules/hardcore/base/operasetup.h is modified. If no error occurred 0 is returned, otherwise the errors are printed to standard out and 1 is returned.

The individual scripts are called by operasetup.py. Here is a list of possible return values for the scripts:

When do I need to run the script?

You must run the script before compiling any file. Setup your build environment so that this happens automatically.

How do I run the script?

Use python and pass it operasetup.py as the first argument. In addition to that, all preprocessor defines and all include paths that you define for regular source files via arguments to the compiler need to be given as arguments to the operasetup.py script using -D or /D (for the preprocessor defines) and -I or /I (for the include paths) the same way they're given to most compilers.

Example:
python operasetup.py /D CORE_GOGI /D WINGOGI /D PRODUCT_SYSTEM_FILE="platforms/wingogi/system.h" /I../../..
The following command line arguments are available (a single dash '-' for the define and include path options can be replaced by a slash '/'):
-D DEFINE
-D DEFINE=VALUE
-DDEFINE
-DDEFINE=VALUE
Add the specified define with the specified value.
-I PATH
-IPATH
Add the specified path to the list of include paths. At least the include path to the source root is required such that "core/pch.h" is found.
--mainline_configuration CONFIGURATION
--mainline_configuration=CONFIGURATION
Use the specified mainline configuration. Valid configurations are "next" and "current". If no configuration is specified, "current" is assumed. The file modules/hardcore/version.ini defines a version number for the specified mainline configuration. The version number is used to load the correct feature-file, tweaks-files, api-files and messages-files.
--only-strings
Only execute the makelang.pl step. This option can be used to separate the generation of english.db and the strings header files, e.g. because the output files should be generate in different output directories.
--outroot PATH
--outroot=PATH
Base directory in which to put output files. The default value is the same as the source-directory. The source-directory is the parent directory of modules or modules/hardcore/scripts/../../../.
You can e.g. specify a path which contains the name of the configuration you are compiling for, e.g. --outroot=../../../opera/profiles/debug_tv/include. The same path should be specified as include path on compiling the sources, because some include files like modules/locale/locale-enum.inc will be generated in that directory.
--makelang_db language.db
--makelang_db=language.db
Specifies the path to the language database file relative to the source directory. The language database file is passed to makelang.pl. Multiple language database files can be specified. If no database file is specified, the default value data/strings/english.db is used.
--makelang_opt OPTIONS
--makelang_opt=OPTIONS
The specified options are added to the command line arguments on calling makelang.pl. To add more than one option to the command line arguments, add multiple --makelang_opt arguments to the operasetup.py call.
Note: Makelang is called as
    perl makelang.pl -d OUTROOT/modules/locale -b OUTROOT/data/strings/build.strings -c 9 -q -H OPTIONS makelangDBs
  
where OUTROOT is the path specified in the argument --outroot and makelangDBs is specified by the command line option --makelang_db.
--platform_product_config FILENAME
--platform_product_config=FILENAME
The filename should be a platform specific header file, relative to the source-root, which defines the macros PRODUCT_FEATURE_FILE, PRODUCT_SYSTEM_FILE, PRODUCT_OPKEY_FILE, PRODUCT_ACTIONS_FILE and PRODUCT_TWEAKS_FILE. The generated files modules/hardcore/setup/*/include/core/pch*.h include the specified file. Either the generated pch*.h can be copied to the source-root, or the path modules/hardcore/setup/*/include can be added to the include-paths to use those header files.
If this option is not specified the generated header files contains a #error statement.

Example:

/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*-
 *
 * Copyright (C) 1995-2009 Opera Software AS.  All rights reserved.
 *
 * This file is part of the Opera web browser.
 * It may not be distributed under any circumstances.
 *
 */

#ifndef _MY_PLATFORM_PRODUCT_CONFIG_H_
#define _MY_PLATFORM_PRODUCT_CONFIG_H_

// This header file defines PRODUCT_FEATURE_FILE, PRODUCT_SYSTEM_FILE,
// PRODUCT_OPKEY_FILE, PRODUCT_ACTIONS_FILE and PRODUCT_TWEAKS_FILE.
// This header file is included in core/pch.h, core/pch_jumbo.h and
// core/pch_system_includes.h before including
// modules/hardcore/base/baseincludes.h - which then includes the here
// defined header files:

#define PRODUCT_FEATURE_FILE "platforms/my_platform/features.h"
#define PRODUCT_SYSTEM_FILE "platforms/my_platform/system.h"
#define PRODUCT_OPKEY_FILE "platforms/my_platform/opkeys.h"
#define PRODUCT_ACTIONS_FILE "platforms/my_platform/actions.h"
#define PRODUCT_TWEAKS_FILE "platforms/my_platform/tweaks.h"

#endif // _PLATFORMS_CORE_PRODUCT_CONFIG_H_

--perl PATH_TO_EXECUTABLE
--perl=PATH_TO_EXECUTABLE
Specifies the full path to the Perl executable to use on running makelang.pl. If the option is not specified, perl is expected to be found in one of the directories specified in the PATH environment variable.
--pike PATH_TO_EXECUTABLE
--pike=PATH_TO_EXECUTABLE
Specifies the full path to the Pike executable to use on running parse_tests.pike. If the option is not specified, pike is expected to be found in one of the directories specified in the PATH environment variable.

What version of Python is required?

Python version 2.6.2 is known to be working. Python can be found at the official Python homepage.

Python version 2.4 may be working.

Older Python version are not supported.