X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=options.lua;fp=options.lua;h=30d1c756f73ddc67cc4770d548eeac4c4965e9d9;hp=0000000000000000000000000000000000000000;hb=6c9943707d4f33035830eba0587a61a34eaecbc2;hpb=af88821a172c4dfd138b91b2a5148ae50b502fa2 diff --git a/options.lua b/options.lua new file mode 100644 index 0000000..30d1c75 --- /dev/null +++ b/options.lua @@ -0,0 +1,597 @@ + +-- +-- Yoink Configuration Rules +-- Use this file with config.lua to generate config files. +-- + +local project = "Yoink" +local version = "0.1" +local website = "http://www.dogcows.com/yoink" +local contact = "chaz@dogcows.com" + + +local check = require "check" +local util = require "utility" + +return string.format("%s %s", project, version), +{ + name = "Yoink Configuration", + caption = "Choose the category of settings to view/change.", + { + name = "Installation Paths", + caption = "Set the directory paths where program files will be installed.", + { + symbol = "prefix", + value = "/usr/local", + cmdline = "--prefix", + name = "Prefix", + caption = "Set the base installation directory.", + check = function(value) + libdir = value .. "/lib" + return value + end + }, + { + symbol = "exec_prefix", + value = "$(prefix)", + cmdline = "--exec-prefix", + name = "Executable Prefix", + caption = "Set the base installation directory for executables.", + visible = function() return showAdvanced end + }, + { + symbol = "bindir", + value = "$(exec_prefix)/bin", + cmdline = "--bindir", + name = "Binaries", + caption = "Set the executable storage directory." + }, + { + symbol = "libdir", + value = "/usr/local/lib" + }, + { + symbol = "datarootdir", + value = "$(prefix)/share", + cmdline = "--datarootdir", + name = "Data Root", + caption = "Set the base installation directory for resource files.", + visible = function() return showAdvanced end + }, + { + symbol = "datadir", + value = "$(datarootdir)", + cmdline = "--datadir", + name = "Data", + caption = "Set the program resource storage directory." + }, + { + symbol = "pkgdatadir", + value = "$(datadir)/$(projectName)", + config = "YOINK_DATADIR", + export = "pkgdatadir", + name = "Package Data", + caption = "Set the program resource storage directory.", + visible = function() return showAdvanced end + }, + { + symbol = "mandir", + value = "$(datarootdir)/man", + cmdline = "--mandir", + name = "Manuals", + caption = "Set the manual page storage directory." + } + }, + { + name = "Build Options", + caption = "Set toolset commands and flags.", + { + symbol = "build", + value = util.exec("config.guess"), + cmdline = "--build", + name = "Build Triplet", + caption = "Set the build triplet.", + check = function(value) return value end + }, + { + symbol = "host", + value = "", + cmdline = "--host", + name = "Host Triplet", + caption = "Set the host triplet.", + check = function(value) + if value == "" + then + CC = "gcc" + CXX = "g++" + AR = "ar" + RANLIB = "ranlib" + WINDRES = "windres" + else + CC = value .. "-gcc" + CXX = value .. "-g++" + AR = value .. "-ar" + RANLIB = value .. "-ranlib" + WINDRES = value .. "-windres" + end + if value:find("mingw32") + then + platform = "win32" + EXEEXT = ".exe" + else + platform = "posix" + EXEEXT = "" + end + return value + end, + before = {"dependencies", "CC", "CXX", "AR", "RANLIB", "WINDRES"} + }, + { + symbol = "EXEEXT", + value = "", + name = "Executable Suffix", + export = "EXEEXT", + caption = "Set the extension of binary executables.", + help = [[ +Some platforms follow certain conventions with regard +to the file extension of executables. By default, the +build system will create executables with no suffix, +but specifying this option will cause the text to be +appended to the names of these files. + +This option may be changed without your intervention if +automatic checks determine there is a common executable +suffix for the host platform. +]], + visible = function() return showAdvanced end + }, + { + symbol = "platform", + value = {"posix", "win32"}, + config = "PLATFORM", + name = "Platform", + caption = "Set the architectural platform to target.", + visible = function() return showAdvanced end, + check = function(value) + if value == "win32" + then + PKG_LDLIBS = PKG_LDLIBS:setFlag("-lws2_32") + else + PKG_LDLIBS = PKG_LDLIBS:unsetFlag("-lws2_32") + end + return value + end, + before = {"LDLIBS"} + }, + { + name = "Toolset Options", + caption = "Customize the toolset.", + help = [[ +You can set which compilers and other tools to use. +You may also specify which extra flags should be used +during the compile and linking phase. +]], + { + symbol = "CC", + value = "cc", + cmdline = "CC", + name = "CC", + caption = "Set the C compiler command." + }, + { + symbol = "CXX", + value = "g++", + cmdline = "CXX", + name = "CXX", + caption = "Set the C++ compiler command." + }, + { + symbol = "AR", + value = "ar", + cmdline = "AR", + name = "AR", + caption = "Set the archiver for static libraries command." + }, + { + symbol = "RANLIB", + value = "ranlib", + cmdline = "RANLIB", + name = "RANLIB", + caption = "Set the archive indexer command." + }, + { + symbol = "WINDRES", + value = "windres", + cmdline = "WINDRES", + name = "WINDRES", + caption = "Set the Windows resource compiler command.", + visible = function() return platform == "win32" end + }, + "------------INSERT-BLANK-LINE------------", + { + symbol = "CFLAGS", + value = "-Wall -Wno-uninitialized -O2", + cmdline = "CFLAGS", + name = "CFLAGS", + caption = "Set the C compiler flags." + }, + { + symbol = "CXXFLAGS", + value = "$(CFLAGS)", + cmdline = "CXXFLAGS", + name = "CXXFLAGS", + caption = "Set the C++ compiler flags." + }, + { + symbol = "CPPFLAGS", + value = "", + cmdline = "CPPFLAGS", + name = "CPPFLAGS", + caption = "Set the C preprocessor flags." + }, + { + symbol = "LDLIBS", + value = "", + cmdline = "LIBS", + name = "LIBS", + caption = "Set the libraries the executable should link with." + }, + { + symbol = "LDFLAGS", + value = "", + cmdline = "LDFLAGS", + name = "LDFLAGS", + caption = "Set the linker flags." + }, + { + symbol = "dependencies", + value = "sdl gl glu libpng openal vorbisfile lua|lua5.1", + check = function(value) + local value, err = util.pkgfind(value, libdir) + if value + then + PKG_CFLAGS = util.pkgconfig("CFLAGS", value, libdir) + PKG_LDLIBS = util.pkgconfig("LIBS", value, libdir) .. " -lz" + PKG_LDFLAGS = util.pkgconfig("LDFLAGS", value, libdir) + end + return value, err + end, + after = {"prefix"}, + temp = true + }, + { + symbol = "PKG_CFLAGS", + value = "", + after = {"dependencies"} + }, + { + symbol = "PKG_CXXFLAGS", + value = "$(PKG_CFLAGS)", + after = {"PKG_CFLAGS"} + }, + { + symbol = "PKG_LDLIBS", + value = "", + after = {"dependencies"} + }, + { + symbol = "PKG_LDFLAGS", + value = "", + after = {"dependencies"} + } + }, + "------------INSERT-BLANK-LINE------------", + { + symbol = "tracking", + value = true, + cmdline = "--enable-dependency-tracking", + name = "Dependency Tracking", + caption = "Enable tracking of code dependencies.", + help = [[ +If you are working on the code, you want this enabled +so that the files you edit will automatically be +rebuilt when you run make. This may add some overhead +to the build process. + +If in doubt, say Yes. +]] + }, + { + symbol = "profile", + value = false, + cmdline = "--enable-profile", + config = "ENABLE_PROFILING", + name = "Profiling", + caption = "Compile in gprof instructions for profiling.", + help = [[ +Yoink can be compiled with extra instructions to +generate statistical data regarding the performance of +the code. This data is saved to a file which can be +used by the gprof program to generate a nice report. + +If in doubt, say No. +]], + check = function(value) + if value + then + PKG_CFLAGS = PKG_CFLAGS:setFlag("-pg") + PKG_LDFLAGS = PKG_LDFLAGS:setFlag("-pg") + else + PKG_CFLAGS = PKG_CFLAGS:unsetFlag("-pg") + PKG_LDFLAGS = PKG_LDFLAGS:unsetFlag("-pg") + end + return value + end + } + }, + { + name = "Program Features", + caption = "Choose which features to compile into the program.", + { + symbol = "debug", + value = false, + cmdline = "--enable-debug", + config = {"DEBUG", "!NDEBUG"}, + name = "Debug Mode", + caption = "Compile in debug codepaths.", + help = [[ +The debug target mode enables runtime assertions and +other codepaths appropriate for finding bugs and +diagnosing problems. The release target mode will +avoid compiling in this extra overhead and also set +some compiler flags for optimizing the performance of +the code. + +Note that logging and exception-handling facilities are +still available in release mode, and debug symbols are +always available provided you do not explicitly strip +them out. Therefore, many problems can be diagnosed +without these extra codepaths. + +If in doubt, say No. +]], + check = function(value) + if value + then + CFLAGS = CFLAGS:setFlag("-Wall", "-g") + CFLAGS = CFLAGS:replaceFlag("%-O%d?", "-O0") + end + return value + end + }, + { + symbol = "clock_gettime", + value = false, + cmdline = "--enable-clock_gettime", + config = "ENABLE_CLOCK_GETTIME", + name = "clock_gettime", + caption = "Use a high-res clock on platforms that support it.", + help = [[ +By default, Yoink will use whatever timing facility is +provided by SDL. This only provides a low-resolution +guarantee. On some targets, a much higher-resolution +timer is available through the use of clock_gettime(2). +On such platforms, SDL might have been built to use +this time source. This option will cause Yoink to use +it directly so that the high resolution is guaranteed. + +If in doubt, say No. +]], + visible = function() return platform == "posix" end + }, + { + symbol = "doublePrecision", + value = false, + cmdline = "--enable-double-precision", + config = "ENABLE_DOUBLE_PRECISION", + name = "Double Precision", + caption = "Use doubles for floating point numbers.", + help = [[ +The most common data type for storing non-integral +numbers is called a float. These are quickly processed +on modern hardware, but they suffer problems in +accuracy. A much more accurate data type is a double, +but they may take a bit longer to process. + +In most cases, floats are adequate. Yet, using doubles +will help prevent small inaccuracies from accumulating +over time and becoming a bigger deal. + +If in doubt, say No. +]] + }, + { + symbol = "hotloading", + value = false, + cmdline = "--enable-hotloading", + config = "ENABLE_HOTLOADING", + name = "Hotloading", + caption = "Allow assets to reload themselves automatically.", + help = [[ +Hotloading allows game resources to be reloaded into +the game automatically whenever they are changed on +disk. For example, if you are running Yoink at the +same time as you are editing one of its image files, +any changes you save to the file will immediately be +seen in the game. Other types of assets are also +hotloadable. This is very useful to content creators +interested in rapid development. + +Currently only recent Linux kernels are supported. +There is a small amount of overhead associated with +hotloading; as such, it is not recommended unless you +plan to take advantage of its benefits. + +If in doubt, say No. +]], + visible = function() return platform == "posix" end + }, + { + symbol = "threads", + value = true, + cmdline = "--enable-threads", + config = "ENABLE_THREADS", + name = "Threads", + caption = "Use threads for concurrency where appropriate.", + help = [[ +If you have multiple processors or cores, enabling +threads will allow the workload to be shared. This +may have limited usefulness even if you have only a +single core. + +If in doubt, say Yes. +]] + }, + { + symbol = "gui", + value = {"none", "gtk", "qt4"}, + cmdline = "--with-gui", + config = "WITH_GUI", + name = "GUI Toolkit", + caption = "Set which (if any) widget toolkit to use for dialogs.", + help = [[ +Sometimes Yoink will show a dialog window for the +purpose of providing diagnostics information. If you +have KDE, you probably want to choose QT4 for this +purpose. If you have Gnome or any other environment, +you may prefer GTK2. This option will make certain QT4 +or GTK2 libraries dependencies. If you choose "none," +no dialog windows will be shown, and any such +information can be seen from the terminal output. + +Under certain targets, the native API will be used and +this option will have no effect. For example, a +mingw32 target will automatically use native win32 +dialogs. + +If in doubt, say None. +]], + visible = function() return platform == "posix" end, + check = function(value) + dependencies = dependencies:unsetFlag("gtk+-2.0", "QtGui") + if value == "gtk" then dependencies = dependencies:setFlag("gtk+-2.0") + elseif value == "qt4" then dependencies = dependencies:setFlag("QtGui") end + return value + end, + before = {"dependencies"} + } + }, + { + name = "Package Strings", + caption = "Set the package strings.", + visible = function() return showAdvanced end, + { + symbol = "PACKAGE", + value = project, + config = {"PACKAGE_NAME", "PACKAGE"}, + name = "Package Name", + export = "PACKAGE", + caption = "Set the name of the program.", + check = function(value) + projectName = util.symbolize(value) return value + end + }, + { + symbol = "projectName", + value = util.symbolize(project), + export = "projectName", + }, + { + symbol = "VERSION", + value = version, + config = "PACKAGE_VERSION", + export = "VERSION", + name = "Version", + caption = "Set the three-part version number of the program.", + check = function(value) + versionMajor, versionMinor, versionRevision = util.splitVersion(value) + return value + end, + before = {"versionMajor", "versionMinor", "versionRevision"} + }, + { + symbol = "packageString", + value = "$(PACKAGE) $(VERSION)", + config = "PACKAGE_STRING", + name = "Full String", + caption = "Set the complete package string." + }, + { + symbol = "TARNAME", + value = "$(projectName)", + config = "PACKAGE_TARNAME", + name = "Archive Name", + caption = "Set the name used in creating tarballs." + }, + { + symbol = "archiveFormat", + value = {"bzip2", "gzip", "lzma", "xz", "all"}, + name = "Default Archive Format", + caption = "Set the default compression format for tarballs." + }, + { + symbol = "email", + value = contact, + config = "PACKAGE_BUGREPORT", + export = "email", + name = "Email Address", + caption = "Set the email address for collecting bug reports." + }, + { + symbol = "website", + value = website, + config = "PACKAGE_URL", + name = "Website URL", + caption = "Set the project website URL." + }, + { + symbol = "versionMajor", + value = 0, + config = "VERSION_MAJOR" + }, + { + symbol = "versionMinor", + value = 0, + config = "VERSION_MINOR" + }, + { + symbol = "versionRevision", + value = 0, + config = "VERSION_REVISION" + }, + { + symbol = "gitHead", + value = "", + check = function(value) + local hash, code = util.exec("git show-ref --head HEAD | sed -n 's/\\(.*\\) HEAD/\\1/p'") + if code == 0 then value = hash end + return value + end + }, + { + symbol = "manCompression", + value = {"none", "bzip2", "gzip"}, + cmdline = "--with-man-compression", + name = "Manual Compression", + caption = "Set which compression to use for installed man pages" + }, + { + symbol = "includeConfig", + value = true, + config = "INCLUDE_CONFIG_FILE", + name = "Compile config.mk into executable", + caption = "What the name says." + } + }, + "------------INSERT-BLANK-LINE------------", + { + symbol = "showAdvanced", + value = false, + name = "Show Advanced Options", + caption = "Show advanced (and often less useful) options." + } +} + + +-- vi:ft=lua +