Changeset 32b4302 in mainline for tools


Ignore:
Timestamp:
2019-08-18T19:06:02Z (7 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1c39d33b
Parents:
fa70134 (diff), 6c2fac18 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-08-18 19:06:02)
git-committer:
GitHub <noreply@…> (2019-08-18 19:06:02)
Message:

Merge pull request #174 from le-jzr/meson3

Convert HelenOS build system to Meson

Location:
tools
Files:
3 added
5 deleted
8 edited
3 moved

Legend:

Unmodified
Added
Removed
  • tools/cc.sh

    rfa70134 r32b4302  
    3636EOF
    3737
     38# Find out the path to the script.
     39SOURCE_DIR=`which -- "$0" 2>/dev/null`
     40# Maybe we are running bash.
     41[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
     42[ -z "$SOURCE_DIR" ] && exit 1
     43SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
     44SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
     45
    3846echo ""
    3947
    40 git grep 'Copyright ([cC])' | \
     48git -C "$SOURCE_DIR" grep 'Copyright ([cC])' | \
    4149        sed -E -n 's/^.*(Copyright \([cC]\) (20[0-9][0-9]-)?20[0-9][0-9],? [-a-zA-Z., ]*[-a-zA-Z.]$)/\1/p' | \
    4250        sed -E 's/ ( )+/ /' | \
  • tools/config.py

    rfa70134 r32b4302  
    4343
    4444ARGPOS_RULES = 1
    45 ARGPOS_CHOICE = 2
    46 ARGPOS_PRESET = 3
     45ARGPOS_PRESETS_DIR = 2
     46ARGPOS_CHOICE = 3
     47ARGPOS_PRESET = 4
     48ARGPOS_MASK_PLATFORM = 3
    4749
    4850RULES_FILE = sys.argv[ARGPOS_RULES]
    4951MAKEFILE = 'Makefile.config'
    5052MACROS = 'config.h'
    51 PRESETS_DIR = 'defaults'
     53PRESETS_DIR = sys.argv[ARGPOS_PRESETS_DIR]
    5254
    5355class BinaryOp:
     
    536538
    537539        try:
    538                 version = subprocess.Popen(['git', 'log', '-1', '--pretty=%h'], stdout = subprocess.PIPE).communicate()[0].decode().strip()
     540                version = subprocess.Popen(['git', '-C', os.path.dirname(RULES_FILE), 'log', '-1', '--pretty=%h'], stdout = subprocess.PIPE).communicate()[0].decode().strip()
    539541                sys.stderr.write("ok\n")
    540542        except:
     
    689691        else:
    690692                preset = None
     693
     694        mask_platform = (len(sys.argv) > ARGPOS_MASK_PLATFORM and sys.argv[ARGPOS_MASK_PLATFORM] == "--mask-platform")
    691695
    692696        # Input configuration file can be specified on command line
     
    755759                        options = []
    756760                        opt2row = {}
    757                         cnt = 1
    758 
    759                         options.append("  --- Load preconfigured defaults ... ")
     761                        cnt = 0
     762
     763                        if not mask_platform:
     764                                cnt += 1
     765                                options.append("  --- Load preconfigured defaults ... ")
    760766
    761767                        for rule in rules:
     
    764770                                if cond and not cond.evaluate(config):
    765771                                        continue
     772
     773                                if mask_platform and (varname == "PLATFORM" or varname == "MACHINE" or varname == "COMPILER"):
     774                                        rule = varname, vartype, "(locked) " + name, choices, cond
    766775
    767776                                if varname == selname:
     
    811820                                        continue
    812821
    813                         if value == 0:
     822                        if value == 0 and not mask_platform:
    814823                                profile = choose_profile(PRESETS_DIR, MAKEFILE, screen, config)
    815824                                if profile != None:
     
    828837                        else:
    829838                                value = config[selname]
     839
     840                        if mask_platform and (selname == "PLATFORM" or selname == "MACHINE" or selname == "COMPILER"):
     841                                        continue
    830842
    831843                        if seltype == 'choice':
  • tools/ew.py

    rfa70134 r32b4302  
    3333"""
    3434
     35import inspect
    3536import os
     37import platform
     38import re
     39import subprocess
    3640import sys
    37 import subprocess
    38 import autotool
    39 import platform
    4041import thread
    4142import time
    4243
    4344overrides = {}
     45
     46CONFIG = 'Makefile.config'
     47
     48TOOLS_DIR = os.path.dirname(inspect.getabsfile(inspect.currentframe()))
     49
     50def read_config():
     51        "Read HelenOS build configuration"
     52
     53        inf = open(CONFIG, 'r')
     54        config = {}
     55
     56        for line in inf:
     57                res = re.match(r'^(?:#!# )?([^#]\w*)\s*=\s*(.*?)\s*$', line)
     58                if (res):
     59                        config[res.group(1)] = res.group(2)
     60
     61        inf.close()
     62        return config
    4463
    4564def is_override(str):
     
    164183def hdisk_mk():
    165184        if not os.path.exists('hdisk.img'):
    166                 subprocess.call('tools/mkfat.py 1048576 uspace/dist/data hdisk.img', shell = True)
     185                subprocess.call(TOOLS_DIR + '/mkfat.py 1048576 dist/data hdisk.img', shell = True)
    167186
    168187def qemu_bd_options():
     
    298317
    299318def ski_run(platform, machine, processor):
    300         run_in_console('ski -i tools/conf/ski.conf', 'HelenOS/ia64 on ski')
     319        run_in_console('ski -i ' + TOOLS_DIR + '/conf/ski.conf', 'HelenOS/ia64 on ski')
    301320
    302321def msim_run(platform, machine, processor):
    303322        hdisk_mk()
    304         run_in_console('msim -c tools/conf/msim.conf', 'HelenOS/mips32 on msim')
     323        run_in_console('msim -c ' + TOOLS_DIR + '/conf/msim.conf', 'HelenOS/mips32 on msim')
    305324
    306325def spike_run(platform, machine, processor):
     
    495514                        exit()
    496515
    497         config = {}
    498         autotool.read_config(autotool.CONFIG, config)
     516        config = read_config()
    499517
    500518        if 'PLATFORM' in config.keys():
  • tools/export.sh

    • Property mode changed from 100644 to 100755
    rfa70134 r32b4302  
     1#!/bin/sh
     2
    13#
    2 # Copyright (c) 2012 Petr Koupy
     4# Copyright (c) 2019 Jiří Zárevúcky
    35# All rights reserved.
    46#
     
    2729#
    2830
    29 USPACE_PREFIX = ../..
     31if [ "$#" -ne 1 ]; then
     32        echo "Must define export directory."
     33        exit 1
     34fi
    3035
    31 # TODO: Should be just "gui", rest is transitive dependencies.
    32 LIBS = gui draw softrend compress math
     36EXPORT_DIR="$1"
    3337
    34 BINARY = vlaunch
     38# Only (re)build files we actually want to export.
    3539
    36 IMG = image
    37 IMGS = $(IMG)s
     40EXPORT_LIBS=" \
     41        uspace/lib/libmath.a \
     42        uspace/lib/libclui.a \
     43        uspace/lib/libgui.a \
     44        uspace/lib/libdraw.a \
     45        uspace/lib/libsoftrend.a \
     46        uspace/lib/libhound.a \
     47        uspace/lib/libpcm.a \
     48        uspace/lib/libcpp.a \
     49        uspace/lib/libc.a \
     50        uspace/lib/c/libstartfiles.a \
     51        uspace/lib/libposix.a \
     52"
    3853
    39 SOURCES = \
    40         vlaunch.c \
    41         $(IMGS).s \
    42         $(IMGS)_desc.c
     54EXPORT_CONFIGS=" \
     55        meson/part/exports/config.mk \
     56        meson/part/exports/config.sh \
     57"
    4358
    44 IMAGES = \
    45         gfx/helenos.tga
     59ninja $EXPORT_LIBS $EXPORT_CONFIGS
     60ninja devel-headers
    4661
    47 PRE_DEPEND = $(IMGS).s $(IMGS).h $(IMGS)_desc.c
    48 EXTRA_CLEAN = $(IMGS).s $(IMGS).h $(IMGS)_desc.c $(IMGS).zip
    49 
    50 include $(USPACE_PREFIX)/Makefile.common
    51 
    52 $(IMGS).s: $(IMGS).zip
    53         unzip -p $< $@ > $@
    54 
    55 $(IMGS).h: $(IMGS).zip
    56         unzip -p $< $@ > $@
    57 
    58 $(IMGS)_desc.c: $(IMGS).zip
    59         unzip -p $< $@ > $@
    60 
    61 $(IMGS).zip: $(IMAGES)
    62         $(ROOT_PATH)/tools/mkarray.py $(IMGS) $(IMG) "$(AS_PROLOG)" .data $^
     62mkdir -p "$EXPORT_DIR/lib"
     63cp -t "$EXPORT_DIR/lib" $EXPORT_LIBS
     64rm -rf "$EXPORT_DIR/include"
     65cp -R dist/include "$EXPORT_DIR/include"
     66cp -t "$EXPORT_DIR" $EXPORT_CONFIGS
  • tools/mkarray_for_meson.sh

    • Property mode changed from 100644 to 100755
    rfa70134 r32b4302  
     1#!/bin/sh
     2
    13#
    2 # Copyright (c) 2010 Jiri Svoboda
     4# Copyright (c) 2019 Jiří Zárevúcky
    35# All rights reserved.
    46#
     
    2729#
    2830
    29 .PHONY: all clean
     31TOOLS_DIR=`which -- "$0" 2>/dev/null`
     32if [ -z "$TOOLS_DIR" ]; then
     33        TOOLS_DIR=`which -- "$BASH_SOURCE" 2>/dev/null`
     34fi
     35TOOLS_DIR=`dirname $TOOLS_DIR`
     36TOOLS_DIR=`cd $TOOLS_DIR && echo $PWD`
    3037
    31 include Makefile.common
    3238
    33 IMAGE_NAME = HelenOS-$(RELEASE)
    34 BIN_OUTPUT = image.bin
     39_outdir="$1"
     40_arg1="$2"
     41_arg2="$3"
     42_arg3="$4"
     43_arg4="$5"
     44_inputs=""
    3545
    36 all: $(POST_OUTPUT)
     46shift 5
    3747
    38 $(BIN_OUTPUT): $(BOOT_OUTPUT)
    39         $(OBJCOPY) -O binary $< $@
     48for file in "$@"; do
     49        _inputs="$_inputs $PWD/${file}"
     50done
    4051
    41 $(POST_OUTPUT): $(BIN_OUTPUT)
    42         $(MKUIMAGE) -name "$(IMAGE_NAME)" -laddr $(LADDR) -saddr $(SADDR) -ostype $(UIMAGE_OS) $< $@
    43 
    44 clean:
    45         rm -f $(BIN_OUTPUT)
     52cd $_outdir
     53$TOOLS_DIR/mkarray.py "$_arg1" "$_arg2" "$_arg3" "$_arg4" $_inputs > /dev/null
  • tools/release.sh

    rfa70134 r32b4302  
    1 #! /bin/bash
     1#!/bin/sh
    22
    33#
    4 # Copyright (c) 2010 Jakub Jermar
     4# Copyright (c) 2019 Jiří Zárevúcky
    55# All rights reserved.
    66#
     
    2929#
    3030
    31 if [ $1" " == "-h " ];
    32 then
    33         echo "Perform pre-integration hands-off build of all profiles."
    34         echo
    35         echo "Syntax:"
    36         echo " $0 [-h] [args...]"
    37         echo
    38         echo " -h        Print this help."
    39         echo " args...   All other args are passed to make (e.g. -j 6)"
    40         echo
     31# Find out the path to the script.
     32SOURCE_DIR=`which -- "$0" 2>/dev/null`
     33# Maybe we are running bash.
     34[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
     35[ -z "$SOURCE_DIR" ] && exit 1
     36SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
     37SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
    4138
    42         exit
    43 fi
    4439
    45 FAILED=""
    46 PASSED=""
    47 PROFILES=""
    48 DIRS=`find defaults/ -name Makefile.config | sed 's/^defaults\/\(.*\)\/Makefile.config/\1/' | sort`
     40echo "Running tools/build_all.sh"
    4941
    50 for D in $DIRS;
    51 do
    52         for H in $DIRS;
    53         do
    54                 if [ `echo $H | grep "^$D\/.*"`x != "x"  ];
    55                 then
    56                         continue 2
    57                 fi
    58         done
    59         PROFILES="$PROFILES $D"
    60 done
     42mkdir -p build_all
     43cd build_all
     44sh "${SOURCE_DIR}/tools/build_all.sh"
     45cd ..
    6146
    62 echo ">>> Going to build the following profiles:"
    63 echo $PROFILES
    64 
    65 for P in $PROFILES;
    66 do
    67         echo -n ">>>> Building $P... "
    68         ( make distclean && make PROFILE=$P HANDS_OFF=y "$@" ) >>/dev/null 2>>/dev/null
    69         if [ $? -ne 0 ];
    70         then
    71                 FAILED="$FAILED $P"
    72                 echo "failed."
    73         else
    74                 PASSED="$PASSED $P"
    75                 echo "ok."
    76         fi
    77 done
    78 
    79 echo ">>> Done."
     47echo
    8048echo
    8149
    82 echo ">>> The following profiles passed:"
    83 echo $PASSED
    84 echo
     50PROFILES=`sh ${SOURCE_DIR}/tools/list_profiles.sh`
     51RELEASE=`sed -n 's:^HELENOS_RELEASE \?= \?\(.*\)$:\1:p' "${SOURCE_DIR}/version"`
     52SRC_ARCHIVE="HelenOS-${RELEASE}-src.tar"
    8553
    86 echo ">>> The following profiles failed:"
    87 echo $FAILED
    88 echo
     54git -C "${SOURCE_DIR}" archive master -o "${PWD}/${SRC_ARCHIVE}"
     55bzip2 -f "${SRC_ARCHIVE}"
     56echo "Created ${SRC_ARCHIVE}.bz2"
    8957
     58for profile in $PROFILES; do
     59        image_name=`cat build_all/$profile/image_path`
     60        if [ -z "$image_name" ]; then
     61                continue
     62        fi
     63
     64        image_path="build_all/$profile/`cat build_all/$profile/image_path`"
     65        image_suffix=`echo "$image_name" | sed 's:.*\.::'`
     66
     67        release_name="HelenOS-${RELEASE}-`echo $profile | tr '/' '-'`.$image_suffix"
     68        cp "$image_path" "$release_name"
     69
     70        echo "Created $release_name"
     71done
  • tools/srepl

    rfa70134 r32b4302  
    11#!/bin/sh
     2
     3#
     4# Copyright (c) 2019 Jiří Zárevúcky
     5# All rights reserved.
     6#
     7# Redistribution and use in source and binary forms, with or without
     8# modification, are permitted provided that the following conditions
     9# are met:
     10#
     11# - Redistributions of source code must retain the above copyright
     12#   notice, this list of conditions and the following disclaimer.
     13# - Redistributions in binary form must reproduce the above copyright
     14#   notice, this list of conditions and the following disclaimer in the
     15#   documentation and/or other materials provided with the distribution.
     16# - The name of the author may not be used to endorse or promote products
     17#   derived from this software without specific prior written permission.
     18#
     19# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     24# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     28# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29#
    230
    331usage()
  • tools/travis.sh

    rfa70134 r32b4302  
    8787    echo "Will try to run C style check."
    8888    echo
    89     make ccheck || exit 1
     89    cd tools
     90    ./build-ccheck.sh || exit 1
     91    cd ..
     92    tools/ccheck.sh || exit 1
    9093    echo "C style check passed."
    9194    exit 0
     
    154157    fi
    155158
    156 
    157159    # Build it
    158     make "PROFILE=$H_ARCH" HANDS_OFF=y || exit 1
    159     test -s "$H_OUTPUT_FILENAME" || exit 1
     160    SRCDIR="$PWD"
     161
     162    mkdir -p build/$H_ARCH || exit 1
     163    cd build/$H_ARCH
     164
     165    export PATH="/usr/local/cross/bin:$PATH"
     166
     167    $SRCDIR/configure.sh $H_ARCH || exit 1
     168    ninja || exit 1
     169    ninja image_path || exit 1
     170
     171    cd $SRCDIR
    160172
    161173    echo
  • tools/xcw/bin/helenos-cc

    rfa70134 r32b4302  
    3232#
    3333
     34
     35
    3436XCW="$(dirname "$0")"
    3537SRC_ROOT="$XCW/../../.."
    3638if [ -z "$EXPORT_DIR" ]; then
    37         EXPORT_DIR="$SRC_ROOT/uspace/export"
     39        EXPORT_DIR="$SRC_ROOT/build/dist"
    3840fi
    39 UARCH="$("$XCW"/helenos-bld-config --uarch)"
    40 CC="$("$XCW"/helenos-bld-config --cc)"
    41 CFLAGS="$("$XCW"/helenos-bld-config --cflags)"
    42 ENDIAN="$("$XCW"/helenos-bld-config --endian)"
    4341
    44 echo helenos-cc "$@"
    45 "$CC" \
    46     -O3 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32LE -finput-charset=UTF-8 \
    47     $CFLAGS \
    48     -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
    49     -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings -ggdb \
    50     -fno-omit-frame-pointer \
    51     -D "$ENDIAN" \
    52     "$@" \
    53     -I"$XCW"/../include \
    54     -I"$EXPORT_DIR"/include/libc \
    55     -I"$EXPORT_DIR"/include
     42HELENOS_EXPORT_ROOT="$EXPORT_DIR"
     43
     44source "${EXPORT_DIR}/config/config.sh"
     45
     46# CC is a compilation driver, so we should check which stage of compilation
     47# is actually running and select which flags to provide. This makes no
     48# difference for GCC, but e.g. clang warns when a flag is provided that is
     49# unused
     50
     51needs_cflags=true
     52needs_ldflags=true
     53
     54for flag in "$@"; do
     55        case "$flag" in
     56                -E)
     57                        needs_cflags=false
     58                        needs_ldflags=false
     59                        break
     60                        ;;
     61                -c|-S)
     62                        needs_ldflags=false
     63                        break
     64                        ;;
     65        esac
     66done
     67
     68flags="-fwide-exec-charset=UTF-32LE -finput-charset=UTF-8 -fexec-charset=UTF-8"
     69flags="$flags -isystem ${HELENOS_EXPORT_ROOT}/include/libc -idirafter ${HELENOS_EXPORT_ROOT}/include"
     70
     71if $needs_cflags; then
     72        flags="$flags -O3 \
     73            -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
     74            -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings -ggdb"
     75
     76        flags="$flags $HELENOS_CFLAGS"
     77fi
     78
     79if $needs_ldflags; then
     80        flags="$flags $HELENOS_LDFLAGS"
     81fi
     82
     83flags="$flags $@"
     84
     85if $needs_ldflags; then
     86        flags="$flags $HELENOS_LDLIBS"
     87fi
     88
     89echo "helenos-cc" "$@"
     90PATH="$HELENOS_CROSS_PATH:$PATH" "${HELENOS_TARGET}-gcc" $flags
  • tools/xcw/bin/helenos-pkg-config

    rfa70134 r32b4302  
    3434XCW="$(dirname "$0")"
    3535SRC_ROOT="$XCW/../../.."
    36 UARCH="$("$XCW"/helenos-bld-config --uarch)"
    3736if [ -z "$EXPORT_DIR" ]; then
    38         EXPORT_DIR="$SRC_ROOT/uspace/export"
     37        EXPORT_DIR="$SRC_ROOT/build/dist"
    3938fi
    4039INCLUDE_DIR="$EXPORT_DIR/include"
  • tools/xcw/demo/Makefile

    rfa70134 r32b4302  
    5757
    5858$(output): $(objects)
    59         $(LD) -o $@ $^ $(LIBS)
     59        $(CC) -o $@ $^ $(LIBS)
    6060
    6161%.o: %.c
Note: See TracChangeset for help on using the changeset viewer.