# # Copyright (c) 2019 Jiří Zárevúcky # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # - Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # - Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # - The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Read variables from config file generated by config.py, # and version information from repository. _config_file = files(meson.build_root() / 'Makefile.config') _version_file = files(meson.source_root() / 'version') _config_variables = [ # Uspace and kernel 'CONFIG_BAREBONE', 'CONFIG_BUILD_SHARED_LIBS', 'CONFIG_DEBUG', 'CONFIG_DEVEL_FILES', 'CONFIG_FPU', 'CONFIG_LINE_DEBUG', 'CONFIG_LTO', 'CONFIG_PCUT_SELF_TESTS', 'CONFIG_PCUT_TESTS', 'CONFIG_RTLD', 'CONFIG_STRIP_BINARIES', 'CONFIG_UBSAN', 'CONFIG_USE_SHARED_LIBS', 'CROSS_TARGET', 'OPTIMIZATION', 'PROCESSOR', 'QUADFLOAT', 'RDFMT', # Kernel only 'CONFIG_ACPI', 'CONFIG_AM335X_TIMERS', 'CONFIG_ASID', 'CONFIG_ASID_FIFO', 'CONFIG_AT_KBD', 'CONFIG_BCM2835_MAILBOX', 'CONFIG_DSRLNIN', 'CONFIG_DSRLNOUT', 'CONFIG_EGA', 'CONFIG_FB', 'CONFIG_GICV2', 'CONFIG_I8042', 'CONFIG_I8259', 'CONFIG_IOMAP_BITMAP', 'CONFIG_IOMAP_DUMMY', 'CONFIG_KCONSOLE', 'CONFIG_MAC_KBD', 'CONFIG_MULTIBOOT', 'CONFIG_NS16550', 'CONFIG_OFW_PCI', 'CONFIG_OFW_TREE', 'CONFIG_OMAP_UART', 'CONFIG_PAGE_HT', 'CONFIG_PAGE_PT', 'CONFIG_PC_KBD', 'CONFIG_PL011_UART', 'CONFIG_PL050', 'CONFIG_S3C24XX_IRQC', 'CONFIG_S3C24XX_UART', 'CONFIG_SMP', 'CONFIG_SOFTINT', 'CONFIG_SRLN', 'CONFIG_SUN_KBD', 'CONFIG_SYMTAB', 'CONFIG_TEST', 'CONFIG_TRACE', 'CONFIG_TSB', 'CONFIG_UDEBUG', 'CONFIG_VIA_CUDA', 'MACHINE', 'MEMORY_MODEL', 'UARCH', 'KARCH', 'BARCH', 'GRUB_ARCH', 'UIMAGE_OS', 'CONFIG_COMPRESSED_INIT', ] foreach _varname : _config_variables _c = run_command(grep, '^' + _varname + '\\b', _config_file) if _c.returncode() != 0 # TODO: Output negative/inapplicable variables too in config, so that we can check for typos here. #warning('Missing configuration variable ' + _varname + ' in Makefile.config') set_variable(_varname, false) continue endif _val = _c.stdout().split('\n')[0].strip().split('=')[1].strip() if _val == 'y' _val = true elif _val == 'n' _val = false endif set_variable(_varname, _val) if debug_options message([ _varname, get_variable(_varname) ]) endif endforeach # Also read version information. _version_variables = [ 'HELENOS_COPYRIGHT', 'HELENOS_CODENAME', 'HELENOS_RELEASE', ] foreach _varname : _version_variables _line = run_command(grep, '^' + _varname + '\\b', _version_file, check: true).stdout().strip() _val = _line.split('=')[1].strip() set_variable(_varname, _val) if debug_options message([ _varname, get_variable(_varname) ]) endif endforeach