├── .editorconfig ├── .gitignore ├── .gitmodules ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── ab3.sh ├── arch ├── NOARCH.sh ├── _common.sh ├── _common_switches.sh ├── alpha.sh ├── amd64.sh ├── amd64_avx+.sh ├── amd64_avx2+.sh ├── arm64.sh ├── armv4.sh ├── armv6hf.sh ├── armv7hf.sh ├── i386.sh ├── i486.sh ├── loongarch64.sh ├── loongson2f.sh ├── loongson3.sh ├── mips32r6el.sh ├── mips64r6el.sh ├── powerpc.sh ├── ppc64.sh ├── ppc64el.sh ├── riscv64.sh └── sparc64.sh ├── build ├── 00-self.sh ├── 10-autotools.sh ├── 11-cmakeninja.sh ├── 12-cmake.sh ├── 12-meson.sh ├── 12-waf.sh ├── 15-dune.sh ├── 15-gomod.sh ├── 15-perl.sh ├── 15-python.sh ├── 15-rust.sh ├── 16-pep517.sh ├── 20-qtproj.sh ├── 20-ruby.sh ├── 25-npm.sh ├── 29-plainmake.sh └── 30-dummy.sh ├── contrib ├── autobuild-2to3 ├── autobuild-aoscarchive ├── autobuild-batch └── autobuild-test ├── etc └── autobuild │ ├── ab3_defcfg.sh │ ├── ab3cfg.sh │ └── prefix ├── exportvars ├── build_qtproj ├── compilers ├── default ├── filter_elf ├── flags ├── offical_builds └── python ├── filter ├── elf.sh ├── elf │ ├── dep.sh │ ├── split.sh │ └── strip.sh ├── info_dir.sh ├── infocompress.sh ├── lib_archives.sh ├── mancompress.sh ├── perl.sh └── retro_drop_docs.sh ├── lib ├── arch.sh ├── base.sh ├── builtins.sh ├── depset.sh ├── diag.sh ├── elf.sh ├── fileenum.sh ├── pm.sh ├── set.sh └── tests.sh ├── pm └── dpkg │ ├── install │ ├── lib.sh │ └── pack ├── proc ├── 00-python_defines.sh ├── 10-core_defines.sh ├── 10-env-setup.sh ├── 10-qa_pre_build.sh ├── 10-tests_scan.sh ├── 11-cleanup.sh ├── 11-pm_deps.sh ├── 11-preproc.sh ├── 12-arch_compiler.sh ├── 12-arch_flags.sh ├── 12-parallel.sh ├── 20-build_funcs.sh ├── 30-build_probe.sh ├── 31-tests_probe.sh ├── 35-build_env_src.sh ├── 36-ld_switch.patch ├── 40-patch.sh ├── 50-build_exec.sh ├── 51-filter.sh ├── 51-tests_post_build.sh ├── 60-licenses.sh ├── 61-conffiles.sh ├── 70-scripts.sh ├── 75-qa_post_build.sh ├── 80-pm_pack.sh ├── 90-pm_install.sh ├── 92-tests_post_install.sh └── 99-pm_archive.sh ├── qa ├── post │ ├── lingering_files.sh │ ├── path_issues.sh │ ├── permissions.sh │ └── zero_byte.sh └── pre │ ├── mter.sh │ └── sections.sh ├── quirks └── ready │ └── gnome ├── scriptlet ├── 01-alternatives.sh ├── 02-usergroup.sh └── 03-pax.sh ├── sets ├── arch_groups │ ├── arm │ ├── mainline │ ├── ocaml_native │ └── retro ├── section └── testspec_exports └── tests ├── custom.sh └── rust.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.sh] 2 | indent_style = tab 3 | end_of_line = lf 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | etc/defaults/pm 2 | etc/prefix 3 | 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule ".githubwiki"] 2 | path = .githubwiki 3 | url = https://github.com/AOSC-Dev/autobuild3.wiki.git 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | autobuild3 follows some issue-driven development. 5 | 6 | Issues 7 | ------ 8 | 9 | First of all, update to the latest tag. If it doesn't work, update to Git master. 10 | 11 | Write descriptive text, give nice (better if minimal) reproductions for bugs 12 | and good documentation for pending features. 13 | 14 | Pull Requests 15 | ------------- 16 | 17 | Always, write `module/file[, ...]: msg` as title and add extra stuff below, 18 | with a blank line as spacing so git (and hub) will take it as descriptions. 19 | Sign-Off should NOT be used in regular commits or you are flooding our 20 | Channel. 21 | 22 | Using camelCase instead of slashes, or using historical / commonly-accepted 23 | forms of words like `fltr` instead of `filter`, or other ways like `libarch` 24 | instead of `lib/arch` is acceptable. The `.sh` suffix is not necessary. 25 | 26 | Workflow 27 | -------- 28 | 29 | Git workflow without minor version branches and development branches. Using 30 | patch version branches is more than insane, so omitted. 31 | 32 | Versioning 33 | ---------- 34 | 35 | Tags only. Prefix the tagname with `v` for versions. 36 | 37 | If you are really happy, change a file like `autobuild/defines` and create a 38 | commit like this: 39 | 40 | ```Markdown 41 | ab/defines: bumping to version v0.1.4 42 | 43 | Issues and PRs: #17, #18, #24, #11, AOSC-Dev/abbs#4, ...... 44 | 45 | 46 | - #17: a short title 47 | - #18: a manually shortened title 48 | - #24: ... 49 | 50 | Major Changes: 51 | 52 | - Deprecated use of `USEQT4`, ........ 53 | 54 | ``` 55 | 56 | and when you publish the release with this commit, the release text will 57 | be automatically filled with the description. All you need is to clear the 58 | title. 59 | 60 | Doing so allow people to see your release log offline, in git. 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | autobuild3 2 | ========== 3 | [![Stories in Ready](https://badge.waffle.io/AOSC-Dev/autobuild3.png?label=ready&title=Ready)](https://waffle.io/AOSC-Dev/autobuild3) 4 | 5 | Autobuild is a distribution packaging toolkit meant to carry out the following functions: 6 | 7 | - Definition, therefore identification of source code 8 | - Preparing and patching of source code 9 | - Building of source code 10 | - Quality control of built binaries 11 | - Packaging of built binaries 12 | 13 | Autobuild3 is essentially a set of scripts (`autobuild` is the only command script useful for invoking a build process) that works to automatically carry out the function listed above, and to simplify build configuration (build scripts in another word) using various pre-designed build routines, named `ABTYPE` or Autobuild Build Types. More will be discussed below (extensively). 14 | 15 | Autobuild3 is a successor to the original [Autobuild](https://github.com/AOSC-Dev/autobuild) used back in 2013 when AOSC OS2 was initially rebooted as a independent Linux distribution. Unlike Autobuild being a distribution specific and single backend toolkit, Autobuild3 is distribution neutral and supports various backends: 16 | 17 | - DPKG, the most "native" backend of all, using `dpkg-deb` and Autobuild variables to control the generation of DPKG control files, and henceforth building the packages. 18 | - The "native" part is largely caused by some autobuild2 heritage in our brains and in the build scripts, which ended up infecting many other parts of ab3. For example, the architecture names in `ABHOST` and `ABBUILD` are dpkg names, the PM dep model is based on dpkg representations, ... 19 | - PKGBUILD (coming soon), using Autobuild variables to generate `PKGBUILD` files, using a temporary install root, to provide `makepkg` with a fake binary packaging process. 20 | 21 | Installing autobuild3 22 | --------------------- 23 | 24 | - Self-bootstrapping: `sudo ./ab3.sh` 25 | - HELP: `./ab3.sh help` 26 | 27 | Documentations 28 | -------------- 29 | 30 | Documentations can be found [here](https://github.com/AOSC-Dev/aosc-os-abbs/wiki/Autobuild3). 31 | 32 | Porting 33 | ------- 34 | 35 | Autobuild3 contains some AOSC-specific code, especially some definitions about system paths. You may want to change it before you use it on your system. 36 | 37 | License 38 | ------- 39 | 40 | GNU GPLv2+. 41 | -------------------------------------------------------------------------------- /ab3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ab3.sh: the starting point 3 | ##@copyright GPL-2.0+ 4 | 5 | # Basic environment declarations 6 | export ABVERSION=3 7 | export ABSET=/etc/autobuild 8 | if [ ! "$AB" ]; then 9 | export AB=$(cat "$ABSET/prefix" || dirname "$(readlink -e "$0")") 10 | fi 11 | export ABBLPREFIX=$AB/lib 12 | export ABBUILD ABHOST ABTARGET 13 | # compat 1.x and fallback 14 | : "${ABBUILD=$ARCH}" "${ABHOST=${CROSS:-$ABBUILD}}" "${ABTARGET=$ABHOST}" 15 | 16 | # For consistency of build output 17 | export LANG=C.UTF-8 18 | 19 | # Behavior 20 | ((AB_NOISY)) && set -xv 21 | ((AB_SELF)) && AB=$(dirname "$(readlink -e "$0")") 22 | 23 | # Check and load base library 24 | # TODO: split autobuild base libraries from the base libraries 25 | # or the other way around. 26 | . $AB/lib/diag.sh || { echo "\e[1;91m FATAL: Cannot open stacktrace printing library! exiting."; exit 1; } 27 | . $AB/lib/base.sh || { echo "\e[1;91m FATAL: Cannot open base library! exiting."; exit 1; } 28 | . $AB/lib/builtins.sh || { echo "\e[1;91m FATAL: Cannot open utility function library! exiting."; exit 1; } 29 | 30 | autobuild-help(){ 31 | abinfo "Help Requested." 32 | echo -e "\e[1mAutobuild ${ABVERSION:-3}\e[0m, the next generation of autobuild for AOSC OS,\nwith multiple package manager support.\nAutobuild 3 is Licensed under the GNU General Public License, version 2.\n 33 | \e[1mBRIEF HELP:\tEnvironment variables\e[0m 34 | \e[1mAB_NOISY\e[0m\tRuns \`set -xv' if set to a non-empty value. 35 | \e[1mAB_SELF\e[0m\tBuilds autobuild itself in the source tree if set to a non-empty value.\n\t\tDefault if $ABSET/prefix doesn't exist. 36 | \e[1mAB_DBG\e[0m\tPrints debug information to stderr if set to a non-empty value.\n\t\tNow it prints the files sourced.\n" 37 | 38 | # Not implemented. 39 | # . $AB/extended-help 2>/dev/null 40 | 41 | abinfo "End of autobuild-core help." 42 | abinfo "See GitHub wiki at AOSC-Dev/autobuild3 for information on usage and hacking." 43 | } 44 | 45 | autobuild-clean(){ 46 | rm -rf {abdist,*_*.tar.xz,*.deb,abscripts,abspec} && 47 | abinfo "Build directory clean." 48 | } 49 | autobuild-plugin(){ 50 | ab_dbg "Called plugin bootstrap.." 51 | } 52 | 53 | # Plugin and external command parser 54 | if [ "$1" ]; then 55 | PATH="$AB/contrib:$PATH" PLUG="$1" 56 | shift 57 | ab_dbg "Starting autobuild-$PLUG" 58 | "autobuild-$PLUG" "$@" 59 | _ret=$? 60 | ((!_ret)) || aberr "autobuild-$PLUG returned ${_ret}." 61 | exit $_ret 62 | fi 63 | 64 | # RTFM: help source 65 | recsr $AB/proc/*.sh 66 | -------------------------------------------------------------------------------- /arch/NOARCH.sh: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /arch/_common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/_common.sh: Common arch defs for all ab arches, defines-mutable. 3 | ##@copyright GPL-2.0+ 4 | AB_FLAGS_TYPES='_OPTI _ARCH _WEIRD ' 5 | AB_FLAGS_FEATURES='LTO PERMISSIVE ' 6 | # Naming, sadly. PORT_NOTICE! 7 | ARCH_TARGET['amd64']=x86_64-aosc-linux-gnu 8 | ARCH_TARGET['amd64/avx+']=x86_64-aosc-linux-gnu 9 | ARCH_TARGET['amd64/avx2+']=x86_64-aosc-linux-gnu 10 | ARCH_TARGET['arm64']=aarch64-aosc-linux-gnu 11 | ARCH_TARGET['armv4']=arm-aosc-linux-gnueabi 12 | ARCH_TARGET['armv6hf']=arm-aosc-linux-gnueabihf 13 | ARCH_TARGET['armv7hf']=arm-aosc-linux-gnueabihf 14 | ARCH_TARGET['i386']=i686-aosc-linux-gnu 15 | ARCH_TARGET['i486']=i486-aosc-linux-gnu 16 | ARCH_TARGET['loongson2f']=mips64el-aosc-linux-gnuabi64 17 | ARCH_TARGET['loongson3']=mips64el-aosc-linux-gnuabi64 18 | ARCH_TARGET['loongarch64']=loongarch64-aosc-linux-gnu 19 | ARCH_TARGET['m68k']=m68k-aosc-linux-gnu 20 | ARCH_TARGET['mips32r6el']=mipsisa32r6el-aosc-linux-gnu 21 | ARCH_TARGET['mips64r6el']=mipsisa64r6el-aosc-linux-gnuabi64 22 | ARCH_TARGET['powerpc']=powerpc-aosc-linux-gnu 23 | ARCH_TARGET['ppc64']=powerpc64-aosc-linux-gnu 24 | ARCH_TARGET['ppc64el']=powerpc64le-aosc-linux-gnu 25 | ARCH_TARGET['riscv64']=riscv64-aosc-linux-gnu 26 | ARCH_TARGET['alpha']=alpha-aosc-linux-gnu 27 | # C Compiler Flags. 28 | CFLAGS_COMMON='-pipe -Wno-error ' 29 | CFLAGS_COMMON_OPTI='-O2 ' 30 | CFLAGS_COMMON_DEBUG='-O0 ' # not that frequently used since autotools know it. 31 | CFLAGS_GCC=' ' 32 | CFLAGS_GCC_OPTI="-fira-loop-pressure -fira-hoist-pressure -ftree-vectorize " 33 | CFLAGS_GCC_OPTI_LTO="-flto=auto " 34 | CFLAGS_GCC_DEBUG='-Og ' # note: not enabled for clang 35 | # CFLAGS_CLANG='-fno-integrated-as ' # GNU as has compatibility issue with clang on ARMv8.[01] 36 | CFLAGS_CLANG_OPTI_LTO='-flto ' 37 | CFLAGS_DBG_SYM='-ggdb' # Appended when ABSPLITDBG is turned on 38 | # C Specific Flags. 39 | CFLAGS_COMMON_WEIRD='' 40 | # What to add for C++ Compiler Flags. 41 | CXXFLAGS_GCC_OPTI="-fdeclone-ctor-dtor -ftree-vectorize " 42 | CXXFLAGS_COMMON_WEIRD='' 43 | CXXFLAGS_COMMON_PERMISSIVE="-fpermissive " 44 | # Preprocesser Flags. 45 | CPPFLAGS_COMMON="-D_GLIBCXX_ASSERTIONS " 46 | # OBJC Flags. 47 | OBJCFLAGS_COMMON_WEIRD='' 48 | # OBJCXX Flags. 49 | OBJCXXFLAGS_COMMON_WEIRD='' 50 | OBJCXXFLAGS_COMMON_PERMISSIVE="-fpermissive " 51 | # RUST Flags. 52 | RUSTFLAGS_COMMON='' 53 | RUSTFLAGS_COMMON_OPTI='-Ccodegen-units=1 -Copt-level=3 ' 54 | RUSTFLAGS_COMMON_WEIRD='' 55 | # Use clang + lld for processing LTO 56 | RUSTFLAGS_COMMON_OPTI_LTO='-Cembed-bitcode=yes -Clinker-plugin-lto -Clinker=clang -Clink-arg=-flto -Clink-arg=-fuse-ld=lld -Clink-arg=-Wl,-build-id=sha1 -Clink-arg=-Wl,--lto-O3' 57 | # Linker Flags. (actually passed to your CC, just FYI) 58 | # LDFLAGS writing helpers: 59 | ld_arg(){ printf %s '-Wl'; local IFS=,; printf %s "$*"; } 60 | ld_path(){ local path=$(arch_lib "$@"); ld_arg "$path"; echo -n " -L$path"; } 61 | LDFLAGS_COMMON="-Wl,-O1,--sort-common,--as-needed -Wl,-build-id=sha1" 62 | #LDFLAGS_COMMON_OPTI='-Wl,--relax ' # on some arches this interfere with debugging, therefore put into OPTI. 63 | # temporarily disabled because this breaks core-devel/glibc build (-r cannot be used together with --relax). 64 | # investigation advised. 65 | LDFLAGS_COMMON_OPTI_LTO="-flto -fuse-linker-plugin " 66 | LDFLAGS_COMMON_OPTI_NOLTO='-fno-lto -fuse-linker-plugin ' 67 | LDFLAGS_COMMON_CROSS_BASE="-Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link $(ld_path) " 68 | -------------------------------------------------------------------------------- /arch/_common_switches.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/_common_switches.sh: Switches sourced after defines. 3 | ##@copyright GPL-2.0+ 4 | if ((AB_FLAGS_SSP)); then CFLAGS_COMMON+=' -fstack-protector-strong --param=ssp-buffer-size=4 '; fi 5 | if ((AB_FLAGS_SCP)); then CFLAGS_GCC_COMMON+=' -fstack-clash-protection '; fi 6 | if ((AB_FLAGS_RRO)); then LDFLAGS_COMMON+=' -Wl,-z,relro '; fi 7 | if ((AB_FLAGS_NOW)); then LDFLAGS_COMMON+=' -Wl,-z,now '; fi 8 | if ((AB_FLAGS_FTF)); then CPPFLAGS_COMMON+=' -D_FORTIFY_SOURCE=2 '; fi 9 | if ((AB_FLAGS_SPECS)); then CFLAGS_GCC_OPTI+=" -specs=/usr/lib/gcc/specs/hardened-cc1 "; fi 10 | if ((AB_FLAGS_O3)); then CFLAGS_COMMON_OPTI="${CFLAGS_COMMON_OPTI/O2/O3}"; fi 11 | if ((AB_FLAGS_OS)); then CFLAGS_COMMON_OPTI="${CFLAGS_COMMON_OPTI/O2/Os}"; fi 12 | if ((AB_FLAGS_EXC)); then CFLAGS_COMMON+=' -fexceptions '; fi 13 | 14 | # Clang can handle PIE and PIC properly, let it do the old job. 15 | if bool $USECLANG; then 16 | if ((AB_FLAGS_PIC)); then LDFLAGS_COMMON+=' -fPIC ' CFLAGS_COMMON+=' -fPIC '; fi 17 | if ((AB_FLAGS_PIE)); then LDFLAGS_COMMON+=' -fPIE -pie ' CFLAGS_COMMON+=' -fPIE '; fi 18 | elif ((AB_FLAGS_SPECS)); then LDFLAGS_COMMON+=" -specs=/usr/lib/gcc/specs/hardened-ld "; 19 | fi 20 | 21 | if bool $ABSPLITDBG; then 22 | CFLAGS_COMMON+=" ${CFLAGS_DBG_SYM} " 23 | CXXFLAGS_COMMON+=" ${CFLAGS_DBG_SYM} " 24 | fi 25 | 26 | if ((AB_SAN_ADD)); then CFLAGS_COMMON+='-fsanitize=address '; fi 27 | if ((AB_SAN_THR)); then CFLAGS_COMMON+='-fsanitize=thread '; fi 28 | if ((AB_SAN_LEK)); then CFLAGS_COMMON+='-fsanitize=leak '; fi 29 | -------------------------------------------------------------------------------- /arch/alpha.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/alpha.sh: Build definitions for DEC Alpha. 3 | ##@copyright GPL-2.0+ 4 | CFLAGS_COMMON_ARCH=' -mieee -mcpu=ev4 ' 5 | # Retro: Overriding mainline definitions, and take more interest in reducing code size. 6 | CFLAGS_COMMON_OPTI=' -Os ' 7 | # Retro: Also disabling -ftree-vectorization which could potentially enlarge code size. 8 | CFLAGS_GCC_OPTI=' -fira-loop-pressure -fira-hoist-pressure ' 9 | -------------------------------------------------------------------------------- /arch/amd64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/amd64.sh: Build definitions for amd64. 3 | ##@copyright GPL-2.0+ 4 | CFLAGS_COMMON_ARCH='-fomit-frame-pointer -march=x86-64 -mtune=sandybridge -msse2 ' 5 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=x86-64 ' 6 | -------------------------------------------------------------------------------- /arch/amd64_avx+.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/amd64_avx.sh: Build definitions for amd64 with AVX support. 3 | ## Intel SandyBridge and AMD Bulldozer or later processors. 4 | ##@copyright GPL-2.0+ 5 | CFLAGS_COMMON_ARCH=' -fomit-frame-pointer -march=sandybridge ' 6 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=sandybridge ' 7 | -------------------------------------------------------------------------------- /arch/amd64_avx2+.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/amd64_avx2.sh: Build definitions for amd64 with AVX2 support. 3 | ## Intel Haswell+, AMD bdver4+, VIA eden-x4+. 4 | ##@copyright GPL-2.0+ 5 | CFLAGS_COMMON_ARCH=' -fomit-frame-pointer -march=haswell -mno-rdrnd ' 6 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=haswell -Ctarget-feature=-rdrnd ' 7 | -------------------------------------------------------------------------------- /arch/arm64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/arm64.sh: Build definitions for arm64. 3 | ##@copyright GPL-2.0+ 4 | CFLAGS_COMMON_ARCH='-march=armv8-a -mtune=cortex-a53' 5 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=generic ' 6 | LDFLAGS_COMMON_CROSS='-Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/var/ab/cross-root/arm64/usr/lib -L/var/ab/cross-root/arm64/usr/lib ' 7 | -------------------------------------------------------------------------------- /arch/armv4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/armv4.sh: Build definitions for ARMv4 (w/o THUMB). 3 | ##@copyright GPL-2.0+ 4 | 5 | # Retro: Overriding mainline definitions, and take more interest in reducing code size. 6 | CFLAGS_COMMON_OPTI='-Os -ffunction-sections -fdata-sections ' 7 | LDFLAGS_COMMON_OPTI='-Wl,--gc-sections ' 8 | # Retro: Also disabling -ftree-vectorization which could potentially enlarge code size. 9 | CFLAGS_GCC_OPTI='-fira-loop-pressure -fira-hoist-pressure ' 10 | 11 | CFLAGS_COMMON_ARCH='-march=armv4 -mtune=strongarm110 -mfloat-abi=soft ' 12 | -------------------------------------------------------------------------------- /arch/armv6hf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/armv6hf.sh: Build definitions for ARMv6 (hard float). 3 | ##@copyright GPL-2.0+ 4 | 5 | # Retro: Overriding mainline definitions, and take more interest in reducing code size. 6 | CFLAGS_COMMON_OPTI='-Os -ffunction-sections -fdata-sections ' 7 | LDFLAGS_COMMON_OPTI='-Wl,--gc-sections ' 8 | # Retro: Also disabling -ftree-vectorization which could potentially enlarge code size. 9 | CFLAGS_GCC_OPTI='-fira-loop-pressure -fira-hoist-pressure ' 10 | 11 | CFLAGS_COMMON_ARCH='-march=armv6 -mtune=arm1176jz-s -mfloat-abi=hard ' 12 | -------------------------------------------------------------------------------- /arch/armv7hf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/armv7hf.sh: Build definitions for ARMv7 (hard float, w/ NEON). 3 | ##@copyright GPL-2.0+ 4 | 5 | # Retro: Overriding mainline definitions, and take more interest in reducing code size. 6 | CFLAGS_COMMON_OPTI='-Os -ffunction-sections -fdata-sections ' 7 | LDFLAGS_COMMON_OPTI='-Wl,--gc-sections ' 8 | # Retro: Keeping -ftree-vectorization for NEON. 9 | 10 | CFLAGS_COMMON_ARCH='-march=armv7-a -mtune=cortex-a7 -mfloat-abi=hard -mfpu=neon -mthumb ' 11 | -------------------------------------------------------------------------------- /arch/i386.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/i386.sh: Build definitions for i386 (the subsystem that runs on amd64 cpus) 3 | ##@copyright GPL-2.0+ 4 | [[ $ABBUILD != $ABHOST ]] || abdie "The i386 arch is cross-only, for multilib purposes." 5 | CFLAGS_COMMON_ARCH='-fomit-frame-pointer -march=pentium4 -mtune=core2 -msse -msse2 -msse3 ' 6 | HOSTTOOLPREFIX=/opt/32/bin/i686-pc-linux-gnu 7 | export PKG_CONFIG_DIR=/opt/32/lib/pkgconfig 8 | unset LDFLAGS_COMMON_CROSS_BASE 9 | -------------------------------------------------------------------------------- /arch/i486.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/i486.sh: Build definitions for i486. 3 | ##@copyright GPL-2.0+ 4 | 5 | # Retro: Overriding mainline definitions, and take more interest in reducing code size. 6 | CFLAGS_COMMON_OPTI='-Os -ffunction-sections -fdata-sections ' 7 | LDFLAGS_COMMON_OPTI='-Wl,--gc-sections ' 8 | # Retro: Also disabling -ftree-vectorization which could potentially enlarge code size. 9 | CFLAGS_GCC_OPTI='-fira-loop-pressure -fira-hoist-pressure ' 10 | 11 | CFLAGS_COMMON_ARCH='-march=i486 -mtune=bonnell ' 12 | 13 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=i486 -Clink-args=-latomic ' 14 | -------------------------------------------------------------------------------- /arch/loongarch64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/loongarch64.sh: Build definitions for Loongson 3A/B 5000. 3 | ##@copyright GPL-2.0+ 4 | 5 | CFLAGS_GCC_ARCH='-mabi=lp64d -march=loongarch64 -mtune=la464 -mlsx' 6 | 7 | # Position-independent executable buildmode is not available on the LoongArch 8 | # architecture. Removing for the loongarch64 (loong64) target. 9 | GOFLAGS=${GOFLAGS/-buildmode=pie/} 10 | 11 | # FIXME: +lsx feature is broken as of LLVM 17.0.6, awaiting full vector 12 | # implementation. 13 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=generic-la64 -Ctarget-feature=-lsx,+d -Clink-arg=-mabi=lp64d' 14 | -------------------------------------------------------------------------------- /arch/loongson2f.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/loongson2f.sh: Build definitions for Loongson 2F. 3 | ##@copyright GPL-2.0+ 4 | 5 | # Retro: Overriding mainline definitions, and take more interest in reducing code size. 6 | CFLAGS_COMMON_OPTI='-Os -ffunction-sections -fdata-sections ' 7 | LDFLAGS_COMMON_OPTI='-Wl,--gc-sections ' 8 | # Retro: Keeping -ftree-vectorization for MMI (effective?). 9 | 10 | CFLAGS_COMMON_ARCH='-mabi=64 -march=mips3 -mtune=loongson2f ' 11 | CFLAGS_GCC_ARCH='-mloongson-mmi -Wa,-mfix-loongson2f-nop ' 12 | 13 | CFLAGS_GCC_OPTI_LTO="${CFLAGS_COMMON_OPTI_LTO} -flto-partition=none " 14 | LDFLAGS_GCC_OPTI_LTO="${LDFLAGS_COMMON_OPTI_LTO} -mxgot -flto-partition=none " 15 | 16 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=mips3 -Ctarget-features=+xgot,-mips64r2 ' 17 | RUSTFLAGS_COMMON_OPTI_LTO="${RUSTFLAGS_COMMON_OPTI_LTO} -Clink-arg=-Wl,-z,notext " 18 | 19 | # Position-independent executable buildmode is not available on any mips architecture. 20 | # Removing for loongson2f target. 21 | GOFLAGS=${GOFLAGS/-buildmode=pie/} 22 | -------------------------------------------------------------------------------- /arch/loongson3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/loongson3.sh: Build definitions for Loongson 3A/B 1000-4000+. 3 | ##@copyright GPL-2.0+ 4 | CFLAGS_GCC_ARCH='-mabi=64 -march=gs464 -mtune=gs464e -mfix-loongson3-llsc -mxgot ' 5 | CFLAGS_CLANG_ARCH='-mabi=64 -march=mips64r2 -mtune=mips64r2 ' 6 | RUSTFLAGS_COMMON_ARCH='-Clink-arg=-Wl,-build-id=sha1 ' 7 | RUSTFLAGS_COMMON_OPTI_NOLTO='-Clink-arg=-fuse-ld=gold -Clink-arg=-Wl,-build-id=sha1 ' 8 | CFLAGS_GCC_OPTI_LTO="${CFLAGS_COMMON_OPTI_LTO} -flto-partition=none " 9 | LDFLAGS_GCC_OPTI_LTO="${LDFLAGS_COMMON_OPTI_LTO} -mxgot -flto-partition=none " 10 | 11 | # Position-independent executable buildmode is not available on any mips architecture. 12 | # Removing for loongson3 target. 13 | GOFLAGS=${GOFLAGS/-buildmode=pie/} 14 | -------------------------------------------------------------------------------- /arch/mips32r6el.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/mips32r6el.sh: Build definitions for mips32r6el. 3 | ##@copyright GPL-2.0+ 4 | CFLAGS_COMMON_ARCH='-march=mips32r6 -mtune=mips32r6 -mcompact-branches=always ' 5 | 6 | # FIXME: -Cdebuginfo=0 enables rustc to build programs on mips32r6el, 7 | # overriding all project configuration and build profile settings. 8 | # Generating debuginfo crashes LLVM (as of 15.0.7). 9 | # 10 | # FIXME: --cfg=rustix_use_libc works around an issue where a crate named 11 | # rustix contains MIPS32 R2 assembly, without being able to distinguish between 12 | # R2 and R6 assemblies. Enabling this options instructs rustix to use the libc 13 | # backend instead. 14 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=mips32r6 -Cdebuginfo=0 -Cllvm-args=--mips-compact-branches=always --cfg=rustix_use_libc ' 15 | -------------------------------------------------------------------------------- /arch/mips64r6el.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/mips64r6el.sh: Build definitions for mips64r6el. 3 | ##@copyright GPL-2.0+ 4 | CFLAGS_COMMON_ARCH='-march=mips64r6 -mtune=mips64r6 -mcompact-branches=always -mmsa ' 5 | 6 | # FIXME: -Cdebuginfo=0 enables rustc to build programs on mips64r6el, 7 | # overriding all project configuration and build profile settings. 8 | # Generating debuginfo crashes LLVM (as of 15.0.7). 9 | # 10 | # FIXME: --cfg=rustix_use_libc works around an issue where a crate named 11 | # rustix contains MIPS64 R2 assembly, without being able to distinguish between 12 | # R2 and R6 assemblies. Enabling this options instructs rustix to use the libc 13 | # backend instead. 14 | # 15 | # FIXME: As of Rust 1.71.1, enabling MSA results in broken sha2 checksum 16 | # calculation (breaks all Cargo operations). Disable this feature for now. 17 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=mips64r6 -Cdebuginfo=0 -Ctarget-feature=-msa -Cllvm-args=--mips-compact-branches=always --cfg=rustix_use_libc ' 18 | RUSTFLAGS_COMMON_OPTI_NOLTO='-Clink-arg=-fuse-ld=gold -Clink-arg=-Wl,-build-id=sha1 ' 19 | -------------------------------------------------------------------------------- /arch/powerpc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/powerpc.sh: Build definitions for PPC (PowerPC G3+) 3 | ##@copyright GPL-2.0+ 4 | 5 | # Retro: Overriding mainline definitions, and take more interest in reducing code size. 6 | CFLAGS_COMMON_OPTI='-Os -ffunction-sections -fdata-sections ' 7 | LDFLAGS_COMMON_OPTI='-Wl,--gc-sections ' 8 | # Retro: Also disabling -ftree-vectorization which could potentially enlarge code size. 9 | CFLAGS_GCC_OPTI='-fira-loop-pressure -fira-hoist-pressure ' 10 | 11 | CFLAGS_COMMON_ARCH=' -m32 -mcpu=603 -mtune=G4 -mno-altivec -msecure-plt -mhard-float ' 12 | 13 | # Position-independent executable buildmode is not available on PowerPC 32-bit architecture. 14 | # Removing for powerpc target. 15 | GOFLAGS=${GOFLAGS/-buildmode=pie/} 16 | 17 | RUSTFLAGS_COMMON_ARCH=' -Ctarget-cpu=603 -Ctarget-feature=+hard-float,+secure-plt,-altivec ' 18 | -------------------------------------------------------------------------------- /arch/ppc64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/ppc64.sh: Build definitions for PowerPC64 (PowerPC G5+) 3 | ##@copyright GPL-2.0+ 4 | 5 | # Retro: Overriding mainline definitions, and take more interest in reducing code size. 6 | CFLAGS_COMMON_OPTI='-Os -ffunction-sections -fdata-sections ' 7 | LDFLAGS_COMMON_OPTI='-Wl,--gc-sections ' 8 | # Retro: Keeping -ftree-vectorization for AltiVec. 9 | CFLAGS_COMMON_ARCH=' -m64 -mcpu=G5 -maltivec -mabi=altivec -msecure-plt -mhard-float ' 10 | 11 | CFLAGS_GCC_OPTI_LTO="${CFLAGS_COMMON_OPTI_LTO} -flto-partition=none " 12 | LDFLAGS_GCC_OPTI_LTO="${LDFLAGS_COMMON_OPTI_LTO} -flto-partition=none " 13 | 14 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=g5 -Ctarget-features=+altivec,+secure-plt,+hard-float,+64bit ' 15 | # LLD does not support POWER ABI v1. 16 | RUSTFLAGS_COMMON_OPTI_LTO='-Clink-arg=-fuse-ld=bfd -Clink-arg=-Wl,-build-id=sha1' 17 | 18 | # Position-independent executable buildmode is not available on PowerPC 64-bit 19 | # (Big Endian) architecture. Removing for ppc64 target. 20 | GOFLAGS=${GOFLAGS/-buildmode=pie/} 21 | -------------------------------------------------------------------------------- /arch/ppc64el.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/ppc64el.sh: Build definitions for ppc64el. 3 | ##@copyright GPL-2.0+ 4 | CFLAGS_GCC_ARCH='-mcpu=power8 -mtune=power9 -msecure-plt -mvsx -mabi=ieeelongdouble' 5 | CFLAGS_CLANG_ARCH='-mcpu=power8 -mtune=power9 -msecure-plt -mvsx -mabi=ieeelongdouble' 6 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=pwr8 -Ctarget-feature=+vsx,+altivec,+secure-plt -Clink-arg=-mabi=ieeelongdouble' 7 | -------------------------------------------------------------------------------- /arch/riscv64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/riscv64.sh: Build definitions for riscv64. 3 | ##@copyright GPL-2.0+ 4 | LDFLAGS_COMMON_CROSS='-Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/var/ab/cross-root/riscv64/usr/lib -L/var/ab/cross-root/riscv64/usr/lib ' 5 | RUSTFLAGS_COMMON_ARCH="-Clink-arg=-mabi=lp64d" 6 | RUSTFLAGS_COMMON_ARCH_LTO="${RUSTFLAGS_COMMON_ARCH} -Clink-arg=-Wl,-mllvm=-mattr=+d" 7 | -------------------------------------------------------------------------------- /arch/sparc64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch/sparc64.sh: Build definitions for i486. 3 | ##@copyright GPL-2.0+ 4 | 5 | # Retro: Overriding mainline definitions, and take more interest in reducing code size. 6 | CFLAGS_COMMON_OPTI='-Os -ffunction-sections -fdata-sections ' 7 | LDFLAGS_COMMON_OPTI='-Wl,--gc-sections ' 8 | # Retro: Also disabling -ftree-vectorization which could potentially enlarge code size. 9 | CFLAGS_GCC_OPTI='-fira-loop-pressure -fira-hoist-pressure ' 10 | 11 | CFLAGS_COMMON_ARCH='-march=v9 -mv8plus -mvis -m64 -mcmodel=medany ' 12 | 13 | RUSTFLAGS_COMMON_ARCH='-Ctarget-cpu=v9 -Ctarget-feature=+vis -Ccode-model=medium' 14 | -------------------------------------------------------------------------------- /build/00-self.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # build/00-self.sh: Invokes `build` defs. 3 | ##@copyright GPL-2.0+ 4 | abtrylib arch || ablibret 5 | 6 | build_self_probe(){ 7 | [ -f "$(arch_trymore=1 arch_findfile build)" ] 8 | } 9 | 10 | build_self_build(){ 11 | BUILD_START 12 | if ! bool $ABSTAGE2; then 13 | arch_loadfile_strict build || \ 14 | abdie "Failed to run self-defined build script: $?." 15 | else 16 | if arch_findfile build.stage2; then 17 | abwarn "ABSTAGE2 returned true, loading stage2 build script ..." 18 | arch_loadfile_strict build.stage2 || \ 19 | abdie "Failed to run self-defined stage2 build script: $?." 20 | else 21 | abwarn "ABSTAGE2 returned true, loading stage2 build script ..." 22 | abwarn "Could not find self-defined stage2 build script, falling back to normal build script ..." 23 | arch_loadfile_strict build || \ 24 | abdie "Failed to run self-defined build script: $?." 25 | fi 26 | fi 27 | 28 | cd "$SRCDIR" 29 | } 30 | 31 | ABBUILDS='self' 32 | # Soga... 33 | -------------------------------------------------------------------------------- /build/10-autotools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 10-autotools.sh: Builds GNU autotools stuff 3 | ##@copyright GPL-2.0+ 4 | abtryexe autoconf automake autoreconf 5 | 6 | export FORCE_UNSAFE_CONFIGURE=1 7 | 8 | build_autotools_probe(){ 9 | [ -x "${configure=$SRCDIR/configure}" ] || \ 10 | [ -x "$SRCDIR"/autogen.sh ] || \ 11 | [ -x "$SRCDIR"/bootstrap ] || \ 12 | [ -f "$SRCDIR"/configure.ac ] 13 | } 14 | 15 | build_autotools_build() { 16 | export ABSHADOW 17 | 18 | if bool "$ABCONFIGHACK" 19 | then 20 | for i in $(find "$SRCDIR" -name config.guess -o -name config.sub); do \ 21 | abinfo "Copying replacement $i ..." 22 | # Adapted from redhat-rpm-config. 23 | # https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/rawhide/f/macros#_192 24 | # Note: config.guess and config.sub provided by the 'config' package. 25 | cp -v "/usr/bin/$(basename "$i")" "$i" \ 26 | || abdie "Failed to copy replacement $i: $?."; \ 27 | done 28 | fi 29 | 30 | if bool "$RECONF" 31 | then 32 | abinfo "Re-generating Autotools scripts ..." 33 | [ -x "$SRCDIR"/bootstrap ] && ! [ -e "$SRCDIR"/autogen.sh ] \ 34 | && ln -sv "$SRCDIR"/bootstrap "$SRCDIR"/autogen.sh 35 | if [[ -x "$SRCDIR"/bootstrap && ! -d "$SRCDIR"/bootstrap ]]; then 36 | "$SRCDIR/bootstrap" \ 37 | || abdie "Reconfiguration failed: $?." 38 | elif [[ -x "$SRCDIR"/autogen.sh && ! -d "$SRCDIR"/autogen.sh ]]; then 39 | NOCONFIGURE=1 "$SRCDIR/autogen.sh" \ 40 | || abdie "Reconfiguration failed: $?." 41 | elif [ -e "$SRCDIR"/configure.ac ] || [ -e "$SRCDIR"/configure.in ]; then 42 | autoreconf -fvis 2>&1 || abdie "Reconfiguration failed: $?." 43 | else 44 | abdie 'Necessary files not found for script regeneration - non-standard Autotools source?' 45 | fi 46 | fi 47 | 48 | if bool "$ABSHADOW" 49 | then 50 | abinfo "Creating directory for shadow build ..." 51 | mkdir -pv "$BLDDIR" \ 52 | || abdie "Failed to create shadow build directory: $?." 53 | cd "$BLDDIR" \ 54 | || abdie "Failed to enter shadow build directory: $?." 55 | fi 56 | 57 | if [[ "$ABHOST" != "$ABBUILD" ]] 58 | then 59 | AUTOTOOLS_TARGET="--host=$HOST" 60 | else 61 | AUTOTOOLS_TARGET="--build=${ARCH_TARGET[$ARCH]}" 62 | fi 63 | 64 | BUILD_START 65 | abinfo "Running configure ..." 66 | local AUTOTOOLS_OPTION_CHECKING 67 | if bool "$AUTOTOOLS_STRICT"; then 68 | AUTOTOOLS_OPTION_CHECKING="--enable-option-checking=fatal" 69 | fi 70 | if abisarray AUTOTOOLS_AFTER; then 71 | ${configure:="$SRCDIR"/configure} \ 72 | $AUTOTOOLS_TARGET $AUTOTOOLS_DEF "${AUTOTOOLS_AFTER[@]}" \ 73 | $AUTOTOOLS_OPTION_CHECKING \ 74 | || abdie "Failed to run configure: $?." 75 | else 76 | ${configure:="$SRCDIR"/configure} \ 77 | $AUTOTOOLS_TARGET $AUTOTOOLS_DEF $AUTOTOOLS_AFTER \ 78 | $AUTOTOOLS_OPTION_CHECKING \ 79 | || abdie "Failed to run configure: $?." 80 | fi 81 | 82 | BUILD_READY 83 | abinfo "Building binaries ..." 84 | make V=1 VERBOSE=1 \ 85 | $ABMK $MAKE_AFTER \ 86 | || abdie "Failed to build binaries: $?." 87 | 88 | BUILD_FINAL 89 | abinfo "Installing binaries ..." 90 | make install V=1 VERBOSE=1 \ 91 | BUILDROOT="$PKGDIR" DESTDIR="$PKGDIR" $MAKE_AFTER \ 92 | || abdie "Failed to install binaries: $?." 93 | 94 | if bool "$ABSHADOW" 95 | then 96 | cd "$SRCDIR" \ 97 | || abdie "Unable to return to source directory: $?." 98 | fi 99 | } 100 | 101 | ABBUILDS+=' autotools' 102 | -------------------------------------------------------------------------------- /build/11-cmakeninja.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 13-cmakeninja.sh: Builds cmake with Ninja 3 | ##@copyright GPL-2.0+ 4 | (abtryexe cmake && abtryexe ninja) || ablibret 5 | 6 | build_cmakeninja_probe(){ 7 | [ -f "$SRCDIR"/CMakeLists.txt ] 8 | } 9 | 10 | build_cmakeninja_build(){ 11 | ABSHADOW=${ABSHADOW_CMAKE-$ABSHADOW} 12 | if bool "$ABSHADOW" 13 | then 14 | abinfo "Creating directory for shadow build ..." 15 | mkdir -pv "$BLDDIR" \ 16 | || abdie "Failed to create shadow build directory: $?." 17 | cd "$BLDDIR" \ 18 | || abdie "Failed to enter shadow build directory: $?." 19 | fi 20 | BUILD_START 21 | 22 | abinfo "Running CMakeLists.txt to generate Ninja Configuration ..." 23 | if abisarray CMAKE_AFTER; then 24 | cmake "$SRCDIR" $CMAKE_DEF "${CMAKE_AFTER[@]}" -GNinja \ 25 | || abdie "Failed to run CMakeLists.txt: $?." 26 | else 27 | cmake "$SRCDIR" $CMAKE_DEF $CMAKE_AFTER -GNinja \ 28 | || abdie "Failed to run CMakeLists.txt: $?." 29 | fi 30 | BUILD_READY 31 | 32 | if bool "$ABUSECMAKEBUILD"; then 33 | abinfo "Building binaries ..." 34 | cmake --build . \ 35 | || abdie "Failed to build binaries: $?." 36 | BUILD_FINAL 37 | abinfo "Installing binaries ..." 38 | DESTDIR="$PKGDIR" cmake --install . \ 39 | || abdie "Failed to install binaries: $?." 40 | else 41 | abinfo "Building and installing binaries ..." 42 | DESTDIR="$PKGDIR" \ 43 | ninja $ABMK $MAKE_AFTER install \ 44 | || abdie "Failed to build and install binaries: $?." 45 | fi 46 | 47 | if bool "$ABSHADOW"; then 48 | cd "$SRCDIR" \ 49 | || abdie "Failed to return to source directory: $?." 50 | fi 51 | } 52 | 53 | ABBUILDS+=' cmakeninja' 54 | -------------------------------------------------------------------------------- /build/12-cmake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 12-cmake.sh: Builds cmake stuff 3 | ##@copyright GPL-2.0+ 4 | abtryexe cmake || ablibret 5 | 6 | build_cmake_probe(){ 7 | [ -f "$SRCDIR"/CMakeLists.txt ] 8 | } 9 | 10 | build_cmake_build(){ 11 | ABSHADOW=${ABSHADOW_CMAKE-$ABSHADOW} 12 | if bool "$ABSHADOW"; then 13 | abinfo "Creating directory for shadow build ..." 14 | mkdir -pv "$BLDDIR" \ 15 | || abdie "Failed to create shadow build directory: $?." 16 | cd "$BLDDIR" \ 17 | || abdie "Failed to enter shadow build directory: $?." 18 | fi 19 | BUILD_START 20 | 21 | abinfo "Running CMakeLists.txt to generate Makefile ..." 22 | if abisarray CMAKE_AFTER; then 23 | cmake "$SRCDIR" $CMAKE_DEF "${CMAKE_AFTER[@]}" \ 24 | || abdie "Failed to run CMakeLists.txt: $?." 25 | else 26 | cmake "$SRCDIR" $CMAKE_DEF $CMAKE_AFTER \ 27 | || abdie "Failed to run CMakeLists.txt: $?." 28 | fi 29 | BUILD_READY 30 | 31 | if bool "$ABUSECMAKEBUILD"; then 32 | abinfo "Building binaries ..." 33 | cmake --build . -- $ABMK $MAKE_AFTER \ 34 | || abdie "Failed to build binaries: $?." 35 | BUILD_FINAL 36 | abinfo "Installing binaries ..." 37 | DESTDIR="$PKGDIR" cmake --install . \ 38 | || abdie "Failed to install binaries: $?." 39 | else 40 | abinfo "Building binaries ..." 41 | make $ABMK $MAKE_AFTER \ 42 | || abdie "Failed to build binaries: $?." 43 | abinfo "Installing binaries ..." 44 | make install \ 45 | DESTDIR="$PKGDIR" $ABMK $MAKE_AFTER \ 46 | || abdie "Failed to install binaries: $?." 47 | fi 48 | 49 | if bool "$ABSHADOW"; then 50 | cd "$SRCDIR" \ 51 | || abdie "Failed to return to source directory: $?." 52 | fi 53 | } 54 | 55 | ABBUILDS+=' cmake' 56 | -------------------------------------------------------------------------------- /build/12-meson.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 12-meson.sh: Builds Meson sources 3 | ##@copyright GPL-2.0+ 4 | abtryexe meson 5 | 6 | build_meson_probe(){ 7 | [ -e "$SRCDIR"/meson.build ] 8 | } 9 | 10 | build_meson_build() { 11 | mkdir "$BLDDIR" \ 12 | || abdie "Failed to create build directory: $?." 13 | abinfo "Running Meson ..." 14 | if abisarray MESON_AFTER; then 15 | meson setup ${MESON_DEF} "${MESON_AFTER[@]}" \ 16 | "$SRCDIR" "$BLDDIR" \ 17 | || abdie "Failed to run Meson ..." 18 | else 19 | meson setup ${MESON_DEF} ${MESON_AFTER} \ 20 | "$SRCDIR" "$BLDDIR" \ 21 | || abdie "Failed to run Meson ..." 22 | fi 23 | cd "$BLDDIR" \ 24 | || abdie "Failed to enter build directory: $?." 25 | abinfo "Building binaries ..." 26 | ninja \ 27 | || abdie "Failed to run build binaries: $?." 28 | abinfo "Installing binaries ..." 29 | DESTDIR="$PKGDIR" ninja install \ 30 | || abdie "Failed to install binaries: $?." 31 | cd "$SRCDIR" \ 32 | || abdie "Failed to return to source directory: $?." 33 | } 34 | 35 | ABBUILDS+=' meson' 36 | -------------------------------------------------------------------------------- /build/12-waf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##12-waf.sh: Builds WAF stuff 3 | ##@copyright GPL-2.0+ 4 | abtryexe python2 || ablibret 5 | 6 | build_waf_probe(){ 7 | [ -f "$SRCDIR"/waf ] 8 | } 9 | 10 | build_waf_build(){ 11 | BUILD_START 12 | abinfo "Running Waf script(s) ..." 13 | python2 waf configure ${WAF_DEF} ${WAF_AFTER} \ 14 | || abdie "Failed to run Waf script(s): $?." 15 | BUILD_READY 16 | abinfo "Building binaries ..." 17 | python2 waf build ${ABMK} ${MAKE_AFTER} ${MAKEFLAGS} \ 18 | || abdie "Failed to build binaries: $?." 19 | BUILD_FINAL 20 | abinfo "Installing binaries ..." 21 | python2 waf install --destdir=${PKGDIR} \ 22 | || abdie "Failed to install binaries: $?." 23 | } 24 | 25 | ABBUILDS+=' waf' 26 | -------------------------------------------------------------------------------- /build/15-dune.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##15-dune.sh: Builds OCaml projects using Dune 3 | ##@copyright GPL-2.0+ 4 | abtryexe dune || ablibret 5 | 6 | build_dune_probe(){ 7 | [ -f "$SRCDIR"/dune-project ] 8 | } 9 | 10 | build_dune_build(){ 11 | BUILD_START 12 | if ! ab_match_archgroup ocaml_native; then 13 | abinfo "OCaml has no native code generation for $ABHOST. Disabling ABSPLITDBG and ABSTRIP ..." 14 | export ABSPLITDBG=0 ABSTRIP=0 15 | fi 16 | 17 | BUILD_READY 18 | abinfo "Building Dune project $PKGNAME ..." 19 | if [[ -n $DUNE_PACKAGES ]]; then 20 | abinfo "Setting dune build target packages to: $DUNE_PACKAGES" 21 | _DUNE_BUILD_PACKAGES="-p ${DUNE_PACKAGES// /,}" 22 | fi 23 | dune build \ 24 | $_DUNE_BUILD_PACKAGES \ 25 | $DUNE_BUILD_AFTER \ 26 | || abdie "Failed to build Dune project $PKGNAME: $?." 27 | abinfo "Installing Dune project $PKGNAME ..." 28 | mkdir -pv "$PKGDIR"/"$(ocamlfind printconf destdir)" 29 | 30 | BUILD_FINAL 31 | if [[ -n $DUNE_PACKAGES ]]; then 32 | # Install all components one by one 33 | for _pkg in $DUNE_PACKAGES; do 34 | abinfo "Installing component $_pkg ..." 35 | dune install "$_pkg" \ 36 | --prefix "$PKGDIR"/usr \ 37 | --libdir "$PKGDIR"/"$(ocamlfind printconf destdir)" \ 38 | $DUNE_INSTALL_AFTER \ 39 | || abdie "Failed to install Dune project $PKGNAME component $_pkg: $?." 40 | done 41 | else 42 | dune install \ 43 | --prefix "$PKGDIR"/usr \ 44 | --libdir "$PKGDIR"/"$(ocamlfind printconf destdir)" \ 45 | $DUNE_INSTALL_AFTER \ 46 | || abdie "Failed to install Dune project $PKGNAME: $?." 47 | fi 48 | abinfo "Correcting directories ..." 49 | if [ -d "$PKGDIR"/usr/doc ]; then 50 | mkdir -pv "$PKGDIR"/usr/share 51 | mv -v "$PKGDIR"/usr/{,share/}doc 52 | fi 53 | if [ -d "$PKGDIR"/usr/man ]; then 54 | mkdir -pv "$PKGDIR"/usr/share 55 | mv -v "$PKGDIR"/usr/{,share/}man 56 | fi 57 | } 58 | 59 | ABBUILDS+=' dune' 60 | -------------------------------------------------------------------------------- /build/15-gomod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##15-gomod.sh: Builds Go projects using Go Modules and Go 1.11+ 3 | ##@copyright GPL-2.0+ 4 | abtryexe go || ablibret 5 | 6 | build_gomod_probe(){ 7 | [ -f "$SRCDIR"/go.mod ] \ 8 | && [ -f "$SRCDIR"/go.sum ] # go.sum is required for security reasons 9 | } 10 | 11 | build_gomod_build(){ 12 | BUILD_START 13 | export GO111MODULE=on 14 | abinfo 'Note, this build type only works with Go 1.11+ modules' 15 | [ -f Makefile ] && abwarn "This project might be using other build tools than Go itself." 16 | if ! bool "$ABSHADOW"; then 17 | abdie "ABSHADOW must be set to true for this build type: $?." 18 | fi 19 | 20 | mkdir "$BLDDIR" \ 21 | || abdie "Failed to create $SRCDIR/abbuild: $?." 22 | cd "$BLDDIR" \ 23 | || abdie "Failed to cd $SRCDIR/abbuild: $?." 24 | 25 | abinfo "Fetching Go modules dependencies ..." 26 | GOPATH="$SRCDIR/abgopath" go get .. \ 27 | || abdie "Failed to fetch Go module dependencies: $?." 28 | BUILD_READY 29 | mkdir -pv "$PKGDIR/usr/bin/" 30 | abinfo "Compiling Go module ..." 31 | GOPATH="$SRCDIR/abgopath" \ 32 | go build ${GO_BUILD_AFTER} .. \ 33 | || abdie "Failed to build Go module: $?." 34 | abinfo "Copying executable file(s) ..." 35 | find "$SRCDIR" -type f -executable \ 36 | -exec cp -av '{}' "$PKGDIR/usr/bin/" ';' \ 37 | || abdie "Failed to copy executable file(s): $?." 38 | BUILD_FINAL 39 | cd "$SRCDIR" \ 40 | || abdie "Failed to return to source directory: $?." 41 | } 42 | 43 | ABBUILDS+=' gomod' 44 | -------------------------------------------------------------------------------- /build/15-perl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##15-perl.sh: Builds Makefile.PL stuff 3 | ##@copyright GPL-2.0+ 4 | abtryexe perl || ablibret 5 | 6 | build_perl_probe(){ 7 | [ -f "$SRCDIR"/Makefile.PL ] || \ 8 | [ -h "$SRCDIR"/Makefile.PL ] 9 | } 10 | 11 | build_perl_build(){ 12 | BUILD_START 13 | abinfo "Generating Makefile from Makefile.PL ..." 14 | PERL_MM_USE_DEFAULT=1 \ 15 | perl -I"$SRCDIR" Makefile.PL INSTALLDIRS=vendor \ 16 | || abdie "Makefile generation failed: $?." 17 | BUILD_READY 18 | abinfo "Building Perl package ..." 19 | make \ 20 | V=1 VERBOSE=1 $MAKE_AFTER \ 21 | || abdie "Failed to build Perl package: $?." 22 | BUILD_FINAL 23 | abinfo "Installing Perl package ..." 24 | make \ 25 | V=1 VERBOSE=1 DESTDIR="$PKGDIR" install \ 26 | || abdie "Failed to install Perl package: $?." 27 | } 28 | 29 | ABBUILDS+=' perl' 30 | -------------------------------------------------------------------------------- /build/15-python.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##15-python.sh: Builds Python stuff 3 | ##@copyright GPL-2.0+ 4 | abtryexe python || ablibret 5 | abtryexe python2 python3 || ((!ABSTRICT)) || ablibret 6 | 7 | build_python_probe(){ 8 | [ -f "$SRCDIR"/setup.py ] 9 | } 10 | 11 | build_python_build(){ 12 | BUILD_START 13 | for PYTHON in "$(bool $NOPYTHON2 || command -v python2 || command -v python || echo)" \ 14 | "$(bool $NOPYTHON3 || command -v python3 || echo)"; do 15 | [ "$PYTHON" ] || continue 16 | BUILD_READY 17 | abinfo "Building Python (PyPI) package using $PYTHON ..." 18 | "$PYTHON" "$SRCDIR"/setup.py build \ 19 | || abdie "Failed to build Python (PyPI) package using ${PYTHON}: $?." 20 | BUILD_FINAL 21 | abinfo "Installing Python (PyPI) package using $PYTHON ..." 22 | "$PYTHON" "$SRCDIR"/setup.py install \ 23 | --prefix=/usr --root="$PKGDIR" --optimize=1 \ 24 | || abdie "Failed to install Python (PyPI) package using ${PYTHON}: $?." 25 | abinfo "Cleaning Python (PyPI) package source tree ..." 26 | bool $NOPYTHONCLEAN \ 27 | || ( "$PYTHON" "$SRCDIR"/setup.py clean \ 28 | || abdie "Failed to clean up Python (PyPI) package source tree: $?." ) \ 29 | || true 30 | done 31 | } 32 | ABBUILDS+=' python' 33 | -------------------------------------------------------------------------------- /build/15-rust.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##15-rust.sh: Builds Rust + Cargo projects 3 | ##@copyright GPL-2.0+ 4 | 5 | abtryexe rustc cargo || ((!ABSTRICT)) || ablibret 6 | 7 | DEFAULT_CARGO_CONFIG=( 8 | --config 'profile.release.lto = true' 9 | --config 'profile.release.incremental = false' 10 | --config 'profile.release.codegen-units = 1' 11 | ) 12 | 13 | build_rust_prepare_registry() { 14 | local REGISTRY_URL='https://github.com/rust-lang/crates.io-index' 15 | local REGISTRY_DIR='github.com-1ecc6299db9ec823' 16 | local THIS_REGISTRY_DIR="$HOME/.cargo/registry/index/${REGISTRY_DIR}/.git" 17 | 18 | if [ ! -d "${THIS_REGISTRY_DIR}" ]; then 19 | git clone --bare "${REGISTRY_URL}" "${THIS_REGISTRY_DIR}" 20 | fi 21 | } 22 | 23 | build_rust_get_installed_rust_version() { 24 | rustc --version | perl -ne '/^rustc\s+(\d+\.\d+\.\d+)\s+\(/ && print"$1\n"' 25 | } 26 | 27 | build_rust_probe(){ 28 | [ -f "$SRCDIR"/Cargo.toml ] 29 | } 30 | 31 | build_rust_inject_lto() { 32 | bool "${USECLANG}" \ 33 | || abdie 'Please set "USECLANG=1" in your defines to enable proper LTO.' 34 | command -v ld.lld > /dev/null \ 35 | || abdie 'ld.lld is unavailable. Please add "llvm" to your $BUILDDEP or disable LTO for this architecture.' 36 | } 37 | 38 | build_rust_audit() { 39 | abinfo 'Setting up build environment: $PKG_CONFIG_SYSROOT_DIR= hack ...' 40 | export PKG_CONFIG_SYSROOT_DIR=/ 41 | abinfo 'Auditing dependencies...' 42 | if ! command -v cargo-audit > /dev/null; then 43 | abdie "cargo-audit not found: $?." 44 | elif [ -f "$SRCDIR"/Cargo.lock ]; then 45 | if ! cargo audit; then 46 | abinfo 'Vulnerabilities detected! Attempting automatic fix ...' 47 | cargo audit fix \ 48 | || abdie 'Unable to fix vulnerability! Refusing to continue.' 49 | fi 50 | else 51 | abdie 'No lock file found -- Dependency information unreliable. Unable to conduct audit.' 52 | fi 53 | } 54 | 55 | fallback_build() { 56 | cargo build "${DEFAULT_CARGO_CONFIG[@]}" --release --locked $CARGO_AFTER || abdie "Compilation failed: $?." 57 | if [ -e "$SRCDIR"/target/release/*.so* ]; then 58 | abinfo "Installing lib in the workspace ..." 59 | install -Dvm755 "$SRCDIR"/target/release/*.so* \ 60 | -t "$PKGDIR"/usr/lib/ 61 | fi 62 | abinfo "Installing binaries in the workspace ..." 63 | find "$SRCDIR"/target/release -maxdepth 1 -executable -type f ! -name "*.so" -exec 'install' '-Dvm755' '{}' "$PKGDIR/usr/bin/" ';' 64 | } 65 | 66 | 67 | build_rust_build(){ 68 | BUILD_START 69 | [ -f "$SRCDIR"/Cargo.lock ] \ 70 | || abwarn "This project is lacking the lock file. Please report this issue to the upstream." 71 | if ! dpkg --compare-versions "$(build_rust_get_installed_rust_version)" ge '1.70.0'; then 72 | build_rust_prepare_registry 73 | fi 74 | if [[ "${CROSS:-$ARCH}" != "ppc64" ]] && \ 75 | ! bool "$NOLTO"; then 76 | build_rust_inject_lto 77 | fi 78 | 79 | # FIXME: cargo-audit >= 0.18 uses rustls, which breaks non-amd64/arm64 architectures. 80 | if [[ "${CROSS:-$ARCH}" = "amd64" || "${CROSS:-$ARCH}" = "arm64" ]] && \ 81 | ! bool "$NOCARGOAUDIT"; then 82 | build_rust_audit 83 | fi 84 | 85 | BUILD_READY 86 | abinfo 'Building Cargo package ...' 87 | install -vd "$PKGDIR/usr/bin/" 88 | if ! grep '\[workspace\]' Cargo.toml > /dev/null; then 89 | cargo install --locked -f --path "$SRCDIR" \ 90 | --config "profile.release.lto = true" \ 91 | --root="$PKGDIR/usr/" $CARGO_AFTER \ 92 | || abdie "Compilation failed: $?." 93 | else 94 | abinfo 'Using fallback build method ...' 95 | fallback_build 96 | fi 97 | abinfo 'Dropping lingering files ...' 98 | rm -v "$PKGDIR"/usr/.crates{.toml,2.json} 99 | BUILD_FINAL 100 | } 101 | 102 | ABBUILDS+=' rust' 103 | -------------------------------------------------------------------------------- /build/16-pep517.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##15-python.sh: Builds Python PEP517 stuff 3 | ##@copyright GPL-2.0+ 4 | 5 | # PEP517 is only supported in Python 3 6 | abtryexe python3 || pip3 || ((!ABSTRICT)) || ablibret 7 | 8 | build_pep517_probe(){ 9 | [ -f "$SRCDIR"/pyproject.toml ] 10 | } 11 | 12 | build_pep517_build(){ 13 | BUILD_START 14 | if bool "$NOPYTHON3"; then 15 | abdie "PEP517 is only supported in Python 3. Specifying NOPYTHON3 is contradictory!" 16 | fi 17 | if ! bool "$NOPYTHON2"; then 18 | abwarn "PEP517 is only supported in Python 3. Please specify NOPYTHON2=1 to suppress this warning." 19 | fi 20 | BUILD_READY 21 | abinfo "Building Python (PEP517) package ..." 22 | python3 \ 23 | -m build \ 24 | --no-isolation \ 25 | --wheel \ 26 | || abdie "Failed to build Python (PEP517) package: $?." 27 | 28 | abinfo "Installing Python (PEP517) package ..." 29 | python3 \ 30 | -m installer \ 31 | --destdir="$PKGDIR" \ 32 | "$SRCDIR"/dist/*.whl 33 | BUILD_FINAL 34 | } 35 | ABBUILDS+=' pep517' 36 | -------------------------------------------------------------------------------- /build/20-qtproj.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##20-qtproj.sh: Builds qmake stuff 3 | ##@copyright GPL-2.0+ 4 | abtryexe qmake || ablibret 5 | export QT_SELECT 6 | 7 | build_qtproj_probe(){ 8 | local _pros _pro 9 | _pros=("$SRCDIR"/*.pro) 10 | ((${#_pros[@]})) || return 1 11 | for _pro in "${_pros[@]}"; do 12 | [ -f "$_pro" ] && break 13 | done || return "$?" 14 | 15 | [ "$QT_SELECT" ] || 16 | if bool $USEQT5; then 17 | abwarn "\$USEQT5 is now deprecated. Use QT_SELECT=5." 18 | QT_SELECT=5 19 | elif bool $USEQT4; then 20 | abwarn "\$USEQT4 is now deprecated. Use QT_SELECT=4." 21 | QT_SELECT=4 22 | else 23 | abicu "Qt version unspecified => default." 24 | QT_SELECT=default 25 | fi 26 | } 27 | 28 | build_qtproj_build(){ 29 | BUILD_START 30 | abinfo "Running qmake to generate Makefile ..." 31 | "$QTPREFIX/bin/qmake" $QTPROJ_DEF $QTPROJ_AFTER \ 32 | || abdie "Failed while running qmake to generate Makefile: $?." 33 | BUILD_READY 34 | abinfo "Building binaries ..." 35 | make V=1 VERBOSE=1 $ABMK $MAKE_AFTER \ 36 | || abdie "Failed to build binaries: $?." 37 | BUILD_FINAL 38 | abinfo "Installing binaries ..." 39 | make V=1 VERBOSE=1 INSTALL_ROOT=$PKGDIR install \ 40 | || abdie "Failed to install binaries: $?." 41 | } 42 | 43 | ABBUILDS+=' qtproj' 44 | -------------------------------------------------------------------------------- /build/20-ruby.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##20-ruby.sh: Builds Ruby GEMs 3 | ##@copyright GPL-2.0+ 4 | abtryexe ruby gem || ((!ABSTRICT)) || ablibret 5 | 6 | build_ruby_probe(){ 7 | [ -f "$SRCDIR"/*.gem ] 8 | } 9 | 10 | build_ruby_build(){ 11 | GEMDIR="$(ruby -e'puts Gem.default_dir')" 12 | abinfo "Building and installing Ruby (Gem) package ..." 13 | gem install --ignore-dependencies --no-user-install \ 14 | -i "$PKGDIR/$GEMDIR" -n "$PKGDIR/usr/bin" "$PKGNAME-$PKGVER.gem" \ 15 | || abdie "Failed to build and install Ruby (Gem) package: $?." 16 | abinfo 'Removing Gem cache from $PKGDIR ...' 17 | rm -v "$PKGDIR/$GEMDIR/cache/"* \ 18 | || abdie "Failed to remove Gem cache from PKGDIR: $?." 19 | } 20 | 21 | build_ruby_probe(){ false; } 22 | 23 | ABBUILDS+=' ruby' 24 | -------------------------------------------------------------------------------- /build/25-npm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##25-npm.sh: Builds NPM registry archives 3 | ##@copyright GPL-2.0+ 4 | abtryexe node npm || ((!ABSTRICT)) || ablibret 5 | 6 | build_npm_probe(){ 7 | [ -f "$SRCDIR"/package.json ] 8 | } 9 | 10 | build_npm_audit(){ 11 | if [ -f "$SRCDIR"/yarn.lock ]; then 12 | yarn audit \ 13 | || abdie 'Vulnerabilities detected! Aborting...' 14 | elif [ -f "$SRCDIR"/packages-lock.json ]; then 15 | npm audit \ 16 | || abdie 'Vulnerabilities detected! Aborting...' 17 | else 18 | abdie "The project does not contain any lock files. Unable to conduct the audit: $?." 19 | fi 20 | } 21 | 22 | build_npm_build(){ 23 | bool "$NONPMAUDIT" \ 24 | || build_npm_audit 25 | abinfo "Creating a symlink to make NPM happy ..." 26 | ln -sv "$SRCDIR/../$PKGNAME-$PKGVER."* "$PKGNAME-$PKGVER.tgz" \ 27 | || abdie "Failed to make NPM happy: $?." 28 | abinfo "Installing NPM package ..." 29 | npm install --production -g --user root \ 30 | --prefix "$PKGDIR"/usr "$PKGNAME-$PKGVER.tgz" \ 31 | || abdie "Could not install from NPM archives: $?." 32 | } 33 | 34 | ABBUILDS+=' npm' 35 | -------------------------------------------------------------------------------- /build/29-plainmake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##29-plainmake.sh: Build those pkgs that comes with a Makefile 3 | ##@copyright GPL-2.0+ 4 | build_plainmake_probe(){ 5 | if ! BUILD_PLAINMAKE_CONFIG="$(arch_findfile make_dotconfig)"; then 6 | unset BUILD_PLAINMAKE_CONFIG 7 | [ -e "$SRCDIR"/Makefile -o -e "$SRCDIR"/makefile ] 8 | fi 9 | } 10 | 11 | build_plainmake_build(){ 12 | BUILD_START 13 | if [ -e "$BUILD_PLAINMAKE_DOTCONFIG" ]; then 14 | abinfo 'Copying .config file as defined in $BUILD_PLAINMAKE_DOTCONFIG ...' 15 | cp -v "$BUILD_PLAINMAKE_DOTCONFIG" "$SRCDIR/.config" \ 16 | || abdie "Failed to copy .config file: $?." 17 | fi 18 | BUILD_READY 19 | abinfo "Building binaries using Makefile ..." 20 | make V=1 VERBOSE=1 $ABMK $MAKE_AFTER \ 21 | || abdie "Failed to build binaries: $?." 22 | BUILD_FINAL 23 | abinfo "Installing binaries ..." 24 | make install \ 25 | V=1 VERBOSE=1 \ 26 | BUILDROOT="$PKGDIR" DESTDIR="$PKGDIR" \ 27 | $MAKE_INSTALL_DEF $MAKE_AFTER \ 28 | || abdie "Failed to install binaries: $?." 29 | } 30 | 31 | ABBUILDS+=' plainmake' 32 | -------------------------------------------------------------------------------- /build/30-dummy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##30-dummy.sh: Builds dummy/meta/transitional packages 3 | ##@copyright GPL-2.0+ 4 | 5 | build_dummy_probe(){ 6 | true 7 | } 8 | 9 | build_dummy_build(){ 10 | abinfo "Creating a dummy package ..." 11 | mkdir -pv "$PKGDIR" \ 12 | || abdie "Failed to create a dummy package: $?." 13 | } 14 | 15 | ABBUILDS+=' dummy' 16 | -------------------------------------------------------------------------------- /contrib/autobuild-2to3: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # autobuild-2to3: Convert autobuild2 to autobuild3 files 3 | ##@copyright GPL-2.0+ 4 | # SYNOPSIS: 5 | #+autobuild verconv 6 | . $AB/ab3.sh plugin 7 | 8 | # Test the versions 9 | brave=0 # Ignorance is strength! 10 | deaf=0 11 | ab2file(){ 12 | if [ -e autobuild/overrides ]; then 13 | abinfo "autobuild/overrides found — you are facing an archive that is partly version 3." 14 | if [ -e autobuild/override ]; then 15 | abwarn 'autobuild/override not found — ab3-specific hack or something else?' 16 | ((deaf)) || return 2 17 | fi 18 | ((brave)) || return 1 19 | fi 20 | for i in postinst prerm postrm preinst; do 21 | if [ -e "$i" ]; then 22 | abinfo "Partly ab3 — found $i" 23 | if ! [ -e autobuild/override/DEBIAN/$i ]; then 24 | 25 | fi 26 | fi 27 | done 28 | return 0 29 | } 30 | -------------------------------------------------------------------------------- /contrib/autobuild-aoscarchive: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # aoscarchive: default autobuild settings for os3-repo archiving 3 | ##@copyright GPL-2.0+ 4 | # THIS SCRIPT IS INTENDED FOR USE INSIDE AUTOBUILD, WITH EXPORTED VATIABLES, LIKE AB, ARCH. 5 | # SYNTAX: autobuild abrepoarchive PKGNAME PKGVER PKGREL 6 | # CURRENTLY DEFINED PKGMGRs: dpkg. 7 | 8 | # Directory Tree with priorities. 9 | DIR_TREE="a b c d e f g h i j k m n o p q r s t u v w x y z 10 | liba libb libc libd libe libf libg libh libi libj libk libl libm libn libo 11 | libp libq libr libs libt libu libv libw libx liby libz l 0 1 2 3 4 5 6 7 8 9 _UNSORTED 12 | A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" 13 | 14 | TREE=1 15 | TARGET_DIR=/debs 16 | 17 | # Functions, etc. ABSET, AB as exported by autobuild. ARCH as exported. 18 | . "$AB"/lib/base.sh >/dev/null 2>&1 19 | 20 | # Make it architecturally aware. 21 | . "$AB"/lib/arch.sh >/dev/null 2>&1 22 | . "$AB"/arch/_common.sh >/dev/null 2>&1 23 | 24 | mvln(){ # not using cp -s because we want the main part to be in the target 25 | mv "$1" "$2" || aberr "Move from [$1] to [$2] failed: $?" 26 | ln -s "$2" "$1" || aberr "Link from [$2] to [$1] failed: $?" 27 | } 28 | 29 | if [ "$TREE" == 1 ]; 30 | then 31 | for _layout in {a..k} lib{a..z} {l..z} {0..9} _UNSORTED; do [[ $1 == "$_layout"* ]] && break; done || abwarn "$1 NOT SORTED" 32 | else 33 | abinfo "Not using an alphabetical tree." 34 | fi 35 | 36 | # in place 37 | mkdir -p "$TARGET_DIR"/"$_layout" 38 | cp -v "$PWD/$1_$2-$3_$4.deb" "$TARGET_DIR/$_layout" 39 | -------------------------------------------------------------------------------- /contrib/autobuild-batch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # autobuild-batch: batch-build 3 | ##@copyright GPL-2.0+ 4 | [ "$1" != "" ] && _list=$1 || _list=./ab_batch 5 | 6 | _pwd=$PWD 7 | export ABARCHIVE=abrepoarchive 8 | 9 | ! [ -e $_list ] && echo "List file $_list not found!" && exit 1 10 | 11 | # Well, do we need a xargs-based multi-process? 12 | for i in $(cat $_list); do 13 | cd $i 14 | autobuild >stdout 2>stderr 15 | cd $_pwd 16 | done 17 | -------------------------------------------------------------------------------- /contrib/autobuild-test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # autobuild-test: seperated bash instance for tests 3 | 4 | if [[ $# -eq 0 ]]; then 5 | TEST=default 6 | else 7 | TEST=$1 8 | fi 9 | 10 | . $AB/lib/diag.sh || { echo "\e[1;91m FATAL: Cannot open stacktrace printing library! exiting."; exit 1; } 11 | . $AB/lib/base.sh || { echo "\e[1;91m FATAL: Cannot open base library! exiting."; exit 1; } 12 | . $AB/lib/builtins.sh || { echo "\e[1;91m FATAL: Cannot open utility function library! exiting."; exit 1; } 13 | 14 | echo "================= Running autobuild3 test for $TEST =================" 15 | 16 | . $AB/proc/10-core_defines.sh || abdie "Cannot load core_defines.sh, exiting ..." 17 | . $AB/proc/10-env-setup.sh || abdie "Cannot load env-setup.sh, exting ..." 18 | 19 | abrequire tests 20 | 21 | abtest_result(){ 22 | if [[ -e "$ABTEST_RESULT_OUTPUT" ]]; then 23 | echo "X-AOSC-Testing-$TEST-$1: $2" >> $ABTEST_RESULT_OUTPUT 24 | fi 25 | } 26 | 27 | if [[ "$TEST" == "default" ]]; then 28 | DEFAULT=yes 29 | fi 30 | 31 | if [ "$TEST" == "" ]; then 32 | abdie "No test specified, exiting ..." 33 | fi 34 | 35 | if bool $DEFAULT; then 36 | abinfo "Generating default test ..." 37 | . $AB/proc/20-build_funcs.sh || abdie "Cannot load functions at build! exiting." 38 | . $AB/proc/30-build_probe.sh 39 | ab_dbg "ABTYPE for this build is $ABTYPE ..." 40 | abtest_gen_default 41 | if [[ $? -ne 0 ]]; then 42 | abdie "Failed to generate default test, exiting ..." 43 | fi 44 | _IFS="$IFS" IFS=$'\n' 45 | IFS=$'\n' 46 | for vars in $( set -o posix; set ); do 47 | if [[ "${vars}" =~ ^ABTEST_default_ ]]; then 48 | eval "${vars/ABTEST_default_/}" 49 | fi 50 | done 51 | IFS="$_IFS" 52 | unset _IFS 53 | else 54 | . $SRCDIR/autobuild/tests/$TEST || abdie "Failed to load testspec file $SRCDIR/autobuild/tests/$TEST" 55 | fi 56 | 57 | . $AB/tests/$TESTTYPE.sh || aberr "Test type $TESTTYPE is invalid." 58 | 59 | abtest_${TESTTYPE}_test 60 | 61 | if [[ $EXIT_CODE -gt 2 ]]; then 62 | EXIT_CODE=255 63 | fi 64 | 65 | echo "================= Finished autobuild3 test for $TEST =================" 66 | exit $EXIT_CODE 67 | -------------------------------------------------------------------------------- /etc/autobuild/ab3_defcfg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash- 2 | ##Autobuild default config file 3 | ##@copyright CC0 4 | 5 | # Environmental Settings 6 | # Avoid setting TMPDIR as tmpfs mount points. 7 | TMPDIR="$SRCDIR" 8 | 9 | # Misc building flags 10 | ABARCHIVE=autobuild-aoscarchive # Archive program 11 | ABSHADOW=yes # Shall shadow builds be performed by default? 12 | NOLTO=no # Enable LTO by default. 13 | USECLANG=no # Are we using clang? 14 | NOSTATIC=yes # Want those big fat static libraries? 15 | ABCLEAN=yes # Clean before build? 16 | NOLIBTOOL=yes # Hug pkg-config and CMake configurations? 17 | ABCONFIGHACK=yes # Use config.{sub,guess} replacement for newer architectures? 18 | NOCARGOAUDIT=no # Audit Cargo (Rust) dependencies? 19 | NONPMAUDIT=no # Audit NPM dependencies? 20 | ABUSECMAKEBUILD=yes # Use cmake build for cmake* ABTYPEs? 21 | ABSPLITDBG=yes # Split out debug package containing symbols (-dbg)? 22 | ABBUILDDEPONLY=no # Avoid installing runtime dependencies when building? 23 | 24 | # Strict Autotools option checking? 25 | AUTOTOOLS_STRICT=yes 26 | 27 | # Parallelism, the default value is an equation depending on the number of processors. 28 | # $ABTHREADS will take any integer larger than 0. 29 | ABTHREADS=$(( $(nproc) + 1)) 30 | ABMANCOMPRESS=1 31 | ABINFOCOMPRESS=1 32 | ABELFDEP=0 # Guess dependencies from ldd? 33 | ABSTRIP=1 # Should ELF be stripped off debug and unneeded symbols? 34 | 35 | # Use -O3 instead? 36 | AB_FLAGS_O3=0 37 | 38 | # Use -Os instead? 39 | AB_FLAGS_OS=0 40 | 41 | # PIC and PIE are enabled by GCC/LD specs. 42 | AB_FLAGS_SSP=1 43 | AB_FLAGS_SCP=1 44 | AB_FLAGS_RRO=1 45 | AB_FLAGS_NOW=1 46 | AB_FLAGS_FTF=1 47 | 48 | # Fallback for Clang which does not support specs. 49 | AB_FLAGS_PIC=1 50 | AB_FLAGS_PIE=1 51 | 52 | # Hardening specs? 53 | AB_FLAGS_SPECS=1 54 | 55 | # Enable table-based thread cancellation. 56 | AB_FLAGS_EXC=1 57 | 58 | AB_SAN_ADD=0 59 | AB_SAN_THR=0 60 | AB_SAN_LEK=0 61 | 62 | # Use BFD LD? 63 | AB_LD_BFD=0 64 | 65 | # Default testing flags 66 | ABTESTS="" 67 | ABTEST_AUTO_DETECT=yes 68 | ABTEST_ABORT_BUILD=no 69 | ABTEST_TESTEXEC=plain 70 | ABTEST_AUTO_DETECT_STAGE=post-build 71 | ABTESTTYPE_rust_STAGE=post-build 72 | NOTEST=yes 73 | 74 | ##OS Directory Tree 75 | # Built-in variables for AOSC OS directory tree. 76 | # Will be updated. Therefore not part of conffiles. 77 | # 78 | PREFIX="/usr" 79 | BINDIR="/usr/bin" 80 | LIBDIR="/usr/lib" 81 | SYSCONF="/etc" 82 | CONFD="/etc/conf.d" 83 | ETCDEF="/etc/default" 84 | LDSOCONF="/etc/ld.so.conf.d" 85 | FCCONF="/etc/fonts" 86 | LOGROT="/etc/logrotate.d" 87 | CROND="/etc/cron.d" 88 | SKELDIR="/etc/skel" 89 | BINFMTD="/usr/lib/binfmt.d" 90 | X11CONF="/etc/X11/xorg.conf.d" 91 | STATDIR="/var" 92 | INCLUDE="/usr/include" 93 | BOOTDIR="/boot" 94 | LIBEXEC="/usr/libexec" 95 | MANDIR="/usr/share/man" 96 | FDOAPP="/usr/share/applications" 97 | FDOICO="/usr/share/icons" 98 | FONTDIR="/usr/share/fonts" 99 | USRSRC="/usr/src" 100 | VARLIB="/var/lib" 101 | RUNDIR="/run" 102 | DOCDIR="/usr/share/doc" 103 | LICDIR="/usr/share/doc/licenses" 104 | SYDDIR="/usr/lib/systemd/system" 105 | SYDSCR="/usr/lib/systemd/scripts" 106 | TMPFILE="/usr/lib/tmpfiles.d" 107 | PAMDIR="/etc/pam.d" 108 | JAVAMOD="/usr/share/java" 109 | JAVAHOME="/usr/lib/java" 110 | GTKDOC="/usr/share/gtk-doc" 111 | GSCHEMAS="/usr/share/glib-2.0/schemas" 112 | THEMES="/usr/share/themes" 113 | BASHCOMP="/usr/share/bash-completion" 114 | ZSHCOMP="/usr/share/zsh-completion" 115 | PROFILED="/etc/profile.d" 116 | LOCALES="/usr/share/locales" 117 | VIMDIR="/usr/share/vim" 118 | QT4DIR="/usr/lib/qt4" 119 | QT5DIR="/usr/lib/qt5" 120 | QT4BIN="/usr/lib/qt4/bin" 121 | QT5BIN="/usr/lib/qt5/bin" 122 | 123 | ##OS basic configuration flags 124 | AUTOTOOLS_DEF=""" 125 | --prefix=$PREFIX 126 | --sysconfdir=$SYSCONF 127 | --localstatedir=$STATDIR 128 | --libdir=$LIBDIR 129 | --bindir=$BINDIR 130 | --sbindir=$BINDIR 131 | --mandir=$MANDIR 132 | """ 133 | CMAKE_DEF=""" 134 | -DCMAKE_INSTALL_PREFIX=$PREFIX 135 | -DCMAKE_BUILD_TYPE=RelWithDebInfo 136 | -DCMAKE_INSTALL_LIBDIR=lib 137 | -DLIB_INSTALL_DIR=lib 138 | -DSYSCONF_INSTALL_DIR=$SYSCONF 139 | -DCMAKE_INSTALL_SBINDIR=$BINDIR 140 | -DCMAKE_SKIP_RPATH=ON 141 | -DCMAKE_VERBOSE_MAKEFILE=ON 142 | """ 143 | MESON_DEF="--prefix=$PREFIX --sbindir=$BINDIR" 144 | WAF_DEF="--prefix=$PREFIX --configdir=$SYSCONF --libdir=$LIBDIR" 145 | QTPROJ_DEF="PREFIX=$PREFIX LIBDIR=/usr/lib CONFIG+=force_debug_info" 146 | MAKE_INSTALL_DEF="PREFIX=$PREFIX BINDIR=$BINDIR \ 147 | SBINDIR=$BINDIR LIBDIR=$LIBDIR INCDIR=$INCLUDE MANDIR=$MANDIR \ 148 | prefix=$PREFIX bindir=$BINDIR sbindir=$BINDIR libdir=$LIBDIR \ 149 | incdir=$INCLUDE mandir=$MANDIR" 150 | 151 | # AUTOTOOLS related 152 | RECONF=yes 153 | 154 | ##Packaging info 155 | ABQA=yes 156 | ABINSTALL="dpkg" 157 | 158 | # Golang default build flags | Adapted from Arch Linux's Go package guildline. 159 | GOFLAGS+=" -mod=readonly" # Ensure module files are not updated during building process. 160 | GOFLAGS+=" -trimpath" # Required for eproducible build. 161 | GOFLAGS+=" -modcacherw" # Ensures that go modules creates a write-able path. 162 | GOFLAGS+=" -buildmode=pie" # Hardening binary. 163 | 164 | # Old, default. 165 | [[ -d "$AB"/etc/autobuild/defaults ]] && recsr "$AB"/etc/autobuild/defaults/*!(.dpkg*|dist) 166 | 167 | . "$AB"/etc/autobuild/ab3cfg.sh 168 | [[ -d "$AB"/etc/autobuild/ab3cfg.d ]] && recsr "$AB"/etc/autobuild/ab3cfg.d/*!(.dpkg*|dist) 169 | 170 | if bool $ABSTAGE2; then 171 | abwarn "Autobuild3 running in stage2 mode ..." 172 | NOCARGOAUDIT=yes 173 | NONPMAUDIT=yes 174 | ABSPLITDBG=no 175 | fi 176 | 177 | abdetectarch() { 178 | type dpkg >/dev/null 2>&1 && dpkg --print-architecture || ( echo "[!!!] Cannot find dpkg executable, exiting ..." && exit 1 ) 179 | } 180 | 181 | abassigngroup() { 182 | basename -a $(grep -lr "$1" "$AB/sets/arch_groups/") 183 | } 184 | 185 | ((AB_COMPAT > 1)) || : "${ABBUILD:=$ARCH}" "${ABHOST:=$CROSS}" 186 | : "${ABBUILD:="$(abdetectarch)"}" "${ABHOST:=$ABBUILD}" "${ABTARGET:=$ABHOST}" 187 | ABHOST_GROUP="$(abassigngroup $ABHOST)" 188 | 189 | unset -f abdetectarch abassigngroup 190 | -------------------------------------------------------------------------------- /etc/autobuild/ab3cfg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##Autobuild user config override 3 | # See a list of options in ab3_defcfg.sh. 4 | ABMPM=dpkg # Your main PM 5 | ABAPMS= # Other PMs 6 | MTER="Null Packager " 7 | ABINSTALL=dpkg 8 | -------------------------------------------------------------------------------- /etc/autobuild/prefix: -------------------------------------------------------------------------------- 1 | /usr/lib/autobuild3 2 | -------------------------------------------------------------------------------- /exportvars/build_qtproj: -------------------------------------------------------------------------------- 1 | QT_SELECT 2 | -------------------------------------------------------------------------------- /exportvars/compilers: -------------------------------------------------------------------------------- 1 | USECLANG 2 | -------------------------------------------------------------------------------- /exportvars/default: -------------------------------------------------------------------------------- 1 | PKGNAME 2 | PKGVER 3 | PKGDEP 4 | PKGDES 5 | PKGESS 6 | PKGSEC 7 | PKGRECOM 8 | PKGREL 9 | PKGCONFL 10 | PKGPROV 11 | PKGREP 12 | PKGSUG 13 | PKGBREAK 14 | ABBUILD 15 | MTER 16 | ABMPM 17 | ABAPMS 18 | BUILDDEP 19 | PKGPRDEP 20 | -------------------------------------------------------------------------------- /exportvars/filter_elf: -------------------------------------------------------------------------------- 1 | ABSTRIP 2 | ABSPLITDBG 3 | SYMTAB 4 | -------------------------------------------------------------------------------- /exportvars/flags: -------------------------------------------------------------------------------- 1 | AB_FLAGS_SSP 2 | AB_FLAGS_SCP 3 | AB_FLAGS_RRO 4 | AB_FLAGS_NOW 5 | AB_FLAGS_FTF 6 | AB_FLAGS_SPECS 7 | AB_FLAGS_O3 8 | AB_FLAGS_OS 9 | AB_FLAGS_EXC 10 | AB_FLAGS_PIC 11 | AB_FLAGS_PIE 12 | AB_SAN_ADD 13 | AB_SAN_THR 14 | AB_SAN_LEK 15 | NOLTO 16 | NOSTATIC 17 | -------------------------------------------------------------------------------- /exportvars/offical_builds: -------------------------------------------------------------------------------- 1 | AUTOTOOLS_AFTER 2 | CMAKE_AFTER 3 | AUTOTOOLS_DEF 4 | CMAKE_DEF 5 | MAKE_AFTER 6 | INSTALL_AFTER 7 | MESON_DEF 8 | MESON_AFTER 9 | WAF_AFTER 10 | WAF_DEF 11 | QTPROJ_AFTER 12 | QTPROJ_DEF 13 | MAKE_INSTALL_DEF 14 | NOPARALLEL 15 | ABTHREADS 16 | CARGO_AFTER 17 | ABMK 18 | DUNE_INSTALL_AFTER 19 | DUNE_PACKAGES 20 | DUNE_BUILD_AFTER 21 | -------------------------------------------------------------------------------- /exportvars/python: -------------------------------------------------------------------------------- 1 | ABPY2VER 2 | ABPY2SHORTVER 3 | ABPY3VER 4 | ABPY3SHORTVER 5 | -------------------------------------------------------------------------------- /filter/elf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/elf.sh: ELF-related filters 3 | ##@copyright GPL-2.0+ 4 | abrequire elf 5 | 6 | recsr $AB/filter/elf/*.sh 7 | 8 | filter_elf__process(){ 9 | local _elf_f 10 | elf_iself "$@" || return 0 11 | [ -z "$ABELFFILTERS" ] && return 0 12 | for _elf_f in $ABELFFILTERS 13 | do 14 | filter_elf_$_elf_f "$@" || abwarn "$(argprint filter_elf_$_elf_f "$@"): $?" 15 | done 16 | } 17 | 18 | filter_elf(){ 19 | local _elf_f _elf_cmd 20 | for _elf_f in $ABELFFILTER; do 21 | _elf_cmd=filter_elf_${_elf_f}_pre 22 | ! _which $_elf_cmd &>/dev/null || $_elf_cmd || abwarn "$(argprint $_elf_cmd "$@"): $?" 23 | done 24 | for i in "$PKGDIR"/{opt/*/*/,opt/*/,usr/,}{lib{,64,exec},{s,}bin}/**; do filter_elf__process "$i"; done 25 | cd "$PKGDIR" || abdie "cannot enter $PKGDIR" 26 | for _elf_f in $ABELFFILTER; do 27 | _elf_cmd=filter_elf_${_elf_f}_post; 28 | ! _which $_elf_cmd &>/dev/null || $_elf_cmd || abwarn "$(argprint $_elf_cmd "$@"): $?"; 29 | done 30 | } 31 | 32 | export ABFILTERS+=" elf" 33 | -------------------------------------------------------------------------------- /filter/elf/dep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/elf/lib.sh: Adds dependencies according to ldd output 3 | ##@copyright GPL-2.0+ 4 | abrequire elf depset pm 5 | 6 | filter_elf_dep(){ 7 | bool $ABELFDEP || return 0 8 | echo "Looking for Dependencies on $1 ..." 9 | local _IFS="$IFS" IFS=$'\n' 10 | local lddstr="$(ldd "$1")" || return 1 11 | if grep "not found" <<< "$lddstr"; then 12 | abicu "Missing library found in $1." 13 | return 1 14 | fi 15 | lddstr="${lddstr//${p//(*([^)]))}}" 16 | filter_elf_dep_libs+=($(IFS=' '; while read -r _1 _2 _3 __; do echo "$_3"; done <<< "$lddstr")) 17 | IFS="$_IFS" 18 | } 19 | 20 | filter_elf_dep_post(){ 21 | local i P 22 | # Need smarter rules. 23 | filter_elf_dep_libs=("${filter_elf_dep_libs[@]//\/lib64\//lib/}") 24 | filter_elf_dep_libs=("${filter_elf_dep_libs[@]//..\/lib}") 25 | # We should dedup filter_elf_dep_libs first. Saves time dealing with pm. 26 | # As the saying goes, I am always lazy.. So let's do it with the key of a dict. 27 | declare -A _exists 28 | for i in "${filter_elf_dep_libs[@]}"; do _exists["$i"]=1; done 29 | filter_elf_dep_libs=("${!_exists[@]}") # more magically it's sorted. 30 | # It's also possible to do it here, like ((_exists[i])) && continue. 31 | for i in "${filter_elf_dep_libs[@]}" 32 | do 33 | P="$(pm_whoprov $i)" 34 | abdbg "pm_whoprov returned ${P-null} for $i: $?" 35 | # Now I can make it a one-liner if I want to hahaha 36 | depset_add "$P" 37 | done 38 | return 0 # depset_add ret EAOSC_WRONGFMT(2) on ! [[ "$P" && "$P" != "$PKGNAME" ]], ignore it. 39 | } 40 | 41 | export ABELFFILTERS+=" dep" 42 | -------------------------------------------------------------------------------- /filter/elf/split.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/elf/splitdbg.sh: Saves a copy of debug symbols around 3 | ##@copyright GPL-2.0+ 4 | 5 | # Note: This must be done before strip 6 | abrequire elf 7 | 8 | filter_elf_splitdbg_pre() 9 | { 10 | bool $ABSTRIP || return 0 11 | bool $ABSPLITDBG || return 0 12 | abdbg "Creating installation directory for debug symbols: $SYMDIR" 13 | mkdir -p "$SYMDIR" 14 | } 15 | 16 | filter_elf_splitdbg() 17 | { 18 | # ABSTRIP = false => Don't split 19 | bool $ABSTRIP || return 0 20 | # ABSTRIP = true and ABSPLITDBG = false => Don't split 21 | bool $ABSPLITDBG || return 0 22 | abdbg "Saving debug symbols from $1 .." 23 | elf_copydbg "$1" "${SYMDIR}" 24 | } 25 | 26 | export ABELFFILTERS="$ABELFFILTERS splitdbg" 27 | -------------------------------------------------------------------------------- /filter/elf/strip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/elf/strip.sh: Strips ELF files 3 | ##@copyright GPL-2.0+ 4 | abrequire elf 5 | 6 | filter_elf_strip(){ 7 | bool $ABSTRIP || return 0 8 | abdbg "Stripping $1 ..." 9 | elf_strip "$1" 10 | } 11 | 12 | export ABELFFILTERS="$ABELFFILTERS strip" 13 | -------------------------------------------------------------------------------- /filter/info_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/infodir.sh: Kills the info directory 3 | ##@copyright GPL-2.0+ 4 | filter_infodir(){ 5 | if [ -f usr/share/info/dir ] 6 | then 7 | rm usr/share/info/dir 8 | fi 9 | } 10 | 11 | export ABFILTERS+=" infodir" 12 | -------------------------------------------------------------------------------- /filter/infocompress.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/infocompress.sh: Compresses Texinfo pages 3 | ##@copyright GPL-2.0+ 4 | filter_infocompress() { 5 | ((ABINFOCOMPRESS)) || return 6 | __infocomp_todo=() 7 | 8 | if [ -d "$PKGDIR"/usr/share/info ]; then 9 | for i in "$PKGDIR"/usr/share/info/*.info; do 10 | if [[ -L $i ]]; then 11 | __infocomp_lnk=$(namei "$i" | tail -1 | awk '{print $NF}') 12 | rm "$i" 13 | ln -sf "$__infocomp_lnk".xz "$i" 14 | elif [[ -f $i ]]; then 15 | __infocomp_todo+=("$i") 16 | else 17 | abwarn "abinfocomp WTF for ${i#"$PKGDIR"}" 18 | fi 19 | done 20 | 21 | abinfo "Compressing Texinfo page ${__infocomp_todo[@]} ..." 22 | xz --lzma2=preset=6e,pb=0 -- "${__infocomp_todo[@]}" 23 | fi 24 | 25 | unset __infocomp_todo __infocomp_lnk 26 | } 27 | 28 | ABFILTERS+=" infocompress" 29 | -------------------------------------------------------------------------------- /filter/lib_archives.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/elf/lib_archives.sh: Kills *.a / *.la 3 | ##@copyright GPL-2.0+ 4 | filter_lib_archives() { 5 | if bool $NOLIBTOOL; then 6 | abinfo "Purging libtool archives from build tree." 7 | find $PKGDIR -name '*.la' -delete || abwarn ".la purge: $?" 8 | fi 9 | 10 | if bool $NOSTATIC; then 11 | abinfo "Purging static libraries from build tree." 12 | find $PKGDIR -name '*.a' -delete || abwarn ".a purge: $?" 13 | fi 14 | } 15 | 16 | ABFILTERS+=" lib_archives" 17 | -------------------------------------------------------------------------------- /filter/mancompress.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/mancompress.sh: Compresses manpages and break symlinks and boom 3 | ##@copyright GPL-2.0+ 4 | filter_mancompress() { 5 | ((ABMANCOMPRESS)) || return 6 | __mancomp_todo=() 7 | 8 | if [ -d "$PKGDIR"/usr/share/man ]; then 9 | for i in "$PKGDIR"/usr/share/man/**/*.*; do 10 | if [[ $i == *.gz || $i == *.bz2 || $i = *.zst || $i == *.xz ]]; then 11 | continue 12 | fi 13 | 14 | if [[ -L $i ]]; then 15 | __mancomp_lnk=$(namei "$i" | tail -1 | awk '{print $NF}') 16 | rm "$i" 17 | ln -sf "$__mancomp_lnk".xz "$i" 18 | elif [[ -f $i ]]; then 19 | __mancomp_todo+=("$i") 20 | else 21 | abwarn "abmancomp WTF for ${i#"$PKGDIR"}" 22 | fi 23 | done 24 | 25 | abinfo "Compressing man page ${__mancomp_todo[@]} ..." 26 | xz --lzma2=preset=6e,pb=0 -- "${__mancomp_todo[@]}" 27 | fi 28 | 29 | unset __mancomp_todo __mancomp_lnk 30 | } 31 | 32 | ABFILTERS+=" mancompress" 33 | -------------------------------------------------------------------------------- /filter/perl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/perl_local: Removes perllocal.pod. 3 | ##@copyright GPL-2.0+ 4 | filter_perl(){ 5 | abinfo "Removed perllocal.pod." 6 | find "$PKGDIR" -name perllocal.pod -delete 7 | 8 | abinfo "Removed .packlist." 9 | find "$PKGDIR" -name .packlist -delete 10 | } 11 | 12 | export ABFILTERS+=" perl" 13 | -------------------------------------------------------------------------------- /filter/retro_drop_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##filter/retro_drop_docs.sh: Drop /usr/share/{,gtk-}doc for Retro architectures. 3 | ##@copyright GPL-2.0+ 4 | filter_retro_drop_docs() { 5 | if ab_match_archgroup retro; then 6 | if [ -d "$PKGDIR"/usr/share/doc ]; then 7 | abinfo "Dropping documentation ..." 8 | rm -r "$PKGDIR"/usr/share/doc 9 | fi 10 | 11 | # GTK-Doc stores Python modules in /usr/share/gtk-doc, 12 | # dropping this directory will render its tools unusable. 13 | if [[ "$PKGNAME" != "gtk-doc" && \ 14 | -d "$PKGDIR"/usr/share/gtk-doc ]]; then 15 | abinfo "Dropping gtk-doc ..." 16 | rm -r "$PKGDIR"/usr/share/gtk-doc 17 | fi 18 | else 19 | abinfo "Non-Retro architectures detected, skipping retro_drop_docs ..." 20 | fi 21 | } 22 | 23 | export ABFILTERS+=" retro_drop_docs" 24 | -------------------------------------------------------------------------------- /lib/arch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##arch.sh: archtecture support code. 3 | ##@copyright GPL-2.0+ 4 | abrequire pm 5 | 6 | # compat 1.x. 7 | ((AB_COMPAT > 1)) || declare -gn ARCH=ABBUILD CROSS=ABHOST ARCH_GROUP=ABHOST_GROUP 8 | 9 | # translations from dpkg representation to generic ones. 10 | # Sorry, top level! Scoping made me do this. 11 | declare -gA ARCH_TARGET 12 | # Construct ARCH_FINDFILELIST 13 | ## FIXME: Find a way to handle ambiguous abhost groups 14 | ## e.g., autobuild/{mainline,ocaml-native} 15 | ARCH_FINDFILELIST=("autobuild/$ABHOST"{-cross{-"$ABBUILD",},} \ 16 | "autobuild/`eval echo ${ABHOST_GROUP//$'\n'/,}`" \ 17 | autobuild) 18 | 19 | ARCH_SUFFIX=('' .sh .bash .bsh) 20 | arch_findfile(){ 21 | local i j _arch_suf 22 | ((_arch_trymore)) && _arch_suf=("${ARCH_SUFFIX[@]}") || _arch_suf=('') 23 | for i in "${ARCH_FINDFILELIST[@]}" 24 | do 25 | for j in "${_arch_suf[@]}"; do 26 | if [ -e "$i/$1$j" ] 27 | then 28 | printf '%s\n' "$i/$1$j" 29 | return 0 30 | fi 31 | done 32 | done 33 | printf '%s\n' "autobuild/$1" 34 | return 127 35 | } 36 | 37 | # Initialise variables with architectural suffixes. 38 | arch_loadvar(){ 39 | local name_archvar=${1}__${ABHOST^^} 40 | local name_commonvar=${1} 41 | if abisdefined $name_archvar; then 42 | abdbg "Setting ${name_commonvar} from arch-specific variable $name_archvar" 43 | abcopyvar $name_archvar $name_commonvar 44 | else 45 | # Need to try to match group one by one 46 | for _GROUP in ${ABHOST_GROUP}; do 47 | local name_groupvar=${1}__${_GROUP^^} 48 | if abisdefined $name_groupvar; then 49 | if [[ $_assignedGroup ]]; then 50 | aberr "Refusing to assign $name_commonvar to group-specific variable $name_groupvar" 51 | aberr "... because it is already assigned to ${1}__${_assignedGroup^^}" 52 | abinfo "Current ABHOST ${ABHOST} belongs to the following groups:" 53 | abinfo "${ABHOST_GROUP//$'\n'/, }" 54 | abinfo "Add a more specific $name_archvar instead to suppress the conflict." 55 | abdie "Ambiguous architecture group variable detected! Refuse to proceed." 56 | break 57 | fi 58 | abdbg "Setting $name_commonvar from group-specific variable $name_groupvar" 59 | abcopyvar $name_groupvar $name_commonvar 60 | _assignedGroup=${_GROUP} 61 | fi 62 | done 63 | # Fixes #134 64 | # Need to unset it to prevent pollution 65 | unset _assignedGroup 66 | fi 67 | } 68 | 69 | # FIXME: We need to figure out a way of handling multiple return vals! 70 | arch_loadfiles(){ 71 | local _archpath _archpidx j _archokay=0 72 | local _arch_suf _arch_trymore=${arch_trymore:-1} 73 | ((_arch_trymore)) && _arch_suf=("${ARCH_SUFFIX[@]}") || _arch_suf=('') 74 | for (( _archpidx = "${#ARCH_FINDFILELIST[@]}"; _archpidx; --_archpidx )) 75 | do 76 | _archpath="${ARCH_FINDFILELIST[$_archpidx]}" 77 | for j in "${_arch_suf[@]}"; do 78 | if [ -e "$_archpath/$1$j" ]; then 79 | . "$_archpath/$1$j" 80 | for var in `cat $AB/exportvars/*`; do 81 | arch_loadvar $var 82 | done 83 | _archokay=1 84 | break 85 | fi 86 | done 87 | done 88 | (( _archokay )) || return 127 89 | } 90 | 91 | # Making assignment in local line will cause $? capturing to fail. 92 | arch_loadfile(){ 93 | local _abarchf _arch_trymore=${arch_trymore:-1}; 94 | _abarchf="$(arch_findfile "$1")" || return $?; 95 | shift; 96 | . "$_abarchf" "$@"; 97 | } 98 | 99 | arch_loadfile_strict(){ 100 | local _abarchf _arch_trymore=${arch_trymore:-1}; 101 | _abarchf="$(arch_findfile "$1")" || return $?; 102 | shift; 103 | load_strict "${_abarchf}" "$@"; 104 | } 105 | 106 | arch_initcross(){ 107 | if [[ $ABBUILD == $ABHOST || $ABHOST == noarch ]]; then 108 | return 0 109 | fi 110 | : "${HOSTSYSROOT=/var/ab/cross-root/$ABHOST}" 111 | : "${HOSTTOOLPREFIX=/opt/abcross/$ABHOST/bin/$HOST}" 112 | "$HOSTSYSROOT"/bin/sh -c "exit 0" &>/dev/null; ((HOSTEXE = ! $?)) 113 | pm_chroot "$HOSTSYSROOT" 114 | export PATH="$(dirname "$HOSTTOOLPREFIX"):$PATH" 115 | } 116 | 117 | # todo: make these variables I guess? 118 | arch_lib(){ echo "$(arch_crossroot "$@")/usr/lib"; } 119 | arch_crossroot() { echo "/var/ab/cross-root/$ABHOST"; } 120 | -------------------------------------------------------------------------------- /lib/base.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##base.sh: Base library. 3 | ##@copyright GPL-2.0+ WITH GPL-Classpath-Exception 4 | # Not to be run directly. 5 | # TODO: Add basic support for bashdb. 6 | shopt -s expand_aliases extglob globstar nullglob 7 | 8 | declare -x ABLIBS="|base|" # GLOBAL: ABLIBS='|base[|lib1|lib2]|' 9 | 10 | argprint(){ printf '%q ' "$@"; } 11 | readonly true=1 false=0 yes=1 no=0 12 | 13 | bool(){ 14 | case "$1" in 15 | [0fFnN]|false|no) return 1 ;; 16 | [1tTyY]|true|yes) return 0 ;; 17 | *) return 2;; 18 | esac 19 | } 20 | 21 | abreqexe(){ 22 | local i; 23 | for i; do 24 | type $i &> /dev/null || abicu "Executable ‘$i’ not found; returned value: $?."{\ Expect\ failures.,} 25 | done 26 | } 27 | 28 | abtryexe(){ 29 | local i; 30 | for i; do 31 | type $i &> /dev/null || abinfo "No executable ‘$i’ has been found; returned value: $?." 32 | done 33 | } 34 | 35 | _whichcmd(){ (alias; declare -f) | /usr/bin/which -i --read-functions "$1"; } 36 | which --version 2>/dev/null | grep -q GNU || _whichcmd(){ alias "$1" || declare -f "$1" || which "$1"; } 37 | abreqcmd(){ 38 | local i; 39 | for i; do 40 | type "$i" &> /dev/null || 41 | abicu "Command ‘$i’ not found; returned value: $?."{\ Expect\ failures.,} 42 | done 43 | } 44 | 45 | abtrycmd(){ 46 | local i; 47 | for i; do 48 | type "$i" &> /dev/null || 49 | abinfo "No command ‘$i’ has been found, returned value: $?." 50 | done 51 | } 52 | 53 | abcmdstub(){ 54 | local i; 55 | for i; do 56 | _whichcmd "$i" &>/dev/null || alias "$i=${_ab_stub_body:-:}" 57 | done 58 | } 59 | 60 | abloadlib(){ 61 | [ -f $ABBLPREFIX/$1.sh ] || return 127 62 | . "$ABBLPREFIX/$1.sh" || return 63 | ABLIBS+="$1|" 64 | abinfo "Loaded library $1" 1>&2 65 | } 66 | 67 | abrequire(){ 68 | local i 69 | for i; do 70 | [[ $ABLIBS == *"|$i|"* ]] || abloadlib "$i" || 71 | abicu "Library ‘$i’ failed to load; returned value: $?."{" Expect Failures",} 72 | done 73 | } 74 | alias abtrylib='ABSTRICT=0 abrequire' 75 | 76 | ablog(){ 77 | if bool "$ABDUMB" 78 | then cat > ablog 79 | else tee ablog 80 | fi 81 | } 82 | 83 | returns() { return $*; } 84 | abcommaprint(){ local cnt; for i; do abmkcomma; echo -n "$i"; done; } 85 | abmkcomma(){ ((cnt++)) && echo -n "${ABCOMMA-, }"; } 86 | 87 | # hey buddy, you are dying! 88 | abicu(){ 89 | if ((ABSTRICT)); then 90 | [ "$2" ] && shift 91 | abdie "$@" 92 | else 93 | aberr "$1" 94 | return 1 95 | fi 96 | } 97 | 98 | abdie() { 99 | diag_print_backtrace 100 | echo -e "\e[1;31mautobuild encountered an error and couldn't continue.\e[0m" 1>&2 101 | echo -e "${1-Look at the stacktrace to see what happened.}" 1>&2 102 | echo "------------------------------autobuild ${ABVERSION:-3}------------------------------" 1>&2 103 | echo -e "Go to ‘\e[1mhttps://github.com/AOSC-Dev/autobuild3\e[0m’ for more information on this error." 1>&2 104 | if ((AB_DBG)); then 105 | read -n 1 -p "AUTOBUILD_DEBUG: CONTINUE? (Y/N)" -t 5 AB_DBGRUN || AB_DBGRUN=false 106 | bool $AB_DBGRUN && abwarn "Forced AUTOBUILD_DIE continue." && return 0 || abdbg "AUTOBUILD_DIE EXIT - NO_CONTINUE" 107 | fi 108 | exit "${2-1}" 109 | } 110 | 111 | # Should these information be redirected into ablog()? 112 | # new ref impl: https://github.com/Arthur2e5/MobileConstructionVehicle/blob/master/common.sh 113 | abwarn() { echo -e "[\e[33mWARN\e[0m]: \e[1m$*\e[0m"; } 114 | aberr() { echo -e "[\e[31mERROR\e[0m]: \e[1m$*\e[0m"; } 115 | abinfo() { echo -e "[\e[96mINFO\e[0m]: \e[1m$*\e[0m"; } 116 | abdbg() { echo -e "[\e[32mDEBUG\e[0m]: \e[1m$*\e[0m"; } 117 | ab_dbg() { local _ret=$?; [ $AB_DBG ] && abdbg "$@"; return $_ret; } 118 | recsr(){ for sr in "$@"; do . $sr; done } 119 | # Special Source, looks like stacktrace 120 | .(){ 121 | ab_dbg "Sourcing from $1:" 122 | source "$@" 123 | local _ret=$? # CATCH_TRANSPARENT 124 | returns $_ret || abwarn ". $(argprint "$@")returned $_ret". 125 | ab_dbg "End Of $1." 126 | return $_ret 127 | } 128 | 129 | load_strict() { 130 | local _file="$1.wrap.sh" 131 | echo -e 'trap - ERR; trap "abdie" ERR; set -E; bash -n "$0"\n' > "$_file" 132 | cat "$1" >> "$_file" 133 | echo -e '\nset +E; trap - ERR' >> "$_file" 134 | shift 135 | . "$_file" "$@"; 136 | } 137 | 138 | # aosc_lib LIBNAME 139 | aosc_lib(){ 140 | if [ "$(basename "$0")" == "$1.sh" ]; then 141 | abdie "$1 is a library and shouldn't be executed directly." 42 142 | fi 143 | } 144 | 145 | aosc_lib base 146 | 147 | aosc_lib_skip(){ 148 | abwarn "${1-$AOSC_SOURCE} loading skipped." 149 | return 1 150 | } 151 | alias ablibret='aosc_lib_skip $BASH_SOURCE || return 0' 152 | 153 | # shopt/set control 154 | # Name-encoding: Regular shopts should just use their regular names, 155 | # and setflags use '-o xxx' as the name. 156 | declare -A opt_memory 157 | # set_opt opt-to-set 158 | set_opt(){ 159 | [ "$1" ] || return 2 160 | if ! shopt -q $1; then 161 | shopt -s $1 && # natural validation 162 | opt_memory["$1"]=0 163 | fi 164 | } 165 | # rec_opt [opts-to-recover ...] 166 | rec_opt(){ 167 | local _opt 168 | if [ -z "$1" ]; then 169 | rec_opt "${!opt_memory[@]}" 170 | elif [ "$1" == '-o' ]; then 171 | rec_opt "${!opt_memory[@]/#!(-o*)/_skip}" 172 | elif [ "$1" == '+o' ]; then 173 | rec_opt "${!opt_memory[@]/#-o*/_skip}" 174 | else 175 | for _opt; do 176 | [ "$_opt" == _skip ] && continue 177 | case "${opt_memory[$_opt]}" in 178 | (0) uns_opt "$_opt";; 179 | (1) set_opt "$_opt";; 180 | (*) abwarn "Invaild memory $_opt: '${opt_memory[$_opt]}'"; unset opt_memory["$_opt"];; 181 | esac 182 | done 183 | fi 184 | } 185 | # uns_opt opt-to-unset 186 | uns_opt(){ 187 | [ "$1" ] || return 2 188 | if shopt -q $1; then 189 | shopt -s $1 && # natural validation 190 | opt_memory["$1"]=1 191 | fi 192 | } 193 | 194 | # USEOPT/NOOPT control 195 | boolopt(){ 196 | local t="$1" 197 | declare -n n u 198 | t="${f##NO_}" 199 | u="USE$t" n="NO$t" 200 | if ((n)); then 201 | return 1 202 | elif ((u)); then 203 | return 0 204 | elif [[ "$t" == NO_* ]]; then 205 | return 1 206 | else 207 | return 0 208 | fi 209 | } 210 | 211 | # _AFTER type checking 212 | # returns 0 if $1 points to an array 213 | abisarray() { 214 | local VARIABLE_NAME="$1" 215 | local VARIABLE_DECL=$( (declare -p $VARIABLE_NAME 2>/dev/null ) | head -1 | cut -f 2 -d ' ' ) 216 | 217 | if [[ "${VARIABLE_DECL}" == -*a* ]]; then 218 | return 0 219 | else 220 | return 1 221 | fi 222 | } 223 | 224 | # $1 = NAME of variable to check 225 | # return 0 if $1 points to a defined variable regardless of type 226 | abisdefined() { 227 | local VARIABLE_NAME="$1" 228 | declare -p $VARIABLE_NAME 2>/dev/null 229 | } 230 | 231 | # $1 = NAME of source variable, single string or array 232 | # $2 = NAME of destination variable of the same type 233 | # This function will aberr if type doesn't match 234 | abcopyvar() { 235 | local src=$1 236 | local dst=$2 237 | 238 | # Type checking 239 | abisarray $src 240 | local -i src_is_array=$? 241 | abisarray $dst 242 | local -i dst_is_array=$? 243 | 244 | if [[ $src_is_array -ne $dst_is_array ]]; then 245 | if [[ $src_is_array -eq 0 ]]; then 246 | aberr "$src is an array, but $dst is a single string." 247 | else 248 | aberr "$src is a single string, but $dst is an array." 249 | fi 250 | abdie "Refusing to copy variables of different type!" 251 | fi 252 | 253 | # Create references for content r/w 254 | local -n ref_read_src=$src 255 | local -n ref_write_dst=$dst 256 | 257 | if [[ $src_is_array -eq 0 ]]; then 258 | ref_write_dst=("${ref_read_src[@]}") 259 | else 260 | ref_write_dst="${ref_read_src}" 261 | fi 262 | } 263 | -------------------------------------------------------------------------------- /lib/builtins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##lib/builtins.sh: Built-in functions. 3 | ##@copyright GPL-2.0+ 4 | 5 | PATCHFLAGS="-Np1 -t" 6 | RPATCHFLAGS="-Rp1 -t" 7 | 8 | ab_apply_patches() { 9 | for i in "$@"; do 10 | if [[ -e $i ]];then 11 | abinfo "Applying patch $(basename $i) ..." 12 | patch $PATCHFLAGS -i "$i" || abdie "Applying patch $i failed" 13 | fi 14 | done 15 | } 16 | 17 | ab_reverse_patches() { 18 | for i in "$@"; do 19 | if [[ -e $i ]];then 20 | abinfo "Reverting patch $(basename $i) ..." 21 | patch $RPATCHFLAGS -i "$i" || abdie "Reverting patch $i failed" 22 | fi 23 | done 24 | } 25 | 26 | ## FIXME: Find a way to make the output about what action will be taken more specific. 27 | ## Maybe a traceback message (does not print by default) is ideal? 28 | 29 | ## ab_match_arch "match_pattern" 30 | ## Check whether current ABHOST matches the match_pattern 31 | ## Example: ab_match_arch "+(amd64|arm64)" 32 | ## See also: https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html 33 | ab_match_arch() { 34 | # Check whether the calling of function is illegal 35 | if [[ -z $1 ]]; then 36 | aberr "ab_match_arch() was called but no pattern was specified." 37 | abinfo "Usage: ab_match_arch \"match_pattern\"" 38 | abdie "Misuse of ab_match_arch()! Refuse to proceed." 39 | fi 40 | if [[ ${ABHOST%%\/*} = $1 ]]; then 41 | abinfo "Architecture $ABHOST matches $1: taking true branch." 42 | return 0 43 | else 44 | abinfo "Architecture $ABHOST mismatches $1: taking false branch." 45 | return 1 46 | fi 47 | } 48 | 49 | ## ab_match_archgroup "group_match_pattern" 50 | ## Check whether current ABHOST is in a specific arch group, using bash pattern matching. 51 | ## See /sets/arch_groups/ for group information 52 | ## Example: ab_match_archgroup "+(mainline|ocaml_native)" 53 | ab_match_archgroup() { 54 | # Check whether the calling of function is illegal 55 | if [[ -z $1 ]]; then 56 | aberr "ab_match_archgroup() was called but no group was specified." 57 | abinfo "Usage: ab_match_archgroup \"group_match_pattern\"" 58 | abdie "Misuse of ab_match_archgroup()! Refuse to proceed." 59 | fi 60 | # A little more robustness here 61 | if [[ ! $ABHOST_GROUP ]]; then 62 | abwarn "Current ABHOST $ABHOST does not belong to any arch group." 63 | abwarn "Taking false branch." 64 | return 1 65 | fi 66 | for _grp in $ABHOST_GROUP; do 67 | if [[ ${_grp%%\/*} = $1 ]]; then 68 | abinfo "Member '${_grp}' in Architecture group '${ABHOST_GROUP//$'\n'/,}' matches $1: taking true branch." 69 | return 0 70 | else 71 | abdbg "Member '${_grp}' in Architecture group '${ABHOST_GROUP//$'\n'/,}' mismatches $1." 72 | fi 73 | done 74 | abinfo "All architecture group members '${ABHOST_GROUP//$'\n'/,}' mismatches $1: taking false branch." 75 | return 1 76 | } 77 | 78 | ## ab_trim_args var 79 | ## Minimize the whitespace characters inside the variable "$var" 80 | ## NOTE: This function modifies the variable IN-PLACE and does not return any value. 81 | ## Example: ab_trim_args CFLAGS 82 | ab_trim_args() { 83 | local arg 84 | declare -n arg="$1" 85 | arg="$(tr -s ' ' <<< "${arg}")" 86 | } 87 | -------------------------------------------------------------------------------- /lib/depset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##depset.sh: The dependency set (unique unordered array) 3 | ##@copyright GPL-2.0+ 4 | # Checks if the current string contains the dep argv[1] 5 | # Pollutes: BASH_REMATCH, consider rewrite in extglob. 6 | depset_contains(){ 7 | [[ "$PKGDEP" =~ (^| )$1(_|[<>=]=[^ ]*)?( |$) ]] 8 | } 9 | depset_add(){ 10 | [[ "$1" && "$1" != "$PKGNAME" ]] || return 2 11 | depset_contains $1 && return 0 12 | PKGDEP+=" $1" 13 | abinfo "Added dependency $1$([ "$2" ] && echo from $2)." 14 | } 15 | -------------------------------------------------------------------------------- /lib/diag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##diag.sh: Print out formatted stacktrace information 3 | ##@copyright GPL-2.0+ 4 | diag_normalize_location() { 5 | # $1 source file location 6 | # $2 line number 7 | # Because we wrapped the script file, this is to map back the line number 8 | local normalized="${1/.wrap.sh/}" 9 | local lineno="${2}" 10 | if [ "$normalized" != "$1" ]; then 11 | lineno="$(($2 - 1))" 12 | fi 13 | echo "${normalized}:${lineno}" 14 | } 15 | 16 | diag_format_sample() { 17 | # $1 line number 18 | # $2 sample content 19 | local lineno="$1" 20 | mapfile -td$'\n' lines <<< $2 21 | for line in "${lines[@]}"; do 22 | [ "$lineno" -eq "$1" ] && indicator='\e[1m>' || indicator=' ' # bold the first line 23 | printf "%s%4s | %s\e[0m\n" "${indicator}" "$lineno" "$line" 24 | lineno="$(($lineno+1))" 25 | done 26 | } 27 | 28 | diag_print_backtrace() { 29 | local _ret=$? 30 | echo -e "[\e[31mERROR\e[0m]: \e[1mBuild error detected ^o^\e[0m" >&2 31 | local depth="${#BASH_SOURCE[@]}" 32 | local buffer="" 33 | # Skip the first two frames, one is `abdie` and the other is `diag_print_backtrace` itself 34 | for ((i=2; i 8 | # Copyright (c) 2002-2006 by Judd Vinet 9 | # Copyright (c) 2005 by Aurelien Foret 10 | # Copyright (c) 2006 by Miklos Vajna 11 | # Copyright (c) 2005 by Christian Hamar 12 | # Copyright (c) 2006 by Alex Smith 13 | # Copyright (c) 2006 by Andras Voroskoi 14 | # 15 | # This program is free software; you can redistribute it and/or modify 16 | # it under the terms of the GNU General Public License as published by 17 | # the Free Software Foundation; either version 2 of the License, or 18 | # (at your option) any later version. 19 | # 20 | # This program is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # You should have received a copy of the GNU General Public License 26 | # along with this program. If not, see . 27 | 28 | # Adapted for splitting debug symbols from ELF 29 | # ~cth451, Jan 20 2021 30 | 31 | abreqexe strip file objcopy install 32 | 33 | elf_iself() 34 | { 35 | file -F $'\n' "$1" | grep -Eq '^ (\w+ (ELF|thin archive|current ar)|(ELF|thin archive|current ar))' 36 | } 37 | 38 | # $1 = path to ELF 39 | # Returns: string formed SHA1 40 | elf_buildid_sha1() 41 | { 42 | file -b "$1" | grep -oP '(?<=BuildID\[sha1\]=)[0-9a-f]+' 43 | } 44 | 45 | # $1 = path to ELF 46 | elf_has_debug() 47 | { 48 | objdump -h "$1" | grep -qP '[0-9]+ +\.debug_' 49 | } 50 | 51 | # $1 = symbol file to install 52 | # $2 = BUILD_ID of this ELF in sha1 53 | # $3 = PKGDIR 54 | # This function may be manually called by 'beyond' for packages that generates their own symbols. 55 | elf_install_symfile() 56 | { 57 | BUILD_ID="$2" 58 | SYM_INSTDIR="$3"/usr/lib/debug/.build-id/${BUILD_ID:0:2} 59 | install -Dm644 -o root -g root "$1" "${SYM_INSTDIR}/${BUILD_ID:2}".debug 60 | } 61 | 62 | # $1 = path to ELF to strip 63 | elf_strip() 64 | { 65 | READELF_OUT="$(readelf -h $1)" 66 | if (($?)); then 67 | # This is probably not an ELF 68 | return 69 | fi 70 | case "${READELF_OUT}" in 71 | *Type:*'DYN'*) 72 | strip --strip-unneeded --remove-section=.comment --remove-section=.note $1 ;; 73 | *Type:*'EXEC (Executable file)'*) 74 | strip --strip-all --remove-section=.comment --remove-section=.note $1 ;; 75 | *Type:*'REL (Relocatable file)'*) 76 | case "$1" in 77 | *.ko) 78 | strip --strip-unneeded --remove-section=.comment --remove-section=.note $1 ;; 79 | *) 80 | strip --strip-debug --enable-deterministic-archives --remove-section=.comment --remove-section=.note $1 ;; 81 | esac ;; 82 | *) 83 | abwarn "Format of $1 is unsupported!" ;; 84 | esac 85 | } 86 | 87 | # $1 = path to original ELF 88 | # $2 = PKGDIR 89 | # Copies symbols of an ELF $1 to $2/usr/lib/debug/.build-id/BU/ILD_ID_OF_ELF_IN_SHA1.debug 90 | elf_copydbg() 91 | { 92 | file -F $'\n' "$1" | grep -Eq '^ (thin archive|current ar)' \ 93 | && abinfo "Skipped $1 as it is a static library." && return 0 94 | READELF_OUT="$(readelf -h $1)" 95 | if (($?)); then 96 | # This is probably not an ELF 97 | return 98 | fi 99 | case "${READELF_OUT}" in 100 | *Type:*'DYN'*) 101 | ;& 102 | *Type:*'EXEC (Executable file)'*) 103 | ;& 104 | *Type:*'REL (Relocatable file)'*) 105 | BUILD_ID=$(elf_buildid_sha1 "$1") 106 | if (( $? )); then 107 | abicu "$1 does not contain a BuildID in SHA1!" 108 | return 1 109 | fi 110 | if ! elf_has_debug "$1"; then 111 | abwarn "Skipped $1 as it does not contain debug symbols." 112 | return 0 113 | fi 114 | TMP_SYMFILE=$(mktemp ab3_elf_sym.XXXXXXXX) 115 | objcopy --only-keep-debug "$1" "${TMP_SYMFILE}" 116 | elf_install_symfile "${TMP_SYMFILE}" "$BUILD_ID" "$2" 117 | rm -f "${TMP_SYMFILE}" 118 | ;; 119 | *) 120 | abwarn "Format of $1 is unsupported!" ;; 121 | esac 122 | } 123 | 124 | -------------------------------------------------------------------------------- /lib/fileenum.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##fileenum.sh: A files.foreach routine that sucks. 3 | ##@copyright GPL-2.0+ 4 | abreqexe find 5 | 6 | # Not sure how to make this suck less. 7 | fileenum_fromstdin() { 8 | local a 9 | while IFS='' read -r a; do 10 | [ "$a" = ":EXIT" ] && return 11 | [ "$a" ] || continue 12 | eval "${1//\{\}/$(argprint $a)}" 13 | done 14 | } 15 | 16 | # Well I can make this one make some sense. 17 | fileenum() { 18 | local IFS=$'\n' a 19 | while IFS='' read -d -r a 20 | do 21 | eval "${1//\{\}/$(argprint $a)}" 22 | done < <(find . -print0) 23 | # find . | fileenum_fromstdin "$@" 24 | } 25 | -------------------------------------------------------------------------------- /lib/pm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##pm.sh: Shared PM Abstraction Functions 3 | ##@copyright GPL-2.0+ 4 | # The great common package manager library for everyone! 5 | # From the wisdom of the ancient, ab2. 6 | # Magic book: ab2:PAKMGR.md 7 | _ab_pm='' # package manager spec variables 8 | # genver -> pkgname[verstr] 9 | _ab_pm+="OP_{EQ,LE,GE} VER_{S,E} " 10 | pm_genver(){ 11 | local store IFS ver name # IFS is also used for holding OP. 12 | : "${OP_EQ== } ${OP_LE=<= } ${OP_GE=>= } ${VER_S= (} ${VER_E=)}" 13 | if ((VER_NONE_ALL)); then # name-only 14 | name="${1/%_}" 15 | echo "${name/[<>=]=*}"; return 16 | elif [[ "$1" =~ [\<\>=]= ]]; then # nameOP[ver] -> name OP_ ver 17 | IFS="$BASH_REMATCH" # split string using each char in OP 18 | read -ra store <<< "$1" 19 | name=${store[0]} ver=${store[2]} # constexpr store[${#IFS}] 20 | IFS=${IFS/==/$OP_EQ} # translate to package manager notation 21 | IFS=${IFS/<=/$OP_LE} 22 | IFS=${IFS/>=/$OP_GE} 23 | elif ((VER_NONE)) || [[ "$1" =~ _$ ]]; then # name{,_} -> name (e.g. conflicts, ..) 24 | echo -n "${1%_}"; return; 25 | else 26 | name=$1 IFS="$OP_GE" # name -> name OP_GE getver 27 | fi 28 | echo -n "$name$VER_S$IFS${ver=$(pm_getver "$1")}$VER_E" 29 | } 30 | # depcom: Turns "$@" into a comma seperated list of deps. 31 | _ab_pm+="PM_{ALT,DELIM,COMMA} VER_NONE " 32 | pm_depcom(){ 33 | : "${PM_ALT=1} ${PM_DELIM= | } ${PM_COMMA=, }" 34 | local IFS='|' dep pkg i cnt=0 # cnt_depcom: dep comma pos 35 | for i; do 36 | read -ra dep <<< "$i" 37 | ABCOMMA="$PM_COMMA" abmkcomma 38 | pm_deparse 39 | done 40 | } 41 | # deparse: turns dep[] into a member of the list. 42 | pm_deparse(){ 43 | local cnt=0 # cnt_deparse: dep delim pos 44 | if (( !PM_ALT && ${#dep[@]}>1 )); then 45 | abwarn "$ABPM doesn't support dependency alternative listing.\n\t" \ 46 | "Using first dependency: $dep." 47 | pm_genver "${dep[0]}"; return; 48 | fi 49 | for pkg in "${dep[@]}"; do 50 | ABCOMMA="$PM_DELIM" abmkcomma 51 | pm_genver "$pkg" 52 | done 53 | } 54 | # flattens "$@" to a simple list of package names, just like an otokonoko's.. 55 | pm_deflat(){ ABPM=dummy VER_NONE_ALL=1 VER_NONE=1 PM_ALT=0 PM_COMMA=' ' PM_DELIM=' ' pm_depcom "$@"; } 56 | # dumpver: dumps a dpkg-ab-lish verstring. 57 | pm_dumpver(){ ((PKGEPOCH)) && echo -n $PKGEPOCH:; echo -n $PKGVER; ((PKGREL)) && echo -n -$PKGREL; } 58 | 59 | declare -gi PKGEPOCH 60 | 61 | . "$AB"/pm/"$ABMPM"/lib.sh 62 | abtrycmd pm_{whoprov,getver,exists,repoupdate,repoinstall,chroot,getver,exists} 63 | -------------------------------------------------------------------------------- /lib/set.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##A simple stringset impl using dicts 3 | ##@copyright CC0 4 | 5 | ## INIT 6 | # create a global set 7 | abset_new(){ declare -gA "$1"; } 8 | # create a local set 9 | alias abset_loc='declare -A' 10 | # helper 11 | alias _abset_AB='declare -n __A="$1" __B="$2"' 12 | 13 | ## PRIMITIVES 14 | # add opts to set (won't complain if already there) 15 | # also handy for `union` (|) 16 | abset_add(){ declare -n __set="$1"; local __idx; for __idx in "${@:1}"; do __set["$__idx"]=1; done; } 17 | # del opts from set (won't complain if not found) 18 | # also handy for `difference` (-) 19 | abset_del(){ declare -n __set="$1"; local __idx; for __idx in "${@:1}"; do unset '__set[$__idx]'; done; } 20 | 21 | ## Set-ish OP 22 | ## Convention: returned values stored in _setRet{set}. 23 | # union (|, +) -- TODO: trivial. 24 | abset_or(){ :; } 25 | # difference (-) -- TODO: trivial. 26 | abset_dif(){ :; } 27 | # symdiff (^) -- TODO: chained ver 28 | abset_xor(){ 29 | _abset_AB 30 | abset_new _setRet 31 | abset_loc __C 32 | abset_add __C "${!__A[@]}" 33 | abset_add _setRet "${!__B[@]}" 34 | abset_del __C "${!__B[@]}" 35 | abset_del _setRet "${!__A[@]}" 36 | abset_add _setRet "${!__C[@]}" 37 | } 38 | # intersection (&) -- TODO: ditto. 39 | abset_and(){ 40 | _abset_AB 41 | abset_loc __C 42 | abset_add __C "${!__A[@]}" "${!__B[@]}" 43 | abset_xor "$1" "$2" 44 | abset_del __C "${!_setRet[@]}" 45 | abset_new _setRet 46 | abset_add _setRet "${!__C[@]}" 47 | } 48 | 49 | ## CMP op 50 | # a == b? 51 | abset_eq(){ 52 | _abset_AB 53 | [[ "${!__A[@]}" == "${!__B[@]}" ]] 54 | } 55 | # a != b? 56 | abset_ne(){ _abset_AB; [[ "${!__A[@]}" != "${!__B[@]}" ]]; } 57 | # a <= b? (subset) 58 | abset_le(){ 59 | _abset_AB 60 | abset_loc __C 61 | abset_add __C "${!__A[@]}" "${!__B[@]}" 62 | [[ "${!__B[@]}" == "${!__C[@]}" ]] 63 | } 64 | # a >= b? 65 | abset_ge(){ abset_le "$2" "$1"; } 66 | # a < b? (true subset) 67 | abset_lt(){ abset_le "$1" "$2" && abset_ne "$1" "$2"; } 68 | # a > b? 69 | abset_gt(){ abset_lt "$2" "$1"; } 70 | 71 | ## MISC 72 | # dump a set into an array (useless) 73 | abset_arr(){ declare -n __set="$1" __Arr="$2"; __Arr=("${!__set[@]}"); } 74 | -------------------------------------------------------------------------------- /lib/tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##Testing framework related functions 3 | 4 | abtest_scanner_extract(){ 5 | local testname="$1" 6 | 7 | if ! . "$SRCDIR/autobuild/tests/${testname}"; then 8 | aberr "Failed to source $SRCDIR/autobuild/tests/${testname}" 9 | exit 1 10 | fi 11 | 12 | if [[ -z "${TESTDES}" ]]; then 13 | abwarn "Test case ${testname} has no description!" 14 | fi 15 | 16 | if [[ -z "${TESTTYPE}" ]]; then 17 | aberr "Test case ${testname} has no TESTTYPE defined!" 18 | exit 1 19 | fi 20 | 21 | if [[ -z "${TESTEXEC}" ]]; then 22 | TESTEXEC=$ABTEST_TESTEXEC 23 | fi 24 | 25 | if [[ "${TESTTYPE}" == "custom" ]]; then 26 | if [[ -z "${ABTEST_CUSTOM_STAGE}" ]]; then 27 | aberr "Custom test case ${testname} has no stage configured!" 28 | exit 1 29 | fi 30 | fi 31 | 32 | local _IFS="$IFS" IFS=$'\n' 33 | local _var 34 | for _var in `cat $AB/sets/testspec_exports`; do 35 | local value=${!_var} 36 | if [[ "${value}" ]]; then 37 | echo "ABTEST_${testname}_${_var}=\"${value}\"" 38 | fi 39 | done 40 | IFS="$_IFS" 41 | } 42 | 43 | abtest_scanner_load(){ 44 | local testname="$1" 45 | local extracted_variables 46 | extracted_variables=$(abtest_scanner_extract ${testname}) 47 | if [[ $? -ne 0 ]]; then 48 | echo "${extracted_variables}" # The error messagees from scanner, acturally 49 | abdie "Test case ${testname} cannot be loaded, exiting ..." 50 | fi 51 | 52 | local _IFS="$IFS" IFS=$'\n' 53 | local varname varvalue 54 | for varentry in ${extracted_variables[@]}; do 55 | eval "${varentry}" 56 | done 57 | IFS="$_IFS" 58 | } 59 | 60 | abtest_run(){ 61 | local stage="$1" 62 | local testname="$2" 63 | 64 | local _testtype="ABTEST_${testname}_TESTTYPE" 65 | 66 | if [[ "${!_testtype}" == "custom" ]]; then 67 | local _testcustomstage="ABTEST_${testname}_CUSTOM_STAGE" 68 | 69 | if [[ "${!_testcustomstage}" != "${stage}" ]]; then 70 | return 0 71 | fi 72 | else 73 | local _testtypestage="ABTESTTYPE_${!_testtype}_STAGE" 74 | if [[ "${!_testtypestage}" != "${stage}" ]]; then 75 | return 0 76 | fi 77 | fi 78 | 79 | abinfo "Running test $testname ..." 80 | local _testexec="ABTEST_${testname}_TESTEXEC" 81 | 82 | case ${!_testexec} in 83 | plain) 84 | pushd "$SRCDIR" > /dev/null 85 | autobuild test $testname 86 | local exitcode=$? 87 | popd > /dev/null 88 | ;; 89 | sdrun) 90 | abinfo "Invoking systemd-run ..." 91 | systemd-run \ 92 | --wait --pipe --service-type=exec \ 93 | --working-directory=${SRCDIR} \ 94 | --setenv="ABTEST_RESULT_OUTPUT" 95 | -- autobuild test $testname 96 | local exitcode=$? 97 | ;; 98 | *) 99 | abdie "Invalid test execution environment for ${testname}!" 100 | esac 101 | 102 | case "$exitcode" in 103 | 1) 104 | if bool $ABTEST_ABORT_BUILD; then 105 | abdie "Test $testname failed, aborting build ..." 106 | fi 107 | aberr "Test $testname failed, but build continues ..." 108 | ABTEST_FAILED="${ABTEST_FAILED} ${testname}" 109 | ;; 110 | 255) 111 | abdie "Test $testname failed with fatal error!" 112 | ;; 113 | *) 114 | abinfo "Test $testname passed." 115 | ;; 116 | esac 117 | } 118 | 119 | abtest_gen_default() { 120 | ABTEST_default_TESTEXEC=$ABTEST_TESTEXEC 121 | ABTEST_default_TESTDES="Automatically generated tests for $ABTYPE" 122 | case $ABTYPE in 123 | rust) 124 | abinfo "Found cargo project, using cargo test as default test ..." 125 | ABTEST_default_TESTTYPE=rust 126 | ABTEST_default_CARGO_TEST_AFTER="$CARGO_TEST_AFTER" 127 | ;; 128 | *) 129 | local checkscript="$(arch_findfile check)" 130 | if [[ -e $checkscript ]]; then 131 | abinfo "Found check script file, using it as default test ..." 132 | ABTEST_default_TESTTYPE=custom 133 | ABTEST_default_CUSTOM_STAGE=$ABTEST_AUTO_DETECT_STAGE 134 | ABTEST_default_CUSTOM_SCRIPT="$SRCDIR/$checkscript" 135 | ABTEST_default_CUSTOM_IS_BASHSCRIPT=yes 136 | else 137 | abwarn "No default test found for $ABTYPE builds" # use ABTEST_AUTO_DETECT=no to suppress this warning 138 | return 1 139 | fi 140 | ;; 141 | esac 142 | } 143 | -------------------------------------------------------------------------------- /pm/dpkg/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # dpkg/install: Defines the install procedure for DPKG 3 | ##@copyright GPL-2.0+ 4 | dpkg $PM_ROOTPARAM -i \ 5 | --auto-deconfigure \ 6 | --force-confnew \ 7 | "${PKGNAME}_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb" \ 8 | || abdie "Failed to install ${PKGNAME}-dbg_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb: $?." 9 | 10 | if bool "$ABSPLITDBG"; then 11 | dpkg $PM_ROOTPARAM -i \ 12 | --auto-deconfigure \ 13 | --force-confnew \ 14 | "${PKGNAME}-dbg_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb" \ 15 | || abdie "Failed to install ${PKGNAME}-dbg_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb: $?." 16 | fi 17 | -------------------------------------------------------------------------------- /pm/dpkg/lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##dpkg/lib.sh: What dpkg should provide to the abstraction as a package manager 3 | ##@copyright GPL-2.0+ 4 | abreqexe dpkg dpkg-deb dpkg-query apt-get 5 | 6 | # $1 is a list of files. Do not quote. 7 | pm_whoprov(){ 8 | dpkg-query --admindir="$PM_ROOT/var/lib/dpkg" -S $1 2> /dev/null | cut -d: -f 1 9 | # This just give a nice list of formatted dependencies. 10 | } 11 | 12 | pm_getver(){ 13 | dpkg-query --admindir="$PM_ROOT/var/lib/dpkg" -f '${Version}' -W "$1" 2>/dev/null 14 | } 15 | 16 | pm_exists(){ 17 | for p in "$@"; do 18 | dpkg $PM_ROOTPARAM -l "$p" | grep ^ii >/dev/null 2>&1 || return 1 19 | done 20 | } 21 | 22 | pm_repoupdate(){ 23 | apt-get update 24 | } 25 | 26 | pm_repoinstall(){ 27 | apt-get install "$@" --yes 28 | } 29 | 30 | pm_chroot(){ 31 | export PM_ROOT="$1" 32 | export PM_ROOTPARAM="--root=$1 --admindir=$1/var/lib/dpkg --force-architecture" 33 | } 34 | -------------------------------------------------------------------------------- /pm/dpkg/pack: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##dpkg/pack: Makes a dpkg package. 3 | ##@copyright GPL-2.0+ 4 | # dpkg field helper. 5 | _ab_pm_func+='dpkgfield dpkgpkgver dpkgctrl ' 6 | dpkgfield(){ echo -ne "$1: "; shift; pm_depcom "$@"; echo; } 7 | dpkgpkgver(){ 8 | ((PKGEPOCH)) && echo -n "$PKGEPOCH": 9 | echo -n "$PKGVER" 10 | if [ "$PKGREL" == 0 ]; then 11 | : 12 | else 13 | echo "-$PKGREL" 14 | fi 15 | } 16 | 17 | dpkgctrl(){ 18 | local arch="${ABHOST%%\/*}" 19 | [[ "$arch" == noarch ]] && arch=all 20 | echo "Package: $PKGNAME" 21 | echo "Version: $(dpkgpkgver)" 22 | echo "Architecture: $arch" 23 | [ "$PKGSEC" ] && echo "Section: $PKGSEC" 24 | echo "Maintainer: $MTER" 25 | echo "Installed-Size: $(du -s ""$PKGDIR"" | cut -f 1)" 26 | echo "Description: $PKGDES" 27 | if ((PKGESS)); then 28 | echo "Essential: yes" 29 | else 30 | echo "Essential: no" 31 | fi 32 | [ "$PKGDEP" ] && dpkgfield Depends $PKGDEP 33 | [ "$PKGPRDEP" ] && dpkgfield Pre-Depends $PKGPRDEP 34 | VER_NONE=1 # We don't autofill versions in optional fields 35 | [ "$PKGRECOM" ] && dpkgfield Recommends $PKGRECOM 36 | [ "$PKGREP" ] && dpkgfield Replaces $PKGREP 37 | [ "$PKGCONFL" ] && dpkgfield Conflicts $PKGCONFL 38 | [ "$PKGPROV" ] && VER_NONE=1 dpkgfield Provides $PKGPROV 39 | [ "$PKGSUG" ] && dpkgfield Suggests $PKGSUG 40 | [ "$PKGBREAK" ] && dpkgfield Breaks $PKGBREAK 41 | if [ -e "$SRCDIR"/autobuild/extra-dpkg-control ]; then 42 | cat "$SRCDIR"/autobuild/extra-dpkg-control 43 | fi 44 | # Record last packager in control, we will switch to another variable 45 | # name for this field to differentiate between maintainers and 46 | # packagers for specific packages. 47 | echo "X-AOSC-Packager: $MTER" 48 | if dpkg -l autobuild3 >/dev/null 2>&1; then 49 | echo "X-AOSC-Autobuild3-Version: $(dpkg-query -f '${Version}' -W autobuild3)" 50 | fi 51 | if bool $NOTEST; then 52 | echo "X-AOSC-Autobuild3-Testing: disabled" 53 | else 54 | if [[ -n $ABTESTS ]]; then 55 | # Redundant `echo' trims extra whitespaces 56 | echo "X-AOSC-Autobuild3-Testing: $(echo $ABTESTS)" 57 | else 58 | echo "X-AOSC-Autobuild3-Testing: none" 59 | fi 60 | if [[ -n $ABTEST_FAILED ]]; then 61 | echo "X-AOSC-Autobuild3-Testing-Failed: $(echo $ABTEST_FAILED)" 62 | fi 63 | if [[ -e $ABTEST_RESULT_OUTPUT ]]; then 64 | cat $ABTEST_RESULT_OUTPUT 65 | fi 66 | fi 67 | echo "$DPKGXTRACTRL" 68 | } 69 | 70 | dpkgctrl_dbg_sym() { 71 | local arch="${ABHOST%%\/*}" 72 | [[ "$arch" == noarch ]] && arch=all 73 | echo "Package: $PKGNAME-dbg" 74 | echo "Version: $(dpkgpkgver)" 75 | echo "Architecture: $arch" 76 | echo "Section: debug" 77 | echo "Maintainer: $MTER" 78 | echo "Installed-Size: $(du -s $SYMDIR | cut -f 1)" 79 | echo "Description: Debug symbols for $PKGNAME" 80 | echo "Depends: ${PKGNAME} (=$(dpkgpkgver))" 81 | # Record last packager in control, we will switch to another variable 82 | # name for this field to differentiate between maintainers and 83 | # packagers for specific packages. 84 | echo "X-AOSC-Packager: $MTER" 85 | if dpkg -l autobuild3 >/dev/null 2>&1; then 86 | echo "X-AOSC-Autobuild3-Version: $(dpkg-query -f '${Version}' -W autobuild3)" 87 | fi 88 | echo "$DPKGXTRACTRL" 89 | } 90 | 91 | # Auto-select xz level, use lower compression level on "Retro" architectures. 92 | if ab_match_archgroup retro; then 93 | DPKGDEBCOMP+="-Zxz -z3 --threads-max=1" 94 | # Only 2GiB of user-addressable memory. 95 | elif ab_match_arch mips32r6el; then 96 | DPKGDEBCOMP+="-Zxz -z6 --threads-max=1" 97 | # Buggy NUMA implementation on SG2042? Causes dead locks. 98 | elif ab_match_arch riscv64; then 99 | DPKGDEBCOMP+="-Zxz -z6 --threads-max=1" 100 | else 101 | DPKGDEBCOMP+="-Zxz -z6" 102 | fi 103 | 104 | instSIZE=$(du -s "$PKGDIR" | cut -f 1) 105 | 106 | mkdir -p "$PKGDIR"/DEBIAN \ 107 | || abdie "Failed to create DEBIAN directory for .deb metadata: $?." 108 | cp -rl "$SRCDIR"/abscripts/* "$PKGDIR"/DEBIAN \ 109 | || abdie "Failed to copy .deb scripts: $?." 110 | # Do not handle conffiles in stage2. 111 | if ! bool $ABSTAGE2; then 112 | if [ -e "$SRCDIR/autobuild/$ARCH/conffiles" ]; then 113 | cp -l "$SRCDIR"/autobuild/"$ARCH"/conffiles "$PKGDIR"/DEBIAN 2>/dev/null \ 114 | || abdie "Failed to copy conffiles: $?." 115 | elif [ -e "$SRCDIR/autobuild/conffiles" ]; then 116 | cp -l "$SRCDIR"/autobuild/conffiles "$PKGDIR"/DEBIAN 2>/dev/null \ 117 | || abdie "Failed to copy conffiles: $?." 118 | fi 119 | fi 120 | if [ -e "$SRCDIR/autobuild/triggers" ]; then 121 | cp -l "$SRCDIR"/autobuild/triggers "$PKGDIR"/DEBIAN 2>/dev/null \ 122 | || abdie "Failed to copy triggers: $?." 123 | fi 124 | dpkgctrl > "$PKGDIR"/DEBIAN/control \ 125 | || abdie "Failed to generate .deb control metadata: $?." 126 | dpkg-deb $DPKGDEBCOMP -b "$PKGDIR" "${PKGNAME}_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb" \ 127 | || abdie "Failed to package .deb package: $?." 128 | mv "$PKGDIR"/DEBIAN "$SRCDIR"/ab-dpkg 129 | 130 | if bool "$ABSPLITDBG"; then 131 | # Check whether there are any symbol files getting genereted 132 | if [[ -d "${SYMDIR}" ]] && [ "$(ls -A $SYMDIR)" ]; then 133 | # Actually pack them 134 | mkdir -p "$SYMDIR"/DEBIAN \ 135 | || abdie "Failed to create DEBIAN directory for -dbg .deb metadata: $?." 136 | dpkgctrl_dbg_sym > "$SYMDIR"/DEBIAN/control \ 137 | || abdie "Failed to generate -dbg .deb control metadata: $?." 138 | dpkg-deb $DPKGDEBCOMP -b "$SYMDIR" "${PKGNAME}-dbg_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb" \ 139 | || abdie "Failed to build debug .deb package: $?." 140 | export ABPACKAGE+="${PKGNAME}-dbg_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb " 141 | else 142 | abdie "ABSPLITDBG is set, but we can't find any symbol files." 143 | abdie "Cannot build symbol package." 144 | ABSPLITDBG=0 145 | fi 146 | fi 147 | 148 | export ABPACKAGE+="${PKGNAME}_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb " 149 | -------------------------------------------------------------------------------- /proc/00-python_defines.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##python_defines: Dynamic Python version declaration for installation scripts 3 | ##@copyright GPL-2.0+ 4 | export ABPY2VER="$(python2 -c 'import sys; print("%s.%s" %sys.version_info[0:2])')" 5 | export ABPY2SHORTVER="$(python2 -c 'import sys; print("%s%s" %sys.version_info[0:2])')" 6 | export ABPY3VER="$(python3 -c 'import sys; print("%s.%s" %sys.version_info[0:2])')" 7 | export ABPY3SHORTVER="$(python3 -c 'import sys; print("%s%s" %sys.version_info[0:2])')" 8 | -------------------------------------------------------------------------------- /proc/10-core_defines.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##defines: First we need the defines 3 | ##@copyright GPL-2.0+ 4 | # TODO: we may have to split this file. PKG/SRCDIR defs should be in ab3.sh. 5 | export SRCDIR="$PWD" 6 | export BLDDIR="$SRCDIR/abbuild" 7 | export PKGDIR="$SRCDIR/abdist" 8 | export SYMDIR="$SRCDIR/abdist-dbg" 9 | 10 | BUILD_START(){ true; } 11 | BUILD_READY(){ true; } 12 | BUILD_FINAL(){ true; } 13 | 14 | # Autobuild settings 15 | . "$AB"/etc/autobuild/ab3_defcfg.sh 16 | 17 | abrequire arch 18 | . "$AB/arch/_common.sh" 19 | . "$AB/arch/${ABHOST//\//_}.sh" # Also load overlay configuration. 20 | BUILD=${ARCH_TARGET["$ABBUILD"]} 21 | HOST=${ARCH_TARGET["$ABHOST"]} 22 | 23 | if ! bool $ABSTAGE2; then 24 | _arch_trymore=1 arch_loadfiles defines || \ 25 | abdie "Failed to source defines file: $?." 26 | else 27 | abwarn "ABSTAGE2 returned true, loading stage2 defines ..." 28 | if arch_findfile defines.stage2; then 29 | _arch_trymore=1 arch_loadfiles defines.stage2 || \ 30 | abdie "Failed to source stage2 defines file: $?." 31 | else 32 | abwarn "Unable to find stage2 defines, falling back to normal defines ..." 33 | _arch_trymore=1 arch_loadfiles defines || \ 34 | abdie "Failed to source defines file: $?." 35 | fi 36 | fi 37 | [[ ${ABHOST%%\/*} != $FAIL_ARCH ]] || 38 | abdie "This package cannot be built for $FAIL_ARCH, e.g. $ABHOST." 39 | 40 | if ! bool $ABSTRIP && bool $ABSPLITDBG; then 41 | abwarn "QA: ELF stripping is turned OFF." 42 | abwarn " Won't package debug symbols as they are shipped in ELF themselves." 43 | ABSPLITDBG=0 44 | fi 45 | 46 | if [[ $ABHOST == noarch ]]; then 47 | abinfo "Architecture-agnostic (noarch) package detected, disabling -dbg package split ..." 48 | ABSPLITDBG=0 49 | fi 50 | 51 | arch_initcross 52 | # PKGREL Parameter, pkg and rpm friendly 53 | # Test used for those who wants to override. 54 | # TODO foreport verlint 55 | # TODO verlint backwriting when ((!PROGDEFINE)). 56 | # TODO automate $PKG* namespace and remove abbs `spec` 57 | if [ ! "$PKGREL" ]; then 58 | PKGVER=$(echo $PKGVER| rev | cut -d - -f 2- | rev) 59 | PKGREL=$(echo $PKGVER | rev | cut -d - -f 1 | rev) 60 | if [ "$PKGREL" == "$PKGVER" ] || [ ! "$PKGREL" ]; then PKGREL=0; fi; 61 | fi 62 | 63 | # Programmable modules should be put here. 64 | arch_loadfile functions 65 | 66 | export `cat $AB/exportvars/*` 67 | 68 | export PYTHON=/usr/bin/python2 69 | -------------------------------------------------------------------------------- /proc/10-env-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##10-env-setup: Setting up common environmental variables 3 | ##@copyright GPL-2.0+ 4 | 5 | abinfo 'Setting $SHELL to /bin/bash ...' 6 | export SHELL="/bin/bash" 7 | 8 | abinfo 'Setting $HOME to /root ...' 9 | export HOME="/root" 10 | 11 | if [ -e /usr/lib/hook_uname.so ]; then 12 | abinfo 'hook_uname.so detected, preloading ...' 13 | export LD_PRELOAD="/usr/lib/hook_uname.so:$LD_PRELOAD" 14 | fi 15 | 16 | abinfo 'Setting $TZ (default timezone) ...' 17 | export TZ=UTC 18 | -------------------------------------------------------------------------------- /proc/10-qa_pre_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##qa_pre_build: Execute pre-build QA modules. 3 | ##@copyright GPL-2.0+ 4 | if bool $ABQA; then 5 | abinfo "Running pre-build QA tests ..." 6 | for i in "$AB"/qa/pre/*; do 7 | . "$i" 8 | done 9 | fi 10 | 11 | if [ -s "$SRCDIR"/abqawarn.log ]; then 12 | abwarn "QA warning(s) found, please refer to abqawarn.log ..." 13 | fi 14 | 15 | if [ -s "$SRCDIR"/abqaerr.log ]; then 16 | abdie "QA error(s) found, please refer to abqaerr.log ..." 17 | fi 18 | -------------------------------------------------------------------------------- /proc/10-tests_scan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/tests_pre: scan for tests in $ABTESTS and construct $TESTDEP 3 | ##@copyright GPL-2.0+ 4 | 5 | if bool $NOTEST; then 6 | ABTESTS="" 7 | TESTDEP="" # Empty TESTDEPS by explicitly override it 8 | ABTEST_AUTO_DETECT=no 9 | else 10 | abrequire tests 11 | export ABTEST_RESULT_OUTPUT="$SRCDIR/abtestoutput.txt" 12 | echo -n "" > "$ABTEST_RESULT_OUTPUT" 13 | fi 14 | 15 | if [[ -n "$ABTESTS" ]]; then 16 | _IFS="$IFS" IFS=$' ' 17 | for test in $ABTESTS; do 18 | abtest_scanner_load "$test" 19 | 20 | local _testdep="ABTEST_${test}_TESTDEP" 21 | local _testtype="ABTEST_${test}_TESTTYPE" 22 | local _testtypedep="ABTESTTYPE_${!_testtype}_DEP" 23 | TESTDEP="${TESTDEP} ${!_testdep} ${!_testtypedep}" 24 | done 25 | IFS="$_IFS" 26 | unset _IFS 27 | fi 28 | -------------------------------------------------------------------------------- /proc/11-cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/cleanup: We always want our butt free of old build output 3 | ##@copyright GPL-2.0+ 4 | # Clean up! 5 | 6 | # TODO: Different build type specific clean up. 7 | 8 | if bool "$ABCLEAN"; then 9 | abinfo "Pre-build clean up..." 10 | rm -rf "$SRCDIR"/ab{dist,dist-dbg,-dpkg,spec,scripts} 11 | else 12 | abinfo "Moving away ab stuff.." 13 | t="$(date -u +%s)_$RANDOM" 14 | mkdir -p "$SRCDIR/_ab_backs/$t" 15 | mv "$SRCDIR"/ab{dist,dist-dbg,-dpkg,spec,scripts} "$SRCDIR/_ab_backs/$t" 16 | unset t 17 | fi 18 | -------------------------------------------------------------------------------- /proc/11-pm_deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/deps: We want to install the dependencies 3 | ##@copyright GPL-2.0+ 4 | abrequire pm 5 | 6 | # FIXME: The flat stuff gets stupid with 'foo | bar' packs. Guess why. 7 | if bool $ABBUILDDEPONLY; then 8 | if ! bool $VER_NONE; then 9 | abdie "ABBUILDDEPONLY must be used with VER_NONE=1 (dependency version-agnostic). Aborting." 10 | fi 11 | FLATDEP="$(pm_deflat $BUILDDEP)" 12 | else 13 | FLATDEP="$(pm_deflat $PKGDEP $BUILDDEP $PKGPRDEP $TESTDEP)" 14 | fi 15 | 16 | if ! pm_exists $FLATDEP; then 17 | abinfo "Build or runtime dependencies not satisfied, now fetching needed packages." 18 | pm_repoupdate 19 | pm_repoinstall $FLATDEP || abdie "Cannot install needed dependencies." 20 | fi 21 | unset FLATDEP 22 | -------------------------------------------------------------------------------- /proc/11-preproc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/preproc: pre-process "$SRCDIR" for packaging. 3 | ##@copyright GPL-2.0+ 4 | 5 | if (( EUID == 0 )); then 6 | abinfo 'Fixing up ownership in $SRCDIR ...' 7 | chown -R 0:0 "$SRCDIR" \ 8 | || echo "Cannot change source ownership to root:root: $?." 9 | 10 | abinfo 'Removing SGID bit from $SRCDIR ...' 11 | chmod a-s "$SRCDIR" \ 12 | || echo "Failed to remove SGID bit: $?." 13 | fi 14 | 15 | -------------------------------------------------------------------------------- /proc/12-arch_compiler.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/compiler: A weird and broken way to select the compilers 3 | ##@copyright GPL-2.0+ 4 | 5 | # Wrapper TODO: accept $0 detection by checking ${HOSTTOOLPREFIX/abcross/abwrap}. 6 | if [[ "$ABBUILD" == "$ABHOST" ]]; then 7 | if [ -d /opt/pseudo-multilib/bin ]; then 8 | export PATH="/opt/pseudo-multilib/bin:$PATH" 9 | else 10 | if bool "$USECLANG"; then 11 | export CC=clang CXX=clang++ OBJC=clang OBJCXX=clang++ 12 | else 13 | # gcc should work for objc too. hmm? 14 | export CC=gcc CXX=g++ OBJC=clang OBJCXX=clang++ 15 | fi 16 | fi 17 | fi 18 | -------------------------------------------------------------------------------- /proc/12-arch_flags.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/flags: makes *FLAGS from arch/ 3 | ##@copyright GPL-2.0+ 4 | 5 | ABCC="$(basename "$CC")" 6 | ABCC="${ABCC%%-*}" 7 | ABCC="${ABCC^^}" 8 | 9 | . "$AB/arch/_common_switches.sh" 10 | 11 | if [[ "$ABBUILD" != "$ABHOST" ]]; then 12 | AB_FLAGS_TYPES+="_CROSS _CROSS_$ABBUILD " 13 | fi 14 | 15 | # The suffix get forked in multiple ways, basically FLAG_(COMPILER|COMMON)[_TYPE][_(NO)FEATURE]. 16 | AB_FLAGS_FEATURES_DEF="$( 17 | for f in $AB_FLAGS_FEATURES; do 18 | t="${f##NO_}" f="$t" def="${def%%$t}" v=1 19 | echo -n _ 20 | u="USE$f" n="NO$f" 21 | if ((n)); then 22 | echo -n NO 23 | elif ((u)); then 24 | : # do nothing 25 | else 26 | echo -n $def # default 27 | fi 28 | echo -n "$f " 29 | done 30 | )" # 'NOPONY NOCLA LTO GOTHIC' + ((USEPONY)) ((NOLTO)) -> '_PONY _NOCLA _NOLTO _GOTHIC' 31 | _flags_weird_buf=() 32 | _flags_current_i=0 33 | for ABFLAG in {LD,C{,PP,XX},OBJC{,XX},RUST}FLAGS; do 34 | export $ABFLAG 35 | declare -n FLAG="$ABFLAG" 36 | for ABFLAGCC in COMMON $ABCC; do 37 | for ABFLAGTYPE in '' $AB_FLAGS_TYPES; do 38 | for ABFLAGFEATURE in '' $AB_FLAGS_FEATURES_DEF; do 39 | THISFLAG="${ABFLAG}_$ABFLAGCC$ABFLAGTYPE$ABFLAGFEATURE" 40 | if [[ "$ABFLAGTYPE" == _WEIRD ]]; then 41 | _flags_weird_buf[_flags_current_i]+=" ${!THISFLAG}" 42 | else 43 | FLAG+=" ${!THISFLAG}" 44 | fi 45 | done 46 | done 47 | done 48 | unset -n FLAG THISFLAG 49 | unset ABFLAG{,CC,TYPE,FEATURE} 50 | ((_flags_current_i++)) 51 | done 52 | _flags_current_i=0 53 | CXXFLAGS="$CFLAGS $CXXFLAGS" 54 | OBJCFLAGS="$CFLAGS $OBJCFLAGS" 55 | OBJCXXFLAGS="$OBJCFLAGS $CXXFLAGS" 56 | for ABFLAG in {LD,C{,PP,XX},OBJC{,XX},RUST}FLAGS; do 57 | declare -n FLAG="$ABFLAG"; 58 | FLAG+="${_flags_weird_buf[_flags_current_i]}"; ((_flags_current_i++)); 59 | unset -n FLAG; 60 | ab_trim_args "$ABFLAG"; 61 | done 62 | unset ABCC _flags_current_i 63 | -------------------------------------------------------------------------------- /proc/12-parallel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/parallel: controls parallelism 3 | ##@copyright GPL-2.0+ 4 | 5 | if bool "$NOPARALLEL"; then 6 | abwarn "Parallel build DISABLED, get a cup of coffee, now!" 7 | export MAKEFLAGS+=" -j1 " 8 | else 9 | abinfo "Parallel build ENABLED" 10 | export MAKEFLAGS+=" -j$ABTHREADS " 11 | fi 12 | -------------------------------------------------------------------------------- /proc/20-build_funcs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/build_funcs: Loads the build/ functions 3 | ##@copyright GPL-2.0+ 4 | for i in "$AB/build"/*.sh 5 | do 6 | . "$i" 7 | done 8 | -------------------------------------------------------------------------------- /proc/30-build_probe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/build_probe: Guess the build type 3 | ##@copyright GPL-2.0+ 4 | if [ -z "$ABTYPE" ]; then 5 | for i in $ABBUILDS; do 6 | # build are all plugins now. 7 | if build_${i}_probe; then 8 | export ABTYPE=$i 9 | break 10 | fi 11 | done 12 | fi 13 | 14 | if [ -z "$ABTYPE" ]; then 15 | abdie "Cannot determine build type." 16 | fi 17 | -------------------------------------------------------------------------------- /proc/31-tests_probe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #proc/tests_probe.sh: probe and generate default tests 3 | 4 | if bool $ABTEST_AUTO_DETECT; then 5 | abtest_gen_default 6 | if [[ $? -eq 0 ]]; then 7 | ABTESTS="$ABTESTS default" 8 | fi 9 | fi 10 | 11 | if ! bool $NOTEST; then 12 | abinfo "Currently enabled tests are: $ABTESTS" 13 | fi 14 | -------------------------------------------------------------------------------- /proc/35-build_env_src.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/build_env_src: Source build environment definition scripts. 3 | ##@copyright GPL-2.0+ 4 | for i in /etc/profile.d/*.sh; do 5 | abinfo "Sourcing environment definition script $i ..." 6 | # FIXME: A quirk for 30-nvm.sh, which mysteriously fails as Autobuild3 sources it. 7 | if [[ "$i" != "/etc/profile.d/30-nvm.sh" ]]; then 8 | source "$i" || abdie "Error sourcing environment definition: $i." 9 | else 10 | abwarn "FIXME: Ignoring errors for $i ..." 11 | source "$i" || true 12 | fi 13 | done 14 | -------------------------------------------------------------------------------- /proc/36-ld_switch.patch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/ld_switch: Switch to classic (BFD) GNU Linker if specified. 3 | ##@copyright GPL-2.0+ 4 | if bool AB_LD_BFD; then 5 | abinfo "Swaping out Gold Linker as specified..." 6 | ln -sv /usr/bin/ld.bfd "$SRCDIR"/ld 7 | fi 8 | -------------------------------------------------------------------------------- /proc/40-patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/patch: Loads the build/ functions 3 | ##@copyright GPL-2.0+ 4 | abrequire arch 5 | 6 | if [ ! -f "$SRCDIR"/.patch ]; then 7 | if [ -f "$SRCDIR"/autobuild/patch ]; then 8 | arch_loadfile_strict patch 9 | touch "$SRCDIR"/.patch 10 | elif [ -f "$SRCDIR"/autobuild/patch ] && bool $ABSTAGE2; then 11 | if arch_loadfile_strict patch.stage2; then 12 | abwarn "ABSTAGE2 returned true, running stage2 patch script ..." 13 | arch_loadfile_strict patch.stage2 14 | elif arch_loadfile_strict patch; then 15 | abwarn "ABSTAGE2 returned true, running stage2 patch script ..." 16 | abwarn "Could not find self-defined stage patch script, failling back to main patch script ..." 17 | arch_loadfile_strict patch 18 | else 19 | true 20 | fi 21 | touch "$SRCDIR"/.patch 22 | elif [ -f "$SRCDIR"/autobuild/patches/series ]; then 23 | ab_apply_patches \ 24 | $(grep -v '^$\|^#' autobuild/patches/series | sed "s@^@$SRCDIR/autobuild/patches/@") 25 | touch "$SRCDIR"/.patch 26 | elif [ -d "$SRCDIR"/autobuild/patches ]; then 27 | ab_apply_patches \ 28 | "$SRCDIR"/autobuild/patches/*.{patch,diff} \ 29 | "$SRCDIR"/autobuild/patches/*.{patch,diff}."${CROSS:-$ARCH}" 30 | ab_reverse_patches \ 31 | "$SRCDIR"/autobuild/patches/*.r{patch,diff} \ 32 | "$SRCDIR"/autobuild/patches/*.r{patch,diff}."${CROSS:-$ARCH}" 33 | touch "$SRCDIR"/.patch 34 | fi 35 | fi 36 | 37 | cd "$SRCDIR" 38 | -------------------------------------------------------------------------------- /proc/50-build_exec.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/build_do: So we build it now 3 | ##@copyright GPL-2.0+ 4 | 5 | if ! bool $ABSTAGE2; then 6 | arch_loadfile_strict prepare 7 | else 8 | if arch_findfile prepare.stage2; then 9 | abwarn "ABSTAGE2 returned true, running stage2 prepare script ..." 10 | arch_loadfile_strict prepare.stage2 11 | elif arch_findfile prepare; then 12 | abwarn "ABSTAGE2 returned true, running stage2 prepare script ..." 13 | abwarn "Could not find stage2 prepare script, falling back to normal prepare script ..." 14 | arch_loadfile_strict prepare 15 | else 16 | true 17 | fi 18 | fi 19 | 20 | cd "$SRCDIR" 21 | 22 | for build_func in build_{start,ready,final}; do 23 | abcmdstub "$build_func" 24 | alias "${build_func^^}=_ret=\$PIPESTATUS 25 | if ((_ret)); then 26 | bool \$ABSHADOW && cd .. 27 | return \$_ret 28 | fi 29 | echo $build_func | ablog 30 | $build_func || abwarn '$build_func: \$?' 31 | for _quirk in \$PKGQUIRKS; do 32 | if [[ \$_quirk == */* ]]; then 33 | [[ \$_quirk == ${build_func/#build_}/* ]] || continue 34 | else 35 | _quirk=${build_func/#build_}/\$_quirk 36 | fi 37 | if [ -e \"\$AB/quirks/\$_quirk\" ]; then 38 | . \"\$AB/quirks/\$_quirk\" 39 | fi 40 | done" 41 | done 42 | 43 | build_${ABTYPE}_build || abdie "Build failed: $?." 44 | 45 | cd "$SRCDIR" || abdie "Unable to cd $SRCDIR: $?." 46 | 47 | [ -d "$PKGDIR" ] || abdie "50-build: Suspecting build failure due to missing PKGDIR." 48 | 49 | if ! bool $ABSTAGE2; then 50 | arch_loadfile_strict beyond 51 | else 52 | if arch_findfile beyond.stage2; then 53 | abwarn "ABSTAGE2 returned true, running stage2 beyond script ..." 54 | arch_loadfile_strict beyond.stage2 55 | elif arch_findfile beyond; then 56 | abwarn "ABSTAGE2 returned true, running stage2 beyond script ..." 57 | abwarn "Could not find stage2 beyond script, falling back to normal beyond script ..." 58 | arch_loadfile_strict beyond 59 | else 60 | true 61 | fi 62 | fi 63 | 64 | cd "$SRCDIR" || abdie "Unable to cd $SRCDIR: $?." 65 | 66 | if [ -d "$(arch_findfile overrides)" ] ; then 67 | abinfo "Deploying files in overrides ..." 68 | cp -arv "$(arch_findfile overrides)"/* "$PKGDIR/" || \ 69 | abdie "Failed to deploy files in overrides: $?." 70 | fi 71 | 72 | cd "$SRCDIR" || abdie "Unable to cd $SRCDIR: $?." 73 | 74 | unalias BUILD_{START,READY,FINAL} 75 | -------------------------------------------------------------------------------- /proc/51-filter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/filter.sh: Now we run the filters 3 | ##@copyright GPL-2.0+ 4 | recsr $AB/filter/*.sh 5 | 6 | pushd $PKGDIR > /dev/null || return 7 | 8 | for ii in $ABFILTERS; do 9 | abinfo "Running post-build filter: $ii ..." 10 | filter_$ii 11 | done 12 | 13 | popd > /dev/null 14 | -------------------------------------------------------------------------------- /proc/51-tests_post_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/tests_post_build: run tests at post build stage 3 | ##@copyright GPL-2.0+ 4 | 5 | for testcase in $ABTESTS; do 6 | abtest_run post-build "${testcase}" 7 | done 8 | 9 | unset testcase 10 | -------------------------------------------------------------------------------- /proc/60-licenses.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/licenses.sh: SPDX-compatible license processing. 3 | ##@copyright GPL-2.0+ 4 | # _license_atom: _license [ " WITH " _exception ] 5 | # TODO: Multiple exceptions, Unknown exceptions 6 | 7 | _license_files=( {COPYING,LICENSE,LICENCE}* ) 8 | 9 | mkdir -p "$PKGDIR/usr/share/doc/$PKGNAME" 10 | if ((${#_license_files[@]})); then 11 | cp -L -r --no-preserve=mode "${_license_files[@]}" "$PKGDIR/usr/share/doc/$PKGNAME" 12 | else 13 | abwarn "This package does not contain a COPYING or LICENCE file!" 14 | fi 15 | -------------------------------------------------------------------------------- /proc/61-conffiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/conffiles.sh: Generate conffiles if not already written 3 | ##@copyright GPL-2.0+ 4 | 5 | # Do not process conffiles in stage2 mode. 6 | if ! bool $ABSTAGE2; then 7 | # Generate a cached conffiles. 8 | find "$PKGDIR"/etc -type f -printf '/etc/%P\n' 2>/dev/null \ 9 | | sort > "$SRCDIR"/conffiles.ab 10 | 11 | if [[ -d "$PKGDIR"/etc && ! -e "$SRCDIR"/autobuild/conffiles ]]; then 12 | abwarn 'Detected /etc in $PKGDIR, but autobuild/conffiles is not found - attempting generation ...' 13 | abinfo 'Appending the following to autobuild/conffiles ...' 14 | cat "$SRCDIR"/conffiles.ab \ 15 | 2>&1 | sort | tee "$SRCDIR"/autobuild/conffiles 16 | elif [[ -e "$SRCDIR"/autobuild/conffiles ]]; then 17 | if ! diff "$SRCDIR"/conffiles.ab <(sort "$SRCDIR"/autobuild/conffiles) >/dev/null 2>&1; then 18 | abinfo 'Found autobuild/conffiles - good job! Content as follows ...' 19 | cat "$SRCDIR"/autobuild/conffiles | sort 20 | abwarn 'However, there seems to be more/less files found in $PKGDIR/etc ...' 21 | abwarn 'Please compare the following list of files against the current autobuild/conffiles ...' 22 | cat "$SRCDIR"/conffiles.ab 23 | else 24 | abinfo 'Found autobuild/conffiles - all good!' 25 | fi 26 | fi 27 | fi 28 | -------------------------------------------------------------------------------- /proc/70-scripts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/scripts: Silly way to deal with scripts 3 | ##@copyright GPL-2.0+ 4 | mkdir -p abscripts 5 | 6 | for i in postinst prerm postrm preinst; do 7 | abinfo "Generating and installing package management scripts ..." 8 | echo "#!/bin/bash" > abscripts/$i 9 | cat autobuild/$i >> abscripts/$i 2>/dev/null || abinfo "Creating empty $i." 10 | chmod 755 abscripts/$i 11 | done 12 | 13 | if [ -f "$SRCDIR"/autobuild/templates ]; then 14 | abinfo "Installing Debconf templates ..." 15 | cp -v "$SRCDIR"/autobuild/templates \ 16 | abscripts/templates 17 | fi 18 | 19 | recsr "$AB/scriptlet"/*.sh 20 | -------------------------------------------------------------------------------- /proc/75-qa_post_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##qa_post_build: Execute post-build QA modules. 3 | ##@copyright GPL-2.0+ 4 | if bool $ABQA; then 5 | abinfo "Running post-build QA tests ..." 6 | for i in "$AB"/qa/post/*; do 7 | . "$i" 8 | done 9 | fi 10 | 11 | if [ -s "$SRCDIR"/abqawarn.log ]; then 12 | abwarn "QA warning(s) found, please refer to abqawarn.log ..." 13 | fi 14 | 15 | if [ -s "$SRCDIR"/abqaerr.log ]; then 16 | abdie "QA error(s) found, please refer to abqaerr.log ..." 17 | fi 18 | -------------------------------------------------------------------------------- /proc/80-pm_pack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/pack: packs the package. 3 | ##@copyright GPL-2.0+ 4 | for i in $ABMPM $ABAPMS; do 5 | abinfo "Building $i package(s) ..." 6 | . "$AB"/pm/"$i"/pack || aberr $i packing returned $?. 7 | done 8 | -------------------------------------------------------------------------------- /proc/90-pm_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/install: installs the built package 3 | ##@copyright GPL-2.0+ 4 | # ABINSTALL no longer will be fed with boolean. 5 | # Put in PMs instead. 6 | for i in $ABINSTALL; do 7 | abinfo "Installing $i package(s) ..." 8 | . "$AB"/pm/"$i"/install || abdie "$i install returned $?." 9 | done 10 | -------------------------------------------------------------------------------- /proc/92-tests_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/tests_post_install: run tests at post install stage 3 | ##@copyright GPL-2.0+ 4 | 5 | for testcase in $ABTESTS; do 6 | abtest_run post-install "${testcase}" 7 | done 8 | 9 | unset testcase 10 | -------------------------------------------------------------------------------- /proc/99-pm_archive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##proc/archive: archives the package. 3 | ##@copyright GPL-2.0+ 4 | if [ "$ABARCHIVE" ]; then 5 | abinfo "Archiving package(s) ..." 6 | abinfo "Using $ABARCHIVE as autobuild archiver ..." 7 | $ABARCHIVE "$PKGNAME" "$PKGVER" "$PKGREL" "$ABHOST" 8 | # FIXME: should consult ABPACKAGE for the actual list of package to copy. 9 | # ~cth 10 | if bool $ABSPLITDBG; then 11 | $ABARCHIVE "$PKGNAME"-dbg "$PKGVER" "$PKGREL" "$ABHOST" 12 | fi 13 | else 14 | abinfo "Not using an archiver, skipping ..." 15 | fi 16 | -------------------------------------------------------------------------------- /qa/post/lingering_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##lingering_files: Check for lingering files. 3 | ##@copyright GPL-2.0+ 4 | FILES="$(find "$PKGDIR" "$PKGDIR/usr/" "$PKGDIR/usr/share/" -maxdepth 1 -type f -print 2>/dev/null)" 5 | if [ ! -z "$FILES" ]; then 6 | aberr "QA (E321): Lingering file(s) found (incorrect install location?):\n\n${FILES}\n" | \ 7 | tee -a "$SRCDIR"/abqaerr.log 8 | fi 9 | -------------------------------------------------------------------------------- /qa/post/path_issues.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##path_issues: Check for incorrectly installed paths. 3 | ##@copyright GPL-2.0+ 4 | 5 | for i in \ 6 | bin sbin lib lib64 usr/sbin usr/lib64 \ 7 | usr/local usr/man usr/doc usr/etc usr/var; do 8 | if [ -e "$PKGDIR"/${i} ]; then 9 | aberr "QA (E321): Found known bad path in package:\n\n${i}\n" | \ 10 | tee -a "$SRCDIR"/abqaerr.log 11 | exit 1 12 | fi 13 | done 14 | 15 | ACCEPTABLE=" 16 | "$PKGDIR"/boot 17 | "$PKGDIR"/dev 18 | "$PKGDIR"/efi 19 | "$PKGDIR"/etc 20 | "$PKGDIR"/home 21 | "$PKGDIR"/media 22 | "$PKGDIR"/mnt 23 | "$PKGDIR"/opt 24 | "$PKGDIR"/proc 25 | "$PKGDIR"/root 26 | "$PKGDIR"/run 27 | "$PKGDIR"/snap 28 | "$PKGDIR"/snapd 29 | "$PKGDIR"/srv 30 | "$PKGDIR"/sys 31 | "$PKGDIR"/tmp 32 | "$PKGDIR"/usr 33 | "$PKGDIR"/var 34 | " 35 | ACCEPTABLE2=" 36 | "$PKGDIR"/usr/bin 37 | "$PKGDIR"/usr/include 38 | "$PKGDIR"/usr/gnemul 39 | "$PKGDIR"/usr/lib 40 | "$PKGDIR"/usr/libexec 41 | "$PKGDIR"/usr/local 42 | "$PKGDIR"/usr/share 43 | "$PKGDIR"/usr/src 44 | " 45 | ACCEPTABLE3=" 46 | "$PKGDIR"/usr/local/bin 47 | "$PKGDIR"/usr/local/include 48 | "$PKGDIR"/usr/local/lib 49 | "$PKGDIR"/usr/local/libexec 50 | "$PKGDIR"/usr/local/share 51 | "$PKGDIR"/usr/local/src 52 | " 53 | PATHS="$(find "$PKGDIR" -maxdepth 1 -type d -print 2>/dev/null)" 54 | PATHS2="$(find "$PKGDIR"/usr -mindepth 1 -maxdepth 1 -type d -print 2>/dev/null)" 55 | PATHS3="$(find "$PKGDIR"/usr/local -mindepth 1 -maxdepth 1 -type d -print 2>/dev/null)" 56 | for i in $PATHS; do 57 | if ! echo $ACCEPTABLE | grep -q $i; then 58 | aberr "QA (E321): found unexpected path(s) in package:\n\n${i}\n" 59 | exit 1 60 | fi 61 | done 62 | for i in $PATHS2; do 63 | if ! echo $ACCEPTABLE2 | grep -q $i; then 64 | aberr "QA (E321): found unexpected path(s) in package:\n\n${i}\n" 65 | exit 1 66 | fi 67 | done 68 | for i in $PATHS3; do 69 | if ! echo $ACCEPTABLE3 | grep -q $i; then 70 | aberr "QA (E321): found unexpected path(s) in package:\n\n${i}\n" 71 | exit 1 72 | fi 73 | done 74 | 75 | 76 | for i in "$PKGDIR"/{dev,home,proc,sys,tmp}; do 77 | if [ -e $i ]; then 78 | abwarn "QA (E321): found pseudo filesystem, template, or temporary directory(s) in package (building aosc-aaa?):\n\n${i}\n" 79 | exit 1 80 | fi 81 | done 82 | -------------------------------------------------------------------------------- /qa/post/permissions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##permissions: Check for incorrect permissions. 3 | ##@copyright GPL-2.0+ 4 | FILES="$(find "$PKGDIR/usr/bin" -type f -not -executable -print 2>/dev/null)" 5 | if [ ! -z "$FILES" ]; then 6 | aberr "QA (E324): non-executable file(s) found in /usr/bin:\n\n${FILES}\n" | \ 7 | tee -a "$SRCDIR"/abqaerr.log 8 | fi 9 | 10 | FILES="$(find "$PKGDIR/usr/lib" -type f -name '*.so.*' -not -executable \ 11 | -exec bash -c '[[ "`file -bL {}`" == *shared\ object* ]] && exit 0' \; \ 12 | -print 2>/dev/null)" 13 | if [ ! -z "$FILES" ]; then 14 | aberr "QA (E324): non-executable shared object(s) found in /usr/lib:\n\n${FILES}\n" | \ 15 | tee -a "$SRCDIR"/abqaerr.log 16 | fi 17 | 18 | FILES="$(find "$PKGDIR/usr/lib" -type f -name '*.a' -executable -print 2>/dev/null)" 19 | if [ ! -z "$FILES" ]; then 20 | aberr "QA (E324): executable static object(s) found in /usr/lib:\n\n${FILES}\n" | \ 21 | tee -a "$SRCDIR"/abqaerr.log 22 | fi 23 | 24 | FILES="$(find "$PKGDIR/usr/lib" -type f -name '*.o' -executable -print 2>/dev/null)" 25 | if [ ! -z "$FILES" ]; then 26 | aberr "QA (E324): executable binary object(s) found in /usr/lib:\n\n${FILES}\n" | \ 27 | tee -a "$SRCDIR"/abqaerr.log 28 | fi 29 | -------------------------------------------------------------------------------- /qa/post/zero_byte.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##zero_byte: Check for zero-byte files. 3 | ##@copyright GPL-2.0+ 4 | FILES="$(find "$PKGDIR" -type f -size 0 -print)" 5 | if [ ! -z "$FILES" ]; then 6 | abwarn "QA (W322): Zero-byte files found:\n\n$FILES\n" | \ 7 | tee -a "$SRCDIR"/abqawarn.log 8 | fi 9 | -------------------------------------------------------------------------------- /qa/pre/mter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##mter: Check maintainer information. 3 | ##@copyright GPL-2.0+ 4 | if [[ "$MTER" = "Null Packager " ]]; then 5 | aberr "QA (E311): Maintainer information not set." | \ 6 | tee -a "$SRCDIR"/abqaerr.log 7 | fi 8 | -------------------------------------------------------------------------------- /qa/pre/sections.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##sections.sh: Kick the bucket if the section looks bad 3 | ##@copyright GPL-2.0+ 4 | (test -z $PKGSEC && \ 5 | aberr 'QA (E104): $PKGSEC not defined.') | \ 6 | tee -a "$SRCDIR"/abqaerr.log 7 | 8 | (grep -qF "$PKGSEC" "$AB/sets/section" || \ 9 | aberr "QA (E104): $PKGSEC not in sets/section.") | \ 10 | tee -a "$SRCDIR"/abqaerr.log 11 | -------------------------------------------------------------------------------- /quirks/ready/gnome: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##The GNOME quirks 3 | ##@copyright GPL-2.0+ 4 | # libtool, gnome Bugzilla #655517 5 | cp libtool libtool_ 6 | sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool_ 7 | mv libtool_ libtool 8 | -------------------------------------------------------------------------------- /scriptlet/01-alternatives.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##alternatives: that update-alternatives stuff 3 | ##@copyright CC0 4 | # a more precise one 5 | # addalt link name path prio 6 | addalt(){ 7 | echo "update-alternatives --install $(argprint "$@") --quiet" >> abscripts/postinst 8 | echo 'if [ "$1" != "upgrade" ]; then' >> abscripts/prerm 9 | echo " update-alternatives --remove $(argprint "$2" "$3")" >> abscripts/prerm 10 | echo "fi" >> abscripts/prerm 11 | } 12 | 13 | # alternative path link prio [path2 link2 prio2 ..] 14 | alternative(){ while (($#)); do addalt "$1" "$(basename "$1")" "$2" "$3"; shift 3 || break; done; } 15 | 16 | _hasAlternative=0 17 | 18 | ABALTDEFINES=alternatives 19 | 20 | if bool $ABSTAGE2; then 21 | if [ -f "$SRCDIR"/autobuild/${ABALTDEFINES}.stage2 ]; then 22 | abdbg "stage2: Found stage2 alternatives file, using ${ABALTDEFINES}.stage2 ..." 23 | ABALTDEFINES=alternatives.stage2 24 | _hasAlternative=1 25 | elif [ -f "$SRCDIR"/autobuild/${ABALTDEFINES} ]; then 26 | abdbg "stage2: Found general alternatives file: ${SRCDIR}/autobuild/${ABALTDEFINES}" 27 | _hasAlternative=1 28 | fi 29 | else 30 | if [ -f "$SRCDIR"/autobuild/${ABALTDEFINES} ]; then 31 | abdbg "Found general alternatives file: ${SRCDIR}/autobuild/${ABALTDEFINES}" 32 | _hasAlternative=1 33 | fi 34 | fi 35 | 36 | ## More specific per-arch alternatives file always take precedence over per-group ones 37 | if bool $ABSTAGE2; then 38 | if [ -f "$SRCDIR"/autobuild/${ABHOST}/${ABALTDEFINES}.stage2 ]; then 39 | abdbg "Found per-arch stage2 alternatives file: ${SRCDIR}/autobuild/${ABHOST}/${ABALTDEFINES}.stage2" 40 | ABALTDEFINES=alternatives.stage2 41 | _hasAlternative=1 42 | _archTarget="/${ABHOST}" 43 | elif [ -f "$SRCDIR"/autobuild/${ABHOST}/${ABALTDEFINES} ]; then 44 | abdbg "Found per-arch alternatives file: ${SRCDIR}/autobuild/${ABHOST}/${ABALTDEFINES}.stage2" 45 | ABALTDEFINES=alternatives.stage2 46 | _hasAlternative=1 47 | _archTarget="/${ABHOST}" 48 | else 49 | for _grp in ${ABHOST_GROUP}; do 50 | if [ -f "$SRCDIR"/autobuild/${_grp}/${ABALTDEFINES}.stage2 ]; then 51 | if [ $_assignedGroup ]; then 52 | aberr "Refusing to use autobuild/${_grp}/${ABALTDEFINES} for group-specific alternatives" 53 | aberr "... because another file autobuild/${_assignedGroup}/${ABALTDEFINES} is also valid for target architecture" 54 | abinfo "Current ABHOST ${ABHOST} belongs to the following groups:" 55 | abinfo "${ABHOST_GROUP//$'\n'/, }" 56 | abinfo "Create per-arch autobuild/${ABHOST}/${ABALTDEFINES} instead to resolve the conflict" 57 | abdie "Multiple per-group alternative files for target architecture detected! Refuse to proceed." 58 | fi 59 | abdbg "Found per-group stage2 alternatives file: ${SRCDIR}/autobuild/${_grp}/${ABALTDEFINES}" 60 | ABALTDEFINES=alternatives.stage2 61 | _hasAlternative=1 62 | _archTarget="/${_grp}" 63 | _assignedGroup=${_grp} 64 | elif [ -f "$SRCDIR"/autobuild/${_grp}/${ABALTDEFINES} ]; then 65 | if [ $_assignedGroup ]; then 66 | aberr "Refusing to use autobuild/${_grp}/${ABALTDEFINES} for group-specific alternatives" 67 | aberr "... because another file autobuild/${_assignedGroup}/${ABALTDEFINES} is also valid for target architecture" 68 | abinfo "Current ABHOST ${ABHOST} belongs to the following groups:" 69 | abinfo "${ABHOST_GROUP//$'\n'/, }" 70 | abinfo "Create per-arch autobuild/${ABHOST}/${ABALTDEFINES} instead to resolve the conflict" 71 | abdie "Multiple per-group alternative files for target architecture detected! Refuse to proceed." 72 | fi 73 | abdbg "Found per-group alternatives file: ${SRCDIR}/autobuild/${_grp}/${ABALTDEFINES}" 74 | _hasAlternative=1 75 | _archTarget="/${_grp}" 76 | _assignedGroup=${_grp} 77 | fi 78 | done 79 | fi 80 | else 81 | if [ -f "$SRCDIR"/autobuild/${ABHOST}/${ABALTDEFINES} ]; then 82 | abdbg "Found per-arch alternatives file: ${SRCDIR}/autobuild/${ABHOST}/${ABALTDEFINES}" 83 | _hasAlternative=1 84 | _archTarget="/${ABHOST}" 85 | else 86 | for _grp in ${ABHOST_GROUP}; do 87 | if [ -f "$SRCDIR"/autobuild/${_grp}/${ABALTDEFINES} ]; then 88 | if [ $_assignedGroup ]; then 89 | aberr "Refusing to use autobuild/${_grp}/${ABALTDEFINES} for group-specific alternatives" 90 | aberr "... because another file autobuild/${_assignedGroup}/${ABALTDEFINES} is also valid for target architecture" 91 | abinfo "Current ABHOST ${ABHOST} belongs to the following groups:" 92 | abinfo "${ABHOST_GROUP//$'\n'/, }" 93 | abinfo "Create per-arch autobuild/${ABHOST}/${ABALTDEFINES} instead to resolve the conflict" 94 | abdie "Multiple per-group alternative files for target architecture detected! Refuse to proceed." 95 | fi 96 | abdbg "Found per-group alternatives file: ${SRCDIR}/autobuild/${_grp}/${ABALTDEFINES}" 97 | _hasAlternative=1 98 | _archTarget="/${_grp}" 99 | _assignedGroup=${_grp} 100 | fi 101 | done 102 | fi 103 | fi 104 | 105 | if bool "$_hasAlternative"; then 106 | abinfo "Taking alternatives file: ${SRCDIR}/autobuild${_archTarget}/${ABALTDEFINES}" 107 | echo "#>start 01-alternatives" >> abscripts/postinst 108 | echo "#>start 01-alternatives" >> abscripts/prerm 109 | . "$SRCDIR"/autobuild"$_archTarget"/${ABALTDEFINES} 110 | echo "#>end 01-alternatives" >> abscripts/postinst 111 | echo "#>end 01-alternatives" >> abscripts/prerm 112 | else 113 | abinfo "No alternatives file found." 114 | fi 115 | 116 | unset alternative addalt _archTarget _assignedGroup _grp _hasAlternative 117 | -------------------------------------------------------------------------------- /scriptlet/02-usergroup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##usergroup: functions with a creepy syntax to define package's user and groups 3 | ##@copyright GPL-2.0+ 4 | # user LOGIN UID GID HOME COMMENT SHELL [GROUPS..] 5 | user(){ 6 | echo "grep -q '^$1:' /etc/passwd || useradd $(argprint -u "$2" -g "$3" -d "$4" -c "$5" -s "$6" "$1" -m)" >> abscripts/preinst 7 | local N=$1 IFS=, 8 | shift 6 9 | # $*: argv[1...].join(IFS[0]) 10 | (($#)) && echo "usermod -a '-G${*//\'/"'\''"}' '${N//\'/"'\''"}'" >> abscripts/preinst 11 | } 12 | 13 | # group NAME GID 14 | group(){ 15 | echo "grep -q '^$1:' /etc/group || groupadd $(argprint -g "$2" "$1")" >> abscripts/preinst 16 | } 17 | if [ -e autobuild/usergroup ] 18 | then 19 | echo '# usergroup' >> abscripts/preinst 20 | . autobuild/usergroup 21 | fi 22 | 23 | unset user group 24 | -------------------------------------------------------------------------------- /scriptlet/03-pax.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##pax: functions to set pax flags 3 | ##@copyright GPL-2.0+ 4 | 5 | # abpaxctl flags files 6 | 7 | abpaxctl(){ 8 | local paxflags 9 | echo "if [ -x /usr/bin/paxctl-ng ]; then" >> abscripts/postinst 10 | paxflags="$1" 11 | shift 12 | for i 13 | do 14 | echo " /usr/bin/paxctl-ng -v -$paxflags \"$i\"" >> abscripts/postinst 15 | done 16 | echo "fi" >> abscripts/postinst 17 | } 18 | 19 | if [ -e autobuild/pax ] 20 | then 21 | echo '# pax' >> abscripts/postinst 22 | . autobuild/pax 23 | fi 24 | 25 | unset -f abpaxctl 26 | -------------------------------------------------------------------------------- /sets/arch_groups/arm: -------------------------------------------------------------------------------- 1 | armv4 2 | armv6hf 3 | armv7hf 4 | arm64 5 | -------------------------------------------------------------------------------- /sets/arch_groups/mainline: -------------------------------------------------------------------------------- 1 | amd64 2 | arm64 3 | loongarch64 4 | loongson3 5 | mips64r6el 6 | ppc64el 7 | riscv64 8 | -------------------------------------------------------------------------------- /sets/arch_groups/ocaml_native: -------------------------------------------------------------------------------- 1 | amd64 2 | arm64 3 | ppc64el 4 | -------------------------------------------------------------------------------- /sets/arch_groups/retro: -------------------------------------------------------------------------------- 1 | armv4 2 | armv6hf 3 | armv7hf 4 | i486 5 | loongson2f 6 | m68k 7 | powerpc 8 | ppc64 9 | -------------------------------------------------------------------------------- /sets/section: -------------------------------------------------------------------------------- 1 | admin 2 | Bases 3 | Cinnamon 4 | cli-mono 5 | comm 6 | cryptocurrency 7 | Cutefish 8 | database 9 | debian-installer 10 | debug 11 | devel 12 | doc 13 | editors 14 | electronics 15 | embedded 16 | fonts 17 | games 18 | gnome 19 | gnu-r 20 | gnustep 21 | graphics 22 | hamradio 23 | haskell 24 | httpd 25 | interpreters 26 | java 27 | kde 28 | kernel 29 | libdevel 30 | libs 31 | lisp 32 | localization 33 | LXDE 34 | LxQt 35 | MATE 36 | mail 37 | math 38 | misc 39 | net 40 | news 41 | ocaml 42 | oldlibs 43 | otherosfs 44 | perl 45 | php 46 | python 47 | ruby 48 | science 49 | shells 50 | sound 51 | tex 52 | text 53 | Trinity 54 | utils 55 | vcs 56 | video 57 | virtual 58 | web 59 | x11 60 | xfce 61 | zope 62 | non-free/admin 63 | non-free/Bases 64 | non-free/Cinnamon 65 | non-free/cli-mono 66 | non-free/comm 67 | non-free/cryptocurrency 68 | non-free/Cutefish 69 | non-free/database 70 | non-free/debian-installer 71 | non-free/debug 72 | non-free/devel 73 | non-free/doc 74 | non-free/editors 75 | non-free/electronics 76 | non-free/embedded 77 | non-free/fonts 78 | non-free/games 79 | non-free/gnome 80 | non-free/gnu-r 81 | non-free/gnustep 82 | non-free/graphics 83 | non-free/hamradio 84 | non-free/haskell 85 | non-free/httpd 86 | non-free/interpreters 87 | non-free/java 88 | non-free/kde 89 | non-free/kernel 90 | non-free/libdevel 91 | non-free/libs 92 | non-free/lisp 93 | non-free/localization 94 | non-free/LXDE 95 | non-free/LxQt 96 | non-free/MATE 97 | non-free/mail 98 | non-free/math 99 | non-free/misc 100 | non-free/net 101 | non-free/news 102 | non-free/ocaml 103 | non-free/oldlibs 104 | non-free/otherosfs 105 | non-free/perl 106 | non-free/php 107 | non-free/python 108 | non-free/ruby 109 | non-free/science 110 | non-free/shells 111 | non-free/sound 112 | non-free/tex 113 | non-free/text 114 | non-free/Trinity 115 | non-free/utils 116 | non-free/vcs 117 | non-free/video 118 | non-free/virtual 119 | non-free/web 120 | non-free/x11 121 | non-free/xfce 122 | non-free/zope 123 | contrib/admin 124 | contrib/Bases 125 | contrib/Cinnamon 126 | contrib/cli-mono 127 | contrib/comm 128 | contrib/cryptocurrency 129 | contrib/Cutefish 130 | contrib/database 131 | contrib/debian-installer 132 | contrib/debug 133 | contrib/devel 134 | contrib/doc 135 | contrib/editors 136 | contrib/electronics 137 | contrib/embedded 138 | contrib/fonts 139 | contrib/games 140 | contrib/gnome 141 | contrib/gnu-r 142 | contrib/gnustep 143 | contrib/graphics 144 | contrib/hamradio 145 | contrib/haskell 146 | contrib/httpd 147 | contrib/interpreters 148 | contrib/java 149 | contrib/kde 150 | contrib/kernel 151 | contrib/libdevel 152 | contrib/libs 153 | contrib/lisp 154 | contrib/localization 155 | contrib/LXDE 156 | contrib/LxQt 157 | contrib/MATE 158 | contrib/mail 159 | contrib/math 160 | contrib/misc 161 | contrib/net 162 | contrib/news 163 | contrib/ocaml 164 | contrib/oldlibs 165 | contrib/otherosfs 166 | contrib/perl 167 | contrib/php 168 | contrib/python 169 | contrib/ruby 170 | contrib/science 171 | contrib/shells 172 | contrib/sound 173 | contrib/tex 174 | contrib/text 175 | contrib/Trinity 176 | contrib/utils 177 | contrib/vcs 178 | contrib/video 179 | contrib/virtual 180 | contrib/web 181 | contrib/x11 182 | contrib/xfce 183 | contrib/zope 184 | -------------------------------------------------------------------------------- /sets/testspec_exports: -------------------------------------------------------------------------------- 1 | TESTDES 2 | TESTDEP 3 | TESTTYPE 4 | TESTEXEC 5 | CUSTOM_STAGE 6 | -------------------------------------------------------------------------------- /tests/custom.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #tests/custom: test script wrapper for custom test runs 3 | #This script is called by autobuild-test to run custom tests. 4 | 5 | abtest_custom_test () { 6 | if bool $CUSTOM_IS_BASHSCRIPT; then 7 | abinfo "Sourcing bash script $CUSTOM_SCRIPT ..." 8 | load_strict $CUSTOM_SCRIPT $CUSTOM_ARGS 9 | else 10 | abinfo "Executing test script $CUSTOM_SCRIPT ..." 11 | $CUSTOM_SCRIPT $CUSTOM_ARGS 12 | fi 13 | EXIT_CODE=$? 14 | } 15 | -------------------------------------------------------------------------------- /tests/rust.sh: -------------------------------------------------------------------------------- 1 | abtest_rust_test() { 2 | abinfo "Running cargo test ..." 3 | cargo test \ 4 | --manifest-path "$SRCDIR/Cargo.toml" \ 5 | --no-fail-fast -r \ 6 | ${CARGO_TEST_AFTER} 7 | } 8 | --------------------------------------------------------------------------------