예제 #1
0
파일: gen.py 프로젝트: spoutn1k/testsuite
#!/usr/bin/env python3

from ninja_syntax import Writer

with open("build.ninja", "w") as buildfile:
    n = Writer(buildfile)

    n.variable("cc", "clang")
    n.variable("cflags", "-Weverything")

    n.rule("compile",
           command="$cc $cflags -c $in -o $out",
           description="Compiling object file $out")

    n.rule("link",
           command="$cc $in -o $out",
           description="Linking executable $out")
    n.build("hello.o", "compile hello.c")
    n.build("hello", "link hello.o")

    n.default("hello")
예제 #2
0
                                     # Prevent running msgfmt:
                                     'touch `find . -name *.gmo`',
                                 ] + default_build_commands + [
                                     # delete unwanted stuff
                                     'rm -f $destdir/bin/{autopoint,envsubst,gettext*,ngettext,recode-sr-latin}',
                                     # fix dylib references to work
                                     '$top_srcdir/../macos/fixup-dylib-deps.sh //lib @executable_path/../lib $destdir/lib $destdir/bin/*',
                                     # strip executables
                                     'strip -S -u -r $destdir/bin/{msgfmt,msgmerge,msgunfmt,msgcat,xgettext}',
                                     'strip -S -x $destdir/lib/lib*.*.dylib',
                                 ]))

    targets.append(gen_configure(n, 'icu',
                                 srcdir='icu4c',
                                 configure='./source/configure',
                                 flags=[
                                     '--prefix=/',
                                     'CC=$cc',
                                     'CXX=$cxx',
                                     'CFLAGS="$cflags -DU_STATIC_IMPLEMENTATION"',
                                     'CXXFLAGS="$cxxflags -DU_STATIC_IMPLEMENTATION"',
                                     'LDFLAGS="$ldflags"',
                                     '--disable-shared',
                                     '--enable-static',
                                     '--with-data-packaging=archive',
                                     '--disable-tests',
                                     '--disable-samples',
                                 ]))

    n.default(targets)
예제 #3
0
                    inputs=source)
        else:
            n.build(outputs=source.replace('.cpp',
                                           '.o').replace('src', BUILD_DIR),
                    rule='compile',
                    inputs=source)

    o_files = []
    if sys.platform == 'win32':
        o_files = [
            x.replace('.cpp', '.obj').replace('src', BUILD_DIR)
            for x in sources
        ]
    else:
        o_files = [
            x.replace('.cpp', '.o').replace('src', BUILD_DIR) for x in sources
        ]

    n.build(outputs=PROJECT_NAME, rule='link', inputs=o_files)

    n.newline()

    ############################################################################
    # DEFAULTS
    ############################################################################

    n.default('dirs')
    n.default(PROJECT_NAME)
    if sys.platform != 'win32':
        n.default('sym')
        n.build(object_file, cxx_compiler, inputs="$GME_ROOT/" + src)
        object_list.append(object_file)
    object_file = "$OBJECTS/gme_" + gme_type + "_interface.o"
    n.build(object_file, cxx_compiler, inputs="gme_interface.cpp")
    object_list.append(object_file)
    n.newline()

    player_target = "$FINAL_DIR/cr-gme-" + gme_type + ".js"
    n.comment("link the " + gme_type + " GME player")
    n.build(player_target, "LINK_GME", inputs=object_list)
    targets_list.append(player_target)
    compressed_targets_list.append(player_target + "gz")
    n.newline()

# the compressed targets
for i in xrange(len(targets_list)):
    n.build(compressed_targets_list[i], "COMPRESS", inputs=targets_list[i])
n.newline()

# the uncompressed targets
n.build("players", "phony", inputs=targets_list)
n.newline()

# the compressed targets
n.build("compressed-players", "phony", inputs=compressed_targets_list)
n.newline()

# default rule
n.comment("build the uncompressed players by default")
n.default("players")
예제 #5
0
                                     # Prevent running msgfmt:
                                     'touch `find . -name *.gmo`',
                                 ] + default_build_commands + [
                                     # delete unwanted stuff
                                     'rm -f $destdir/bin/{autopoint,envsubst,gettext*,ngettext,recode-sr-latin}',
                                     # fix dylib references to work
                                     '$top_srcdir/../macos/fixup-dylib-deps.sh //lib @executable_path/../lib $destdir/lib $destdir/bin/*',
                                     # strip executables
                                     'strip -u -r $destdir/bin/{msgfmt,msgmerge,msgunfmt,msgcat,xgettext}',
                                     'strip -x $destdir/lib/lib*.*.dylib',
                                 ]))

    targets.append(gen_configure(n, 'icu',
                                 srcdir='icu4c',
                                 configure='./source/configure',
                                 flags=[
                                     '--prefix=/',
                                     'CC=$cc',
                                     'CXX=$cxx',
                                     'CFLAGS="$cflags -DU_STATIC_IMPLEMENTATION"',
                                     'CXXFLAGS="$cxxflags -DU_STATIC_IMPLEMENTATION"',
                                     'LDFLAGS="$ldflags"',
                                     '--disable-shared',
                                     '--enable-static',
                                     '--with-data-packaging=archive',
                                     '--disable-tests',
                                     '--disable-samples',
                                 ]))

    n.default(targets)