diff options
-rw-r--r-- | INSTALL | 146 | ||||
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | buildfile | 2 | ||||
-rw-r--r-- | libbuild2/parser.cxx | 15 | ||||
-rw-r--r-- | repositories.manifest | 7 | ||||
-rw-r--r-- | tests/name/pattern.testscript | 44 |
6 files changed, 190 insertions, 26 deletions
@@ -0,0 +1,146 @@ +Unless you specifically only need the build2 build system, you should install +the entire build2 toolchain instead, either using the install script +(https://build2.org/install.xhtml) or the build2-toolchain distribution. + +The instructions outlined below are essentially a summary of the first three +steps of the manual bootstrap process described in build2-toolchain with a few +extra examples that would primarily be useful for distribution packaging. + +Also, below we only show commands for UNIX-like operating systems. For other +operating systems and for more details on each step, refer to the +build2-toolchain installation documentation. + +build2 requires a C++14 compiler. GCC 4.9, Clang 3.7, and MSVC 14 (2015) Update +3 or any later versions of these compilers are known to work. The build system +is self-hosted, which means that unless you have obtained a pre-built binary +from somewhere else, you will need to bootstrap it. To accomplish this, we use +the bootstrap.sh shell script (or equivalent batch files for Windows) found in +the root directory of the build2 distribution. On UNIX-like operating systems +as well as on Windows with MinGW or Clang, a GNU make makefile called +bootstrap.gmake can also be used with the major advanage over the script being +support for parallel compilation and an out of tree build (see comments inside +the makefile for more information). + +The following is the recommended sequence of steps: + +0. Prerequisites + + Get libbutl (normally from the same place where you got build2) and place + it inside build2, so that you have: + + build2-X.Y.Z + | + `-- libbutl-X.Y.Z + +1. Bootstrap, Phase 1 + + First, we build a minimal build system using bootstrap.sh (run bootstrap.sh + -h for options): + + $ cd build2-X.Y.Z + $ ./bootstrap.sh g++ + + $ build2/b-boot --version + + Alternatively, we can use the bootstrap.gmake makefile: + + $ cd build2-X.Y.Z + $ make -f bootstrap.gmake -j 8 CXX=g++ + + $ build2/b-boot --version + + If you would prefer to bootstrap out of source tree, this is supported by + the makefile (but not the script): + + $ mkdir build2-boot + $ make -C build2-boot -f ../build2-X.Y.Z/bootstrap.gmake -j 8 CXX=g++ + + $ build2-boot/build2/b-boot --version + +2. Bootstrap, Phase 2 + + Then, we rebuild the build system with the result of Phase 1 linking + libraries statically. + + $ build2/b-boot config.cxx=g++ config.bin.lib=static build2/exe{b} + $ mv build2/b build2/b-boot + + $ build2/b-boot --version + + Or, alternatively, for an out of source build: + + $ build2-boot/build2/b-boot config.cxx=g++ config.bin.lib=static \ + build2-X.Y.Z/build2/@build2-static/build2/exe{b} + + $ build2-static/build2/b --version + +3. Build and Install + + Finally, we configure, build, and optionally install the "final" version + using shared libraries: + + $ build2/b-boot configure \ + config.config.hermetic=true \ + config.cxx=g++ \ + config.cc.coptions=-O3 \ + config.bin.rpath=/usr/local/lib \ + config.install.root=/usr/local \ + config.install.sudo=sudo + + $ build2/b-boot + + | The config.config.hermetic=true configuration variable in the first + | command makes sure the embedded ~host and ~build2 configurations include + | the current environment. This is especially important for ~build2 which + | is used to dynamically build and load ad hoc recipes and build system + | modules and must therefore match the environment that was used to build + | the build system itself. + + If you are only interested in installing the result, then you can avoid + building tests by specifying the update-for-install operation in the last + command: + + $ build2/b-boot update-for-install + + On the other hand, if I you are not planning to install the result, then + you can omit the config.install.* values as well as .rpath. + + To install: + + $ build2/b-boot install + $ which b + $ b --version + + To uninstall: + + $ b uninstall + $ which b + + Or, alternatively, for an out of source build: + + $ build2-static/build2/b configure: build2-X.Y.Z/@build2-shared/ \ + config.config.hermetic=true \ + config.cxx=g++ \ + config.cc.coptions=-O3 \ + config.bin.rpath=/usr/local/lib \ + config.install.root=/usr/local \ + config.install.sudo=sudo + + $ build2-static/build2/b update-for-install: build2-shared/ + + $ build2-static/build2/b install: build2-shared/ + + $ b uninstall: build2-shared/ + + For distribution packaging it is often required to install "as if" into the + system directory (for example, /usr) but to copy the files somewhere else + (for example, /tmp/install/usr; aka the DESTDIR functionality). In build2 + this can be achieved with the config.install.chroot configuration variable, + for example: + + $ build2-static/build2/b configure: build2-X.Y.Z/@build2-shared/ \ + config.config.hermetic=true \ + config.cxx=g++ \ + config.cc.coptions=-O3 \ + config.install.root=/usr \ + config.install.chroot=/tmp/install @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2014-2024 the build2 authors (see the AUTHORS file). +Copyright (c) 2014-2025 the build2 authors (see the AUTHORS file). Copyright (c) Microsoft Corporation for the libbuild2/cc/msvc-setup.h file. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -1,7 +1,7 @@ # file : buildfile # license : MIT; see accompanying LICENSE file -./: {*/ -build/ -config/ -old-tests/} \ +./: {*/ -build/ -config/ -old-tests/ -doc/} \ doc{INSTALL NEWS README} legal{LICENSE AUTHORS} \ file{INSTALL.cli bootstrap* config.guess config.sub} \ manifest diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index c3f349c..578d3dd 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -7258,7 +7258,9 @@ namespace build2 (root_ != nullptr && root_->root_extra != nullptr && m.to_directory () && - exists (d.sp / m / root_->root_extra->buildignore_file))) + exists (m.relative () + ? d.sp / m / root_->root_extra->buildignore_file + : m / root_->root_extra->buildignore_file))) return !interm; // Note that we have to make copies of the extension since there will @@ -7314,9 +7316,11 @@ namespace build2 return true; }); + path pat (move (p)); + try { - path_search (path (move (p)), + path_search (pat, process, *sp, path_match_flags::follow_symlinks, @@ -7324,7 +7328,8 @@ namespace build2 } catch (const system_error& e) { - fail (l) << "unable to scan " << *sp << ": " << e; + fail (l) << "unable to scan for '" + << (pat.relative () ? *sp / pat : pat) << "': " << e; } }; @@ -8341,8 +8346,8 @@ namespace build2 { // Note that we can never end up with the empty name here. For // example, for the below constructs the above - // parse_names_trailer() call would fail with the `typed empty - // name` error, since the empty name's type will be set to "+" + // parse_names_trailer() call would fail with the 'typed empty + // name' error, since the empty name's type will be set to "+" // (see above for details): // // foo/{hxx cxx}{+{}} diff --git a/repositories.manifest b/repositories.manifest index 25be350..e37a9e7 100644 --- a/repositories.manifest +++ b/repositories.manifest @@ -3,4 +3,9 @@ summary: build2 build system repository : role: prerequisite -location: ../libbutl.git#HEAD +location: ../libbutl.git#master + +: +role: prerequisite +location: https://stage.build2.org/1 +trust: EC:50:13:E2:3D:F7:92:B4:50:0B:BF:2A:1F:7D:31:04:C6:57:6F:BC:BE:04:2E:E0:58:14:FA:66:66:21:1F:14 diff --git a/tests/name/pattern.testscript b/tests/name/pattern.testscript index efd15b2..acad250 100644 --- a/tests/name/pattern.testscript +++ b/tests/name/pattern.testscript @@ -105,62 +105,70 @@ EOI : { touch foo.txt; - $* <'print *.txt' >'foo.txt' : simple-file + $* <'print *.txt' >'foo.txt' : simple-file mkdir foo; - $* <'print */' >/'foo/' : simple-dir + $* <'print */' >/'foo/' : simple-dir touch foo.txt; - $* <'print {*.txt}' >'foo.txt' : group + $* <'print {*.txt}' >'foo.txt' : group touch foo.txt; - $* <'print {+*.txt}' >'foo.txt' : plus-prefixed + $* <'print {+*.txt}' >'foo.txt' : plus-prefixed mkdir dir && touch dir/foo.txt; - $* <'print dir/{*.txt}' >'dir/foo.txt' : dir + $* <'print dir/{*.txt}' >'dir/foo.txt' : dir touch foo.txt; - $* <'print file{*.txt}' >'file{foo.txt}' : type + $* <'print file{*.txt}' >'file{foo.txt}' : type touch foo.txt; - $* <'print x@{*.txt}' >'x@foo.txt' : pair + $* <'print x@{*.txt}' >'x@foo.txt' : pair touch bar.txt; - $* <'print x@dir/file{f*.txt}' >'' : empty + $* <'print x@dir/file{f*.txt}' >'' : empty mkdir dir && touch dir/foo.txt; - $* <'print **.txt' >/'dir/foo.txt' : recursive + $* <'print **.txt' >/'dir/foo.txt' : recursive mkdir dir && touch dir/foo.txt; - $* <'print d*/*.txt' >/'dir/foo.txt' : multi-pattern + $* <'print d*/*.txt' >/'dir/foo.txt' : multi-pattern touch foo.txt bar.txt; - $* <'print {*.txt -bar.txt}' >'foo.txt' : exclude-non-pattern + $* <'print {*.txt -bar.txt}' >'foo.txt' : exclude-non-pattern mkdir baz; touch foo.txt bar.txt baz/fox.txt baz/box.txt; - $* <'print {**.txt -b*.txt -b*/*}' >'foo.txt' : exclude-pattern + $* <'print {**.txt -b*.txt -b*/*}' >'foo.txt' : exclude-pattern touch foo.txt bar.txt baz.txt; - $* <'print {*.txt -{*z.txt bar.txt}}' >'foo.txt' : exclude-group + $* <'print {*.txt -{*z.txt bar.txt}}' >'foo.txt' : exclude-group touch bar.txt; - $* <'print {f*.txt +bar.txt}' >'bar.txt' : include-non-wildcard + $* <'print {f*.txt +bar.txt}' >'bar.txt' : include-non-wildcard touch bar.txt; - $* <'print {f*.txt +b*.txt}' >'bar.txt' : include-pattern + $* <'print {f*.txt +b*.txt}' >'bar.txt' : include-pattern mkdir bar; - $* <'print {f*/ +{b*/}}' >/'bar/' : include-group + $* <'print {f*/ +{b*/}}' >/'bar/' : include-group mkdir -p foo/bar; $* <'print $path.canonicalize(foo/{+{b*/}})' >/'foo/bar/' : include-group-first touch foo.txt fox.txt; - $* <'print {*.txt -f*.txt +*x.txt}' >'fox.txt' : include-exclude-order + $* <'print {*.txt -f*.txt +*x.txt}' >'fox.txt' : include-exclude-order touch foo.txt; - $* <'print {+foo.txt} {+bar.txt}' >'foo.txt' : non-wildcard + $* <'print {+foo.txt} {+bar.txt}' >'foo.txt' : non-wildcard + + mkdir -p foo/bar; + touch foo/bar/baz.txt; + $* <'print {$src_base/foo/**}' >/"$~/foo/bar/baz.txt" : abs-path-pattern + + mkdir -p foo/bar; + touch foo/bar/baz.txt; + $* <'print $src_base/foo/{**}' >/"$~/foo/bar/baz.txt" : abs-start-dir } : escaping |