├── COPYING ├── README ├── build.sh.functions ├── build.sh.generic ├── buildpkg.functions ├── buildpkg.packaging.irix ├── buildpkg.packaging.solaris ├── buildpkg.tools ├── image.conf ├── newpkg ├── pkgdef.template ├── pkgdef.template.irix ├── pkginfo.in ├── relnotes.template.irix └── subsys.conf /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | =========== 2 | What is it? 3 | =========== 4 | buildpkg is a collection of bourne shell script code that implements a 5 | framework for easy scripting a package build for IRIX or Solaris in 6 | a repeatable manner. 7 | 8 | Anyone familiar with how an rpm specfile works will see the similarities 9 | but basically it works on the premise that everything is built into a 10 | staging area and metadata describing the final package layout is used to 11 | automatically generate the necessary metadata for the native 12 | packageformat. By design it is not possible to hand-tweak the generated 13 | metadata as it is always regenerated, any tweaks must be implemented 14 | through metadata in the buildsystem. 15 | 16 | Dependencies are automatically extracted from files in the stagedir 17 | (filtering is possible) and it's also possible to manually add hidden 18 | dependencies that cannot be extracted automatically. 19 | 20 | There's also steps that automcatically compiles manpages and compresses 21 | them. It can handle symlinked manpages and even manpages that are just 22 | links to other manpages (ie. using the nroff .so command). 23 | 24 | =============== 25 | Getting started 26 | =============== 27 | There's a few customizations that should be done before begining to 28 | build packages. 29 | 30 | * The environment variable BUILDPKG_SCRIPTS should point to buildpkg 31 | * The environment variable BUILDPKG_BASE should point to your packages 32 | * check the value of topinstalldir in buildpkg.functions 33 | * check the value of pkgprefix in buildpkg.functions and 34 | buildpkg.packaging.irix 35 | * check tool paths in buildpkg.tools and override with a 36 | .irix or .solaris config file. 37 | * for building perl modules you must also adjust paths 38 | in generic_install_perl 39 | 40 | =================== 41 | License and contact 42 | =================== 43 | buildpkg is released under the GNU GPLv3. Please see the COPYING file 44 | for license details. 45 | 46 | Tom G. Christensen 47 | -------------------------------------------------------------------------------- /build.sh.functions: -------------------------------------------------------------------------------- 1 | # Function library for buildpkg build.sh 2 | # This is only for build.sh helper functions. 3 | # Copyright (C) 2003 Jens Henrik Leonhard Jensen 4 | # Copyright (C) 2003-2019 Tom G. Christensen 5 | 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | # Written by Tom G. Christensen . 20 | 21 | # Automatic logging is enabled by default 22 | autolog=1 23 | # Don't log these methods 24 | nolog="prep distclean" 25 | # date format string 26 | dateformat="%Y%m%d%H%M%S" 27 | 28 | # Define script functions and register them 29 | METHODS="" 30 | reg() { 31 | METHODS="$METHODS $1" 32 | } 33 | 34 | all() 35 | { 36 | for METHOD in $METHODS 37 | do 38 | case $METHOD in 39 | all*|*clean|check) ;; 40 | *) $METHOD 41 | ;; 42 | esac 43 | done 44 | 45 | } 46 | 47 | usage() { 48 | echo Usage $0 "{"$(echo $METHODS | tr " " "|")"}" 49 | exit 1 50 | } 51 | 52 | build_sh() { 53 | # Register internal functions last 54 | # The empty reg is trickery to get exactly 1 space at each end of the METHODS string 55 | reg all 56 | reg 57 | # 58 | local OK=0 59 | for METHOD in $* 60 | do 61 | METHOD=" $METHOD *" 62 | if [ "${METHODS%$METHOD}" == "$METHODS" ] ; then 63 | usage 64 | fi 65 | OK=1 66 | done 67 | 68 | if [ $OK = 0 ] ; then 69 | usage; 70 | fi 71 | 72 | for METHOD in $* 73 | do 74 | ( log_start $METHOD; $METHOD; log_stop $METHOD ) 75 | done 76 | } 77 | 78 | # Write out a timestamp 79 | timestamp() 80 | { 81 | date +$dateformat 82 | } 83 | 84 | # Start a logfile 85 | # Note this should only be used *after* the buildpkg.* libraries 86 | # have been sourced, otherwise most of the variables used to construct 87 | # the logfile name are undefined. 88 | log_start() 89 | { 90 | local func=$1 91 | build_sh_logfile=${topdir}-${version}_${pkgver}-${os}-${build_arch}-${func}-$(timestamp).log 92 | 93 | if [ $autolog -eq 1 ]; then 94 | if [ -z "$(${__expr} "$nolog" : ".*\($func\)")" ]; then 95 | # save stdout and stderr to file descriptors 3 and 4 96 | # then redirect them to $build_sh_logfile 97 | echo "Opening logfile: $build_sh_logfile" 98 | exec 3>&1 4>&2 >$build_sh_logfile 2>&1 99 | # Log a timestamp 100 | timestamp 101 | # Get information about the compiler into the logfile 102 | identify_compiler log 103 | else # $nolog function, just add a timestamp 104 | timestamp 105 | fi 106 | fi 107 | } 108 | 109 | # Stop logging 110 | log_stop() 111 | { 112 | local func=$1 113 | if [ $autolog -eq 1 -a -z "$(${__expr} "$nolog" : ".*\($func\)")" ]; then 114 | # Log a timestamp 115 | timestamp 116 | # restore stdout and stderr 117 | exec 1>&3 2>&4 118 | echo "Closing logfile: $build_sh_logfile" 119 | fi 120 | } 121 | -------------------------------------------------------------------------------- /build.sh.generic: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is a buildpkg build.sh script 3 | # build.sh helper functions 4 | . ${BUILDPKG_SCRIPTS}/build.sh.functions 5 | # 6 | ########################################################### 7 | # Check the following 4 variables before running the script 8 | topdir= 9 | version= 10 | pkgver= 11 | source[0]=$topdir-$version.tar.gz 12 | # If there are no patches, simply comment this 13 | patch[0]= 14 | 15 | # Source function library 16 | . ${BUILDPKG_SCRIPTS}/buildpkg.functions 17 | 18 | reg prep 19 | prep() 20 | { 21 | generic_prep 22 | } 23 | 24 | reg build 25 | build() 26 | { 27 | generic_build 28 | } 29 | 30 | reg check 31 | check() 32 | { 33 | generic_check 34 | } 35 | 36 | reg install 37 | install() 38 | { 39 | generic_install DESTDIR 40 | } 41 | 42 | reg pack 43 | pack() 44 | { 45 | generic_pack 46 | } 47 | 48 | reg distclean 49 | distclean() 50 | { 51 | clean distclean 52 | } 53 | 54 | ################################################### 55 | # No need to look below here 56 | ################################################### 57 | build_sh $* 58 | -------------------------------------------------------------------------------- /buildpkg.functions: -------------------------------------------------------------------------------- 1 | # Global function library for buildpkg 2 | # Copyright (C) 2003-2019 Tom G. Christensen 3 | 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | # Written by Tom G. Christensen . 18 | 19 | # 20 | # This file is designed to be sourced by pr. package buildscripts 21 | # 22 | # We rely on an environment variable called BUILDPKG_BASE to 23 | # define the root of the buildpkg tree 24 | # 25 | buildpkgbase=${BUILDPKG_BASE-'x'} 26 | if [ "$buildpkgbase" == "x" ]; then 27 | echo "You *must* define BUILDPKG_BASE environment variable" 28 | exit 1 29 | fi 30 | 31 | # We rely on an environment variable called BUILDPKG_SCRIPTS to 32 | # define where the buildpkg code is located 33 | buildpkgscripts=${BUILDPKG_SCRIPTS-'x'} 34 | if [ "$buildpkgscripts" == "x" ]; then 35 | echo "You *must* define BUILDPKG_SCRIPTS environment variable" 36 | exit 1 37 | fi 38 | 39 | # Variables that *must* be overridden pr. package 40 | # They are used to construct paths and more so they 41 | # must have sane values 42 | # topdir= The default package dirname, it's used pr. default in pkgname 43 | # and it is also used pr. default as the toplevel name inside the sourcetar ($topsrcdir) 44 | # version= source version ie. 0.14.2b 45 | # pkgver= the package revision, an increasing number is recommended but a date could be used instead 46 | # source[0..x] = source filenames - source[0] *must* be defined and contain a legal filename 47 | # pr. default we will look for source[0] relative to $srcfiles 48 | # A filename that begin with / will be treated as absolute paths 49 | # Note! only source[0] will be automatically unpacked 50 | # patch[0..x] = patch filenames - if patch[0] is undefined then generic_prep won't attempt to patch the source 51 | # pr. default we expect these to be listed relative to $patchdir (default $srcdir) 52 | # filenames that begin with / will be treated as absolute paths 53 | # All patching will be done from *within* $srcdir/$topsrcdir directory with patch -p1 54 | # patches must be in uncompressed format 55 | 56 | # Define tools programs in __ prefixed namespace 57 | . $BUILDPKG_SCRIPTS/buildpkg.tools 58 | 59 | # Define defaults 60 | pkgdir=${PWD##*/} # topdir under $BUILDPKG_BASE 61 | stagedir=$buildpkgbase/$pkgdir/stage 62 | srcdir=$buildpkgbase/$pkgdir/src 63 | patchdir=$srcdir # Allow the possibility of easily putting a load of patches in a different location 64 | metadir=$buildpkgbase/$pkgdir/meta 65 | distdir=$buildpkgbase/distfiles/beta 66 | topsrcdir=$topdir-$version # it may be necessary to override this 67 | 68 | srcfiles=$buildpkgbase/srcfiles 69 | 70 | pkgdirdesig=tgcware # topinstalldir suffix 71 | topinstalldir=/usr/$pkgdirdesig 72 | prefix=$topinstalldir 73 | metainstalldir=$topinstalldir 74 | 75 | # The default configure args 76 | configure_args=(--prefix=$prefix --disable-nls) 77 | __configure="./configure" 78 | 79 | # Docdir relative to $prefix 80 | _docdir=share/doc 81 | _vdocdir=${_docdir}/${topdir}-${version} 82 | # Other relative dirs 83 | _bindir=bin 84 | _sbindir=sbin 85 | _libdir=lib 86 | _sharedir=share 87 | _mandir=man 88 | _infodir=info 89 | _includedir=include 90 | _sysconfdir=etc 91 | _datadir=$_sharedir 92 | 93 | tmpdir=/tmp 94 | 95 | _os=$(${__uname} -sr|${__sed} -e 's/ //g' -e 's/\.//g'|${__tr} '[A-Z]' '[a-z]') 96 | 97 | # pkg information. 98 | # The following 3 vars can be used when constructing pkg metadata 99 | # Override as necessary. 100 | pkgprefix=SB 101 | pkgname=$pkgprefix$topdir # overriding this will be common 102 | name=$topdir # as will this ditto 103 | 104 | # Functionality controls 105 | symlinkman=0 # Don't replace .so linking with symlinks pr. default 106 | symlinkman_verbose=0 # Be quiet 107 | catman=0 # Don't fix manpages pr. default 108 | gzman=0 # Don't gzip man pages pr. default 109 | compressman=0 # Don't compress(1) man pages pr. default 110 | packman=0 # Don't pack(1) man pages pr. default 111 | gzinfo=1 # Compress infopages pr. default 112 | dostrip=1 113 | dostrip_elf=1 # default to stripping binaries during the install stage 114 | dostrip_shared=1 # default to stripping shared objects during the install stage 115 | dostrip_static=1 # default to stripping static archives during the install stage 116 | shortroot=0 # Deep or shallow stagedir? 117 | autonuke=1 # Automatically attempt to cleanout unwanted files after make install? 118 | # eg. info/dir, lib/*.la 119 | 120 | # This is meant to aid custom install functions that wants 121 | # to skip the clean stage & make install parts of generic_install 122 | custom_install=0 123 | 124 | # We need to allow a pr. packaging function library to have it's own 125 | # way of running configure. We default to using the generic version 126 | # but if set to 0 it will try to use run_configure function instead 127 | generic_configure=1 128 | 129 | # Allow overriding the make target for building 130 | # We default to an empty string so the default target will be built 131 | make_build_target="" 132 | 133 | # Allow overriding the make target for running the testsuite 134 | # We default to 'check' 135 | make_check_target="check" 136 | 137 | # Allow overriding the make target for running the install 138 | # We default to 'install' 139 | make_install_target=install 140 | 141 | # Allow skipping the configure run 142 | no_configure=0 143 | 144 | # When building perl modules should we run make test? 145 | maketest=0 146 | 147 | # When patching use -p1 as default prefix 148 | patch_prefix="-p1" 149 | 150 | # Settings for gnu_link 151 | # GNU prefix 152 | gnu_prefix=g 153 | # GNU dir 154 | _gnudir=gnu 155 | # Add --program-prefix to configure if gnu_link is requested? 156 | gnu_configure=1 157 | 158 | # Distfiles should be named like this 159 | # --.sb--- 160 | # ie: libmad-0.14.2b-1.sb-sol5.8-sparcv9-local 161 | #distfile=$topdir-$version-$pkgver.sb-$os-$cpu-$pkgdirdesig 162 | # You must override the distfile var in the pr. packaging 163 | # system function library 164 | 165 | # Define error codes and texts 166 | E_MISSING_STAGEDIR=30 167 | E_MISSING_ARGS=31 168 | E_BAD_FILE=32 169 | E_PATCH_FAILED=33 170 | E_BAD_DIR=34 171 | E_BAD_UNPACK=35 172 | E_BAD_COMPRESS=36 173 | E_BAD_CONFIG=37 174 | E_BAD_MAKE=38 175 | E_BAD_CLEANOPTIONS=39 176 | E_BAD_STRIP=40 177 | E_BAD_ARGS=41 178 | E_ARG_OBSO=42 179 | E_BAD_SECTION_BEGIN=43 180 | E_BAD_SECTION_END=44 181 | E_UNPACKAGED_FILES=45 182 | E_BAD_VERSION=46 183 | E_BAD_LIBS=47 184 | E_SVR4_PKG_OVERFLOW=48 185 | E_SVR4_NAME_OVERFLOW=49 186 | E_MISSING_EXE=50 187 | E_MISSING_CHGLOG=51 188 | E_MISSING_CHGLOGV=52 189 | 190 | error_txt[$E_BAD_FILE]="File not found" 191 | error_txt[$E_PATCH_FAILED]="Patch failed" 192 | error_txt[$E_BAD_DIR]="Directory not found" 193 | error_txt[$E_BAD_UNPACK]="Unable to decompress sourcearchive" 194 | error_txt[$E_BAD_COMPRESS]="Unknown compression method" 195 | #error_txt[$E_BAD_CONFIG]="configure failed" 196 | #error_txt[$E_BAD_MAKE]="make failed" 197 | error_txt[$E_MISSING_ARGS]="A required argument was missing" 198 | error_txt[$E_BAD_ARGS]="An illegal argument was passed" 199 | error_txt[$E_ARG_OBSO]="Function nolonger supports the argument you passed" 200 | error_txt[$E_BAD_SECTION_BEGIN]="Section start marker found but we are already inside a section!" 201 | error_txt[$E_BAD_SECTION_END]="Found end of section marker before section begin!" 202 | error_txt[$E_UNPACKAGED_FILES]="Unpackaged files found in stage area!" 203 | error_txt[$E_BAD_VERSION]="Version field overflow" 204 | error_txt[$E_BAD_LIBS]="config.log defines obsolete libraries!" 205 | error_txt[$E_SVR4_PKG_OVERFLOW]="PKG field exceeds 9 char limit" 206 | error_txt[$E_SVR4_NAME_OVERFLOW]="NAME field exceeds 256 char limit" 207 | error_txt[$E_MISSING_EXE]="Executable is missing" 208 | error_txt[$E_MISSING_CHGLOG]="ChangeLog is missing" 209 | error_txt[$E_MISSING_CHGLOGV]="Did not find ChangeLog entry for ${version}-${pkgver}" 210 | 211 | ##################################################### 212 | # Helper functions 213 | ##################################################### 214 | 215 | # Two very useful utility functions courtesy of the ABS guide (see Example A-22 & A-23) 216 | # _pls will enclose a string in hard-quotes to avoid expansion 217 | # _upls will remove hard-quotes from hard-quoted string thus allowing expansion 218 | _pls() { 219 | # local IFS=$'x1B' # \ESC character (not required) 220 | echo $'\x27'$@$'\x27' # Hard quoted parameter glob 221 | } 222 | _upls() { 223 | # local IFS=$'x1B' # \ESC character (not required) 224 | eval echo $@ # Substitution on the glob. 225 | } 226 | 227 | # error(): exit with errorcode and possibly a message 228 | # params: $1 = errorcode $2 = name of caller 229 | error() 230 | { 231 | if [ -n "${error_txt[$1]}" ]; then 232 | echo "$2: ${error_txt[$1]}" 233 | fi 234 | exit $1 235 | } 236 | 237 | # setdir(): switch to a directory, but check destination first 238 | # params: $1=dir to cd to [source|stage] can be used as shortcuts 239 | # Switches to the directory in $1 but first checks if the destination exists 240 | setdir() 241 | { 242 | local dir=$1 243 | case $dir in 244 | 'source') dir="$srcdir/$topsrcdir";; 245 | 'stage') dir="$stagedir";; 246 | esac 247 | echo "Switching to $dir" 248 | if [ -z "$dir" ]; then 249 | error $E_BAD_DIR setdir 250 | fi 251 | if [ -d "$dir" ]; then 252 | cd "$dir" 253 | else 254 | error $E_BAD_DIR setdir 255 | fi 256 | } 257 | 258 | # patch(): patch unpacked source 259 | # params: $1 = patch number (arrayindex) $2 = patch params (defaults to -p1) 260 | # It will verify the existence of the patch file passed to it and 261 | # exit gracefully if it cannot be found. 262 | # An empty $2 argument will be treated as undefined and mapped to -p1 263 | patch() 264 | { 265 | local pnum=$1 266 | local arg2=$2 267 | local pparam=${arg2:-"-p1"} 268 | 269 | setdir source 270 | 271 | if [ ! -z ${patch[$pnum]} ]; then # They didn't give us an empty string 272 | if [ "${patch[$pnum]:0:1}" != "/" ]; then # We have a relative pathname 273 | # expand to absolute 274 | patch[$pnum]=$(get_source_absfilename ${patch[$pnum]}) 275 | fi # We are now sure that $patch[$pnum] contains file with absolute path 276 | echo "Processing patch[$pnum] - ${patch[$pnum]}" 277 | if [ -r ${patch[$pnum]} ]; then # file is readable 278 | ${__patch} -Es $2 < ${patch[$pnum]} 279 | if [ $? -ne 0 ]; then 280 | error $E_PATCH_FAILED patch 281 | fi 282 | else 283 | error $E_BAD_FILE patch 284 | fi 285 | else 286 | echo "Patch $pnum has empty filename" 287 | fi 288 | } 289 | 290 | # get_source_filename(): Find filename for given sourceid 291 | # params: $1 = file to resolve (ie. source[x] or patch[x]) 292 | get_source_filename() 293 | { 294 | local source=$1 295 | local file="${source##*/}" # Extract filename part 296 | 297 | if [ -z "$file" ]; then 298 | error $E_BAD_FILE get_source_filename 299 | else 300 | echo $file 301 | fi 302 | } 303 | 304 | # get_source_path(): Find local path for given sourceid 305 | # params: $1 = file to resolve (ie. source[x] or patch[x]) 306 | get_source_path() 307 | { 308 | local source=$1 309 | local path_return="" 310 | local path="${source%/*}" # Extract path part 311 | local file=$(get_source_filename "$source") # Extract filename part 312 | 313 | if [ -n "$path" ]; then 314 | # We have a path component, could be relative, url or abs path 315 | if [ "${path:0:1}" != "/" ]; then 316 | # path is relative or contains an url 317 | # If path contains an url 318 | if [ -n "$(echo $path | grep '://')" ]; then 319 | # let empty $path code handle it 320 | path="" 321 | else 322 | # Not an url 323 | [ -r "$srcdir/$file" ] && path_return="$srcdir" 324 | [ -r "$srcfiles/$file" ] && path_return="$srcfiles" 325 | fi 326 | else # abs path 327 | path_return=$path 328 | fi 329 | fi 330 | # No path given 331 | if [ -z "$path" ]; then 332 | [ -r "$srcdir/$file" ] && path_return="$srcdir" 333 | [ -r "$srcfiles/$file" ] && path_return="$srcfiles" 334 | fi 335 | 336 | [ -z "$path_return" ] && path_return="$srcfiles" # Best guess 337 | 338 | echo $path_return 339 | } 340 | 341 | # get_source_absfilename(): Wrapper for get_source_filename and get_source_path 342 | # params: $1 = file to resolve (ie. source[x] or patch[x]) 343 | # Note this wrapper will exit with $E_BAD_FILE if the absolute filename is not 344 | # readable 345 | get_source_absfilename() 346 | { 347 | local source=$1 348 | local absfilename="$(get_source_path "$source")/$(get_source_filename $1)" 349 | if [ -r "$absfilename" ]; then 350 | echo "$absfilename" 351 | else 352 | # File is not readable 353 | error $E_BAD_FILE get_source_absfilename 354 | fi 355 | } 356 | 357 | # fetch_source(): Fetch a sourcefile from an url 358 | # params: $1 = URL to fetch 359 | fetch_source() 360 | { 361 | local url=$1 362 | local file=$(get_source_filename "$url") 363 | local path=$(get_source_path "$url") 364 | 365 | if [ ! -r "$path/$file" ]; then 366 | echo "fetch_source: Downloading $url" 367 | if [ -x ${__curl} ]; then 368 | ${__curl} -R -# -L --retry 2 -C - -o $srcfiles/$file "$url" 369 | else 370 | error $E_MISSING_EXE fetch_source 371 | fi 372 | fi 373 | } 374 | 375 | # get_files(): Fetch source files and patches from URLs 376 | # params: none 377 | # Any source or patch entries with URL's will be processed and downloaded 378 | # as necessary. 379 | get_files() 380 | { 381 | local numsource=${#source[@]} 382 | local numpatch=${#patch[@]} 383 | local src 384 | local array 385 | local counter 386 | 387 | local idx=0 388 | let counter=$numsource+$numpatch 389 | array=( ${source[@]} ${patch[@]} ) 390 | while [ $idx -lt ${counter} ] 391 | do 392 | src=${array[$idx]} 393 | [ -n "$(echo $src | grep '://')" ] && fetch_source $src 394 | let idx=idx+1 395 | done 396 | } 397 | 398 | # unpack(): Unpack source 399 | # params: $1 = source number (arrayindex) 400 | # It will detect filetype and unpack 401 | # .tar, .tgz, .gz, .bz2, .xz, .lzma, .zip and .Z supported 402 | unpack() 403 | { 404 | local source=${source[$1]} 405 | local filename 406 | local suffix 407 | local absfile 408 | 409 | # Create the $srcdir if it is missing 410 | if [ ! -d $srcdir ]; then 411 | echo "Creating $srcdir" 412 | ${__mkdir} -p $srcdir 413 | fi 414 | setdir $srcdir 415 | 416 | # If source contains an URL then first 417 | # download the file to $srcfiles 418 | if [ -n "$(echo $source | grep '://')" ]; then 419 | # Yep it's an url 420 | fetch_source "$source" 421 | fi 422 | 423 | filename="$(get_source_filename "$source")" 424 | suffix=${filename##*.} # Strip down to filename suffix (strip down to the last .) 425 | echo "Unpacking $filename" 426 | # Note observe order here, since get_source_absfilename can exit with $E_BAD_FILE this 427 | # provides context for resolving! 428 | absfile="$(get_source_absfilename "$source")" 429 | # Catch any badness from the get_source function stack 430 | [ "$?" != "0" ] && error $E_BAD_FILE unpack 431 | # Determine filetype and unpack 432 | case $suffix in 433 | 'tar') ${__tar} -xf $absfile;; 434 | 'gz') ${__gzip} -dc $absfile | ${__tar} -xf -;; 435 | 'bz2') ${__bzip2} -dc $absfile | ${__tar} -xf -;; 436 | 'Z') ${__gzip} -dc $absfile | ${__tar} -xf -;; 437 | 'tgz') ${__gzip} -dc $absfile | ${__tar} -xf -;; 438 | 'xz'|'lzma') ${__xz} -dc $absfile | ${__tar} -xf -;; 439 | 'lz') ${__lzip} -dc $absfile | ${__tar} -xf -;; 440 | 'zip') ${__unzip} -q $absfile;; 441 | *) error $E_BAD_COMPRESS unpack 442 | esac 443 | if [ $? -ne 0 ]; then 444 | error $E_BAD_UNPACK unpack 445 | fi 446 | } 447 | 448 | # clean(): Scrub build environment 449 | # params: $1=stage|source|distclean 450 | clean() 451 | { 452 | local i 453 | local secname 454 | local pkgname 455 | case $1 in 456 | 'source') if [ -d "$srcdir/$topsrcdir" ]; then 457 | echo "Removing $srcdir/$topsrcdir" 458 | ${__rm} -rf $srcdir/$topsrcdir 459 | else 460 | echo "No unpacked source to scrub" 461 | fi 462 | ;; 463 | 'stage') if [ -d $stagedir -a "$stagedir" != "/" ]; then 464 | echo "Emptying $stagedir" 465 | ${__rm} -rf $stagedir # This is very dangerous! 466 | ${__mkdir} $stagedir 467 | fi 468 | # Solaris only - We can't add this to meta since compver is usually created 469 | # during install 470 | ${__rm} -f $metadir/compver.* 471 | ;; 472 | 'meta') 473 | if [ "$(${__uname} -s)" == "SunOS" ]; then 474 | for secname in $(list_pkgs) 475 | do 476 | META_CLEAN="$META_CLEAN prototype.$secname pkginfo.$secname" 477 | pkgname=$(get_pkgname $secname) 478 | echo "Removing $buildpkgbase/$pkgdir/$pkgname" 479 | [ ! -z "$pkgname" ] && ${__rm} -rf $buildpkgbase/$pkgdir/$pkgname 480 | done 481 | fi 482 | 483 | for i in $META_CLEAN 484 | do 485 | echo "Removing $metadir/$i" 486 | ${__rm} -f $metadir/$i 487 | done 488 | ;; 489 | 490 | 'distclean') clean source 491 | clean stage 492 | clean meta 493 | # Irix only - ugly hack 494 | ${__rm} -f $metadir/relnotes*.txt 495 | ;; 496 | *) error $E_BAD_CLEANOPTION clean 497 | esac 498 | } 499 | 500 | # do_strip(): strip binaries in stagedir 501 | # params: none 502 | # Automatically switches to $stagedir 503 | # On exit cwd is $stagedir 504 | do_strip() 505 | { 506 | local f 507 | setdir stage 508 | # Strip ELF binaries (see brp-strip from RPM) 509 | if [ $dostrip_elf -eq 1 ]; then 510 | do_strip_bin 511 | fi 512 | if [ $dostrip_shared -eq 1 ]; then 513 | do_strip_shared 514 | fi 515 | if [ $dostrip_static -eq 1 ]; then 516 | do_strip_static 517 | fi 518 | } 519 | 520 | # do_autonuke(): Kill unwanted files after make install 521 | # params: none 522 | # Automatically switches to $stagedir/$prefix 523 | # On exit cwd is $stagedir/$prefix 524 | do_autonuke() 525 | { 526 | local i 527 | local didnuke=0 528 | echo "Autonuking..." 529 | 530 | setdir ${stagedir}${prefix} 531 | if [ -d "${_infodir}" ]; then 532 | if [ -r ${_infodir}/dir ]; then 533 | echo "Nuking ${_infodir}/dir" 534 | ${__rm} -f ${_infodir}/dir 535 | didnuke=1 536 | fi 537 | fi 538 | if [ -d "${_libdir}" ]; then 539 | if [ -r ${_libdir}/charset.alias ]; then 540 | echo "Nuking ${_libdir}/charset.alias" 541 | ${__rm} -f ${_libdir}/charset.alias 542 | didnuke=1 543 | fi 544 | fi 545 | if [ -d "${_libdir}" -a ! -z "$(${__ls} ${_libdir}/*.la 2>/dev/null)" ]; then 546 | for i in ${_libdir}/*.la 547 | do 548 | echo "Nuking $i" 549 | ${__rm} -f "$i" 550 | done 551 | didnuke=1 552 | fi 553 | if [ $didnuke -eq 0 ]; then 554 | echo "Found nothing to nuke" 555 | fi 556 | } 557 | 558 | # symlink_man(): Convert .so style references to symlinks 559 | # params: none 560 | # Run from 'cwd' where 'cwd' contains manX subdirs 561 | symlink_man() 562 | { 563 | local i 564 | local manpage 565 | local solink 566 | local linkdest 567 | local OIFS 568 | local manpages 569 | 570 | echo "Symlinking manpages" 571 | for i in man? 572 | do 573 | if [ -d $i ]; then 574 | OIFS="$IFS" 575 | IFS=" 576 | " 577 | manpages="$(${__ls} $i/* 2>/dev/null)" 578 | for manpage in $manpages 579 | do 580 | solink="$(${__head} -n 1 $manpage)" 581 | if [ "${solink:0:3}" = ".so" ]; then # .so style link to be converted 582 | linkdest="${solink#.so*/}" 583 | [ "$symlinkman_verbose" -eq 1 ] && echo "Symlinking $linkdest->$manpage" 584 | ${__ln} -sf "$linkdest" "$manpage" 585 | fi 586 | done 587 | IFS="$OIFS" 588 | fi 589 | done 590 | } 591 | 592 | # fix_man(): create compressed pre-formatted manpages from raw ones 593 | # params: none 594 | # Run from 'cwd' where 'cwd' contains manX subdirs 595 | fix_man() 596 | { 597 | local i 598 | local catdir 599 | local manpage 600 | local TARGET 601 | 602 | echo "Formatting manpages" 603 | for i in $(${__ls} -d man? 2>/dev/null) 604 | do 605 | if [ -d $i ]; then 606 | catdir=cat${i##man} 607 | ${__mkdir} $catdir 608 | cd $i 609 | for manpage in $(${__ls} * 2>/dev/null) 610 | do 611 | if [ -L "$manpage" ]; then 612 | TARGET=$(${__ls} -l "$manpage" | ${__awk} '{ print $NF }') 613 | ${__ln} -sf "$TARGET" "$manpage" 614 | ${__mv} "$manpage" "../$catdir" 615 | ${__rm} -f "$manpage" 616 | else 617 | ${__nroff} $NROFFOPTS "$manpage" > "../$catdir/$manpage" 618 | ${__rm} -f $manpage 619 | fi 620 | done 621 | cd .. 622 | ${__rmdir} $i 623 | fi 624 | done 625 | } 626 | 627 | # compress_man(): Compress manpages 628 | # params: none 629 | # Run from 'cwd' where 'cwd' contains catX/manX subdirs 630 | compress_man() 631 | { 632 | if [ "$gzman" -eq 1 ]; then # Use gzip 633 | local compsuffix=gz 634 | local pack=${__gzip} 635 | fi 636 | if [ "$compressman" -eq 1 ]; then # Use compress(1) 637 | local compsuffix=Z 638 | local pack="${__compress} -f" 639 | fi 640 | if [ "$packman" -eq 1 ]; then # Use pack(1) 641 | local compsuffix=z 642 | local pack="${__pack} -f" 643 | fi 644 | 645 | echo "Compressing manpages" 646 | for i in $(${__ls} -d [cm]a[nt]? 2>/dev/null) 647 | do 648 | if [ -d $i ]; then 649 | cd $i 650 | for manpage in $(${__ls} * 2>/dev/null) 651 | do 652 | suffix="${manpage##*.}" 653 | if [ "$suffix" != "gz" -a "$suffix" != "Z" ]; then #probably uncompressed... 654 | if [ -L "$manpage" ]; then 655 | TARGET=$(${__ls} -l "$manpage" | ${__awk} '{ print $NF }') 656 | ${__ln} -sf "$TARGET".$compsuffix "$manpage".$compsuffix 657 | ${__rm} -f "$manpage" 658 | else 659 | $pack "$manpage" 660 | fi 661 | fi 662 | done 663 | cd .. 664 | fi 665 | done 666 | } 667 | 668 | # compress_info(): Compress GNU info pages 669 | # params: none 670 | # Run from 'cwd' where 'cwd' is the dir contains uncompressed info pages 671 | compress_info() 672 | { 673 | echo "Compressing info pages" 674 | for i in * 675 | do 676 | ${__gzip} $i 677 | done 678 | } 679 | 680 | # doc(): Add files from srcdir to 'docs' location 681 | # params: $1..$x 682 | # Copies files from $srcdir to $_docdir/$topdir-$version 683 | doc() 684 | { 685 | local f 686 | local ddir # Holds internal value of _docdir 687 | 688 | if [ ! -z $# ]; then 689 | setdir source 690 | ddir=${stagedir}${prefix}/${_docdir}/${topdir}-${version} 691 | ${__mkdir} -p $ddir 692 | echo "Adding docs" 693 | until [ -z "$1" ] 694 | do 695 | for f in $(_upls $1) 696 | do 697 | (${__tar} -cf - "$f")|(cd $ddir; ${__tar} -xvBpf -) 698 | done 699 | shift 700 | done 701 | fi 702 | } 703 | 704 | # compute_octal() 705 | # Description: Computes the octal value from a permission list (_rwxrwxrwx) 706 | # param: $1=permission list 707 | # Caveats: It won't pickup sticky bit and mandatory locking bit 708 | compute_octal() 709 | { 710 | local perm=$1 711 | local v=0; local d1=0; local d2=0; local d3=0; local d4=0 712 | # User part 713 | if [ "${perm:1:1}" == "r" ]; then 714 | let "v = v + 4" # set read bit 715 | fi 716 | if [ "${perm:2:1}" == "w" ]; then 717 | let "v = v + 2" # set write bit 718 | fi 719 | if [ "${perm:3:1}" == "x" ]; then 720 | let "v = v + 1" # set executable bit 721 | elif [ "${perm:3:1}" == "s" ]; then 722 | let "v = v + 1" # set executable bit 723 | let "d1 = d1 + 4" # Set setuid bit 724 | fi 725 | d2=$v; v=0 726 | # Group part 727 | if [ "${perm:4:1}" == "r" ]; then 728 | let "v = v + 4" # set read bit 729 | fi 730 | if [ "${perm:5:1}" == "w" ]; then 731 | let "v = v + 2" # set write bit 732 | fi 733 | if [ "${perm:6:1}" == "x" ]; then 734 | let "v = v + 1" # set executable bit 735 | elif [ "${perm:6:1}" == "s" ]; then 736 | let "v = v + 1" # set executable bit 737 | let "d1 = d1 + 2" # Set setgid bit 738 | fi 739 | d3=$v; v=0; 740 | # Other part 741 | if [ "${perm:7:1}" == "r" ]; then 742 | let "v = v + 4" # set read bit 743 | fi 744 | if [ "${perm:8:1}" == "w" ]; then 745 | let "v = v + 2" # set write bit 746 | fi 747 | if [ "${perm:9:1}" == "x" ]; then 748 | let "v = v + 1" # set executable bit 749 | fi 750 | d4=$v; v=0 751 | echo $d1$d2$d3$d4 752 | } 753 | 754 | # check_changelog(): Verify that the ChangeLog is updated 755 | # params: none 756 | # Verify that the ChangeLog exists and contains an entry for the current 757 | # version of the software 758 | check_changelog() 759 | { 760 | if [ -r $metadir/ChangeLog ]; then 761 | # See if we can find an entry for this build otherwise complain 762 | if [ -z "$(${__grep} ${version}-${pkgver}$ $metadir/ChangeLog)" ]; then 763 | error $E_MISSING_CHGLOGV check_changelog 764 | fi 765 | else 766 | error $E_MISSING_CHGLOG check_changelog 767 | fi 768 | } 769 | 770 | # do_gnu_link: Create symlinks in $prefix/$_gnudir 771 | # params: list of programs to link 772 | # For each program given, create a symlink from $prefix/${_bindir}/program to 773 | # $prefix/gnu with the first character stripped from the name 774 | do_gnu_link() 775 | { 776 | local program 777 | 778 | ${__mkdir} -p ${stagedir}${prefix}/$_gnudir 779 | cd ${stagedir}${prefix}/$_gnudir 780 | 781 | for program in $@ 782 | do 783 | local dest=${program:1} 784 | echo "Linking $prefix/${_bindir}/$program to $prefix/$_gnudir/$dest" 785 | ${__ln_s} ../${_bindir}/$program ${dest} 786 | done 787 | } 788 | 789 | # gnu_link: Prepare for gnu symlink setup 790 | # params: list of programs to link 791 | # Each param is added to the internal gnu_link_progs array 792 | # It will also add --program-prefix=$gnu_prefix to configure_args if requested 793 | gnu_link() 794 | { 795 | local item 796 | for item in "$@" 797 | do 798 | gnu_link_progs+=($item) 799 | done 800 | [ $gnu_configure -eq 1 ] && configure_args=(--program-prefix=$gnu_prefix "${configure_args[@]}") 801 | } 802 | 803 | ##################################################### 804 | # Define generic functions for different build stages 805 | ##################################################### 806 | 807 | # generic_prep(): Unpack source and apply any patches 808 | # params: none 809 | generic_prep() 810 | { 811 | clean source 812 | 813 | # Sweep ${#source[@]} and ${#patch[@]} for URL's and download any files 814 | # needed 815 | get_files 816 | 817 | unpack 0 818 | 819 | # Verify that ${patch[$pnum]} is defined 820 | local pver=${patch[0]-'x'} 821 | if [ "$pver" == "x" ]; then 822 | return # it was undefined 823 | else 824 | local numpatch=${#patch[@]} 825 | local i=0 826 | # Argh! - The C-style for loop doesn't work in bash-2.0.3 as distributed 827 | # with Solaris 8 :( (it works just fine on Redhat Linux 7.3, bash 2.0.5a) 828 | # for ((i=0; i < numpatch; i++)) 829 | # do 830 | # patch $i -p1 831 | # done 832 | while [ $i -lt $numpatch ] 833 | do 834 | patch $i $patch_prefix 835 | let i=i+1 836 | done 837 | fi 838 | } 839 | 840 | # generic_build(): Take the necessary steps to build already prepared source 841 | # params: $1 = dir to descend to *inside* "source" - optional 842 | generic_build() 843 | { 844 | local my_ac_overrides="$platform_ac_overrides $ac_overrides" 845 | setdir ${srcdir}/${topsrcdir}/$1 846 | 847 | if [ $no_configure -eq 0 ]; then 848 | if [ $generic_configure -eq 1 ]; then 849 | local acvar 850 | for acvar in $my_ac_overrides 851 | do 852 | export $acvar 853 | done 854 | echo $__configure "${configure_args[@]}" 855 | $__configure "${configure_args[@]}" 856 | else 857 | # Platform specific configure run 858 | run_configure 859 | fi 860 | fi 861 | if [ $? -ne 0 ]; then 862 | error $E_BAD_CONFIG generic_build 863 | fi 864 | ${__make} ${make_build_opts} $(_upls $make_build_target) 865 | if [ $? -ne 0 ]; then 866 | error $E_BAD_MAKE generic_build 867 | fi 868 | } 869 | 870 | # generic_check(): Run the check target 871 | # params: $1 = dir to descend to *inside* "source" - optional 872 | generic_check() 873 | { 874 | setdir ${srcdir}/${topsrcdir}/$1 875 | ${__make} -k $(_upls $make_check_target) 876 | } 877 | 878 | # generic_build_perl(): Build a perl module from source 879 | # params: same as generic_build 880 | # This is based on code ripped out of a RPM specfile generated 881 | # by cpan2rpm. Someday perhaps cpan2inst will come to exist but 882 | # until then this is a bit of shortcut for build.sh 883 | # 884 | generic_build_perl() 885 | { 886 | setdir source 887 | ${__ggrep} -rsl '^#!.*perl' . | 888 | ${__ggrep} -v '.bak$' |${__xargs} --no-run-if-empty \ 889 | ${__perl} -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)' 890 | ${__perl} Makefile.PL `${__perl} -MExtUtils::MakeMaker -e " print qq|PREFIX=${stagedir}${prefix}| if \$ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ "` 891 | # Now do the actual build using std. generic_build with no_configure=1 892 | no_configure=1 893 | generic_build 894 | # And a little extra, this is a candidate for inclusion in plain generic_build 895 | if [ "$maketest" -eq 1 ]; then 896 | ${__make} test 897 | fi 898 | } 899 | 900 | # makeinstall(): Generic make install ripped from rpm 901 | # params: $@ passed directly to make install 902 | makeinstall() 903 | { 904 | ${__make} \ 905 | prefix=${stagedir}${prefix} \ 906 | exec_prefix=${stagedir}${prefix} \ 907 | bindir=${stagedir}${prefix}/${_bindir} \ 908 | sbindir=${stagedir}${prefix}/${_sbindir} \ 909 | sysconfdir=${stagedir}${prefix}/${_sysconfdir} \ 910 | datadir=${stagedir}${prefix}/${_sharedir} \ 911 | includedir=${stagedir}${prefix}/${_includedir} \ 912 | libdir=${stagedir}${prefix}/${_libdir} \ 913 | libexecdir=${stagedir}${prefix}/libexec \ 914 | localstatedir=${stagedir}${prefix}/var \ 915 | sharedstatedir=${stagedir}${prefix}/com \ 916 | mandir=${stagedir}${prefix}/${_mandir} \ 917 | infodir=${stagedir}${prefix}/${_infodir} \ 918 | install $@ 919 | } 920 | 921 | # generic_install(): Install already built source 922 | # params: $1 = destvar [$2 = dir to descend to *inside* "source"] 923 | # destvar is the variable that make should override to install into the staging 924 | # area. default is DESTDIR, possible common alternatives are prefix and PREFIX 925 | # If shortroot=1 then we know that the install won't automatically create 926 | # $prefix inside the stagedir so we have to do it first and add $prefix 927 | # to the $destvar= argument 928 | # If $2 is specified then we will descend into that subdir before attempting the install 929 | generic_install() 930 | { 931 | local dest="$stagedir" 932 | local destvar=${1:-DESTDIR} 933 | 934 | if [ "$custom_install" -eq 0 ]; then 935 | clean stage 936 | [ "$shortroot" -eq 1 ] && dest="${stagedir}${prefix}" 937 | # Create $dest if it is missing 938 | if [ ! -d $dest ]; then 939 | echo "Creating $dest" 940 | ${__mkdir} -p $dest 941 | fi 942 | setdir ${srcdir}/${topsrcdir}/$2 943 | ${__make} $(_upls $make_install_target) $destvar=$dest 944 | if [ $? -ne 0 ]; then 945 | error $E_BAD_MAKE generic_install 946 | fi 947 | fi 948 | if [ $dostrip -eq 1 ]; then 949 | do_strip 950 | fi 951 | if [ $autonuke -eq 1 ]; then 952 | do_autonuke 953 | fi 954 | # If there are programs that should be linked to $prefix/$_gnudir 955 | local prog 956 | for prog in "${gnu_link_progs[@]}"; do 957 | do_gnu_link ${gnu_prefix}${prog} 958 | done 959 | } 960 | 961 | # generic_install_perl(): Install already built perl module 962 | # params: none 963 | # This is based on code ripped out of a RPM specfile generated 964 | # by cpan2rpm. Someday perhaps cpan2inst will come to exist but 965 | # until then this is a bit of shortcut for build.sh 966 | generic_install_perl() 967 | { 968 | clean stage 969 | setdir source 970 | makeinstall $(${__perl} -MExtUtils::MakeMaker -e " print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=${stagedir}${prefix}| : qq|DESTDIR=${stagedir}| ") 971 | 972 | # remove special files 973 | ${__find} ${stagedir} -name "perllocal.pod" \ 974 | -o -name ".packlist" \ 975 | -o -name "*.bs" \ 976 | | ${__xargs} -i rm -f {} 977 | 978 | # no empty directories 979 | ${__find} ${stagedir}${prefix} \ 980 | -type d -depth \ 981 | -exec rmdir {} \; 2>/dev/null 982 | 983 | export BUILDROOT="$stagedir" 984 | 985 | ${__perl} -MFile::Find -le ' 986 | my $buildroot = $ENV{BUILDROOT}; 987 | find({ wanted => \&wanted, no_chdir => 1}, "$buildroot"); 988 | # No docs here, add them in the usual way but to pkgdef.template 989 | #print "doc samples Parser Expat Changes README"; 990 | for my $x (sort @dirs, @files) { 991 | push @ret, $x unless indirs($x); 992 | } 993 | print join "\n", sort @ret; 994 | 995 | sub wanted { 996 | return if /auto$/; 997 | 998 | local $_ = $File::Find::name; 999 | my $f = $_; s|^\Q$buildroot\E||; 1000 | return unless length; 1001 | return $files[@files] = $_ if -f $f; 1002 | 1003 | $d = $_; 1004 | /\Q$d\E/ && return for reverse sort @INC; 1005 | # This will expand everything outside the "perl" paths 1006 | # to files. cpan2rpm includes the mandir in this list 1007 | # but that will break buildpkg since they are processed 1008 | # later and the names thus change leaving pkgdef broken 1009 | $d =~ /\Q$_\E/ && return 1010 | for qw|/etc /usr/tgcware/bin /usr/tgcware/share|; 1011 | 1012 | $dirs[@dirs] = $_; 1013 | } 1014 | 1015 | sub indirs { 1016 | my $x = shift; 1017 | $x =~ /^\Q$_\E\// && $x ne $_ && return 1 for @dirs; 1018 | } 1019 | ' > filelist 1020 | 1021 | [ -z filelist ] && { 1022 | echo "ERROR: empty %files listing" 1023 | exit -1 1024 | } 1025 | # For handling any doc lines in the filelist, disabled for now (see above) 1026 | #eval $(${__grep} '^doc' filelist) 1027 | 1028 | # To get stripping etc we call the regular generic_install now but with custom_install=1 1029 | custom_install=1 1030 | generic_install 1031 | } 1032 | 1033 | # generic_pack(): Build package using files from 'install' stage 1034 | # params: $1 - indicating whether or not the root is complete as described below 1035 | # We expect generic_install to have made $stagedir the "root" dir 1036 | # in that all paths below will be complete (ie. /usr/local/bin and not 1037 | # just bin). 1038 | # 1039 | # This function should be implemented in the pr. packaging system 1040 | # function library. 1041 | case $OSTYPE in 1042 | solaris*) . $buildpkgscripts/buildpkg.packaging.solaris 1043 | ;; 1044 | irix*) . $buildpkgscripts/buildpkg.packaging.irix 1045 | ;; 1046 | *) echo "No packaging system function library available for this OS" 1047 | ;; 1048 | esac 1049 | 1050 | # generic_pack_perl(): Package a perl module 1051 | # params: same as generic_pack 1052 | # This is just a small wrapper which generates the pkgdef file 1053 | # from pkgdef.template and the filelist in the sourcetree generated 1054 | # by generic_install_perl. 1055 | generic_pack_perl() 1056 | { 1057 | ${__cat} $metadir/pkgdef.template $srcdir/$topsrcdir/filelist | ${__sed} -e "s;^$prefix/;;g" > $metadir/pkgdef 1058 | generic_pack "$@" 1059 | } 1060 | 1061 | # vim: set filetype=sh : # 1062 | # vim: set sts=4 : # 1063 | # vim: set shiftwidth=4 : # 1064 | -------------------------------------------------------------------------------- /buildpkg.packaging.irix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgc/buildpkg/78e516ad61e8da74c0130119283ca64542e177f6/buildpkg.packaging.irix -------------------------------------------------------------------------------- /buildpkg.packaging.solaris: -------------------------------------------------------------------------------- 1 | # Function library for buildpkg framework 2 | # It adds support for creating Solaris packages in 'sysv' format 3 | # Copyright (C) 2003-2019 Tom G. Christensen 4 | 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # Written by Tom G. Christensen . 19 | 20 | # 21 | # Define tool programs 22 | # *only* platform specific tools should be listed here 23 | # generic tools go in buildpkg.functions 24 | PKGMK=/usr/bin/pkgmk 25 | PKGTRANS=/usr/bin/pkgtrans 26 | 27 | # Override generic location 28 | __strip=/usr/ccs/bin/strip 29 | # /usr/ccs/bin/strip destroys the symbol table in static archives 30 | # So this is disabled by default 31 | dostrip_static=0 32 | 33 | # Setup default args for strip. They match SGU 4.0 from Solaris 8 34 | # Change these if you're using strip from GNU Binutils (recommended) 35 | strip_elf_args="" # GNU default is -g 36 | strip_shared_args="" # GNU default is --strip-unneeded 37 | strip_static_args="" # GNU default is -g 38 | 39 | META_CLEAN="prototype prototype.in pkginfo files.tmp depend.*.auto depend.*.all sums sums.*" 40 | 41 | # Define defaults 42 | # pkginfo information. 43 | # Override as necessary. 44 | pkgcat="application" # A reasonable default 45 | pkgvendor="http://change/me/please" 46 | pkgdesc="mumble mubmle... hmm someone forgot to fill this out!" 47 | 48 | # vendor & contact information 49 | pkgedby="Tom G. Christensen" 50 | email=swpkg@jupiterrise.com 51 | 52 | # Set some helper vars that describes arch and OS version 53 | arch=`uname -p` 54 | [ "$arch" = "sparc" ] && { vendor="sun"; sparc=1; } || { vendor="pc"; intel=1; } 55 | os=sunos`${__uname} -r` 56 | gnu_os_ver=$(${__uname} -r | ${__sed} -e 's/^5/2/') 57 | 58 | # By default, the build_arch is the same as arch, alternatives are sparc64 and 59 | # x86_64. It should be set to either when building for tgcware64. 60 | build_arch=$arch 61 | 62 | # Default pkginfo.in file 63 | pkginfo=$buildpkgscripts/pkginfo.in 64 | 65 | # Variables that control functionality 66 | usedepend=1 # default to looking for a depend file in $metadir 67 | usescripts=1 # default to add pre/post scripts if available 68 | usespace=1 # default to looking for a space file in $metadir 69 | usecompver=1 # default to add compver if available in $metadir 70 | ignore_unpackaged_files=0 # default to check for unpackaged files in the stage area 71 | deps_resolve_symlinks=0 # Set to 1 to resolve symlinks before computing deps (requires GNU readlink) 72 | create_versioned_deps=1 # Set to 1 to create versioned dependencies 73 | version_all_deps=0 # Set to 1 to add version on *all* deps, even SUNW (if enabled) 74 | include_all_deps=1 # Set to 1 to create deps on packages regardless of vendor 75 | 76 | # Maximum length of the PKG attribute in pkginfo(4) files 77 | # According to pkginfo(4) this is limited to 9 characters on Solaris < 9 78 | # and 32 characters on Solaris 9 and later. 79 | # However more than 9 chars seems to work fine on Solaris 7 & 8. 80 | case $os in 81 | sunos5.[0123456]) maxpkgnamelen=9;; 82 | *) maxpkgnamelen=32;; 83 | esac 84 | 85 | # To exclude a dependency, add its name to this variable 86 | ignore_deps="" 87 | 88 | # Solaris doesn't know how to handle any kind of compressed manpages 89 | gzman=0 90 | 91 | # If not using gcc then please set this to 1 92 | suncc=0 93 | 94 | # Try and get it right from the beginning on Solaris 95 | _mandir=share/man 96 | _infodir=share/info 97 | 98 | # Default configure args 99 | configure_args=(--prefix=$prefix --mandir=${prefix}/${_mandir} --infodir=${prefix}/${_infodir}) 100 | 101 | # Host specific configuration 102 | [ -r $buildpkgscripts/config.`hostname`.solaris ] && . $buildpkgscripts/config.`hostname`.solaris 103 | 104 | # Distfiles should be named like this 105 | # --.sb--- 106 | # ie: libmad-0.14.2b-1.sb-sol5.8-sparc-local 107 | # We hardquote it so that we can control when we want it 108 | # evaluated (using _upls) 109 | distfile='$secname-$version-$secver.tgc-$os-$build_arch-$pkgdirdesig' 110 | 111 | # What pkgdef file to use 112 | pkgdef_file=pkgdef 113 | # Check and see if there is an arch specific pkgdef file 114 | [ -r $metadir/pkgdef.$arch ] && pkgdef_file=pkgdef.$arch 115 | [ -r $metadir/pkgdef.$build_arch ] && pkgdef_file=pkgdef.$build_arch 116 | 117 | ##################################################### 118 | # "external" functions 119 | ##################################################### 120 | 121 | # make_pkg(): Create the final package 122 | # params: $1 = meta file suffix 123 | # 124 | make_pkg() 125 | { 126 | if [ $# -lt 1 ]; then 127 | error $E_MISSING_ARGS make_pkg 128 | fi 129 | local secname=$1 130 | local prototype=prototype.$secname 131 | 132 | local secver=$(get_pkgrev $secname) 133 | local dfile=$(_upls $distfile) 134 | local pname=$(get_pkgname $secname) 135 | 136 | echo "Creating package and transferring it to datastream format" 137 | $PKGMK -r `pwd` -d $buildpkgbase/$pkgdir -o -f $metadir/$prototype 138 | $PKGTRANS -o -s $buildpkgbase/$pkgdir $distdir/$dfile $pname 139 | echo "Done. Package was created as $dfile" 140 | } 141 | 142 | # pack_info(): Create the pkginfo file 143 | # params: $1 = metafile suffix 144 | # Will create the pkginfo file with pkginfo.in as a template 145 | # Both the template and the result will be in $metadir 146 | # Substitutions will be done on pkgname,version,pkgver,name & topinstalldir 147 | # they will be replaced with the value of their variable counterparts 148 | pack_info() 149 | { 150 | if [ $# -lt 1 ]; then 151 | error $E_MISSING_ARGS pack_info 152 | fi 153 | local secname=$1 154 | 155 | local pstamp="$os-$(${__uname} -n)`date '+%Y%m%d%H%M'`" 156 | 157 | # Check length of pkgname and name to make sure we're within limits 158 | [ ${#pkgname} -gt $maxpkgnamelen ] && error $E_SVR4_PKG_OVERFLOW pack_info 159 | [ ${#name} -gt 256 ] && error $E_SVR4_NAME_OVERFLOW pack_info 160 | 161 | ${__sed} -e "s#%%pkgname%%#$pkgname#g" \ 162 | -e "s#%%version%%#$version#g" \ 163 | -e "s#%%pkgcat%%#$pkgcat#g" \ 164 | -e "s#%%pkgvendor%%#$pkgvendor - packaged by $pkgedby#g" \ 165 | -e "s#%%pkgver%%#$pkgver#g" \ 166 | -e "s#%%name%%#$name#g" \ 167 | -e "s#%%topinstalldir%%#$topinstalldir#g" \ 168 | -e "s#%%pkgdesc%%#$pkgdesc#g" \ 169 | -e "s#%%pstamp%%#$pstamp#g" \ 170 | -e "s#%%email%%#$email#g" \ 171 | -e "s#%%maxinst%%#$maxinst#g" \ 172 | -e "s#%%arch%%#$arch#g" \ 173 | $pkginfo > $metadir/pkginfo.$secname 174 | } 175 | 176 | # list_pkgs(): Find all the section names of all defined pkgs 177 | # params: none 178 | list_pkgs() 179 | { 180 | local i 181 | local it 182 | # We can't rely on shell expansion here since we would be burned if * is empty! 183 | for i in $(${__ls} -1 $metadir/prototype.* 2>/dev/null) 184 | do 185 | it=$(${__basename} $i) 186 | echo ${it##prototype.} 187 | done 188 | } 189 | 190 | # add_meta_file(): add a metafile entry to the prototype file 191 | # params: $1 = keyword $2 = filename $3 = metafile suffix 192 | # Additions will be done to the file $metadir/prototype 193 | add_meta_file() 194 | { 195 | if [ $# -lt 3 ]; then 196 | error $E_MISSING_ARGS add_meta_file 197 | fi 198 | local secname=$3 199 | if [ -r "$2" ]; then 200 | echo "i $1=$2" >> $metadir/prototype.$secname 201 | else 202 | error $E_BAD_FILE add_meta_file 203 | fi 204 | } 205 | 206 | # add_scripts(): Add scripts to prototype 207 | # params: $1 = metafile suffix 208 | add_scripts() 209 | { 210 | if [ $# -lt 1 ]; then 211 | error $E_MISSING_ARGS add_scripts 212 | fi 213 | local secname=$1 214 | 215 | # If a dependency file is available then use it 216 | if [ $usedepend -eq 1 ]; then 217 | [ -r $metadir/depend.$secname ] && cat $metadir/depend.$secname > $metadir/depend.${secname}.all 218 | [ -r $metadir/depend.${secname}.auto ] && cat $metadir/depend.${secname}.auto >> $metadir/depend.${secname}.all 219 | add_meta_file depend "$metadir/depend.${secname}.all" $secname 220 | fi 221 | 222 | # If a compver file is available then use it 223 | [ -r $metadir/compver.$secname -a $usecompver -eq 1 ] && add_meta_file compver "$metadir/compver.$secname" $secname 224 | 225 | # If a space file is available then use it 226 | [ -r $metadir/space.$secname -a $usespace -eq 1 ] && add_meta_file space "$metadir/space.$secname" $secname 227 | 228 | if [ $usescripts -eq 1 ]; then 229 | [ -r $metadir/preinstall.$secname ] && add_meta_file preinstall "$metadir/preinstall.$secname" $secname 230 | [ -r $metadir/postinstall.$secname ] && add_meta_file postinstall "$metadir/postinstall.$secname" $secname 231 | [ -r $metadir/preremove.$secname ] && add_meta_file preremove "$metadir/preremove.$secname" $secname 232 | [ -r $metadir/postremove.$secname ] && add_meta_file postremove "$metadir/postremove.$secname" $secname 233 | fi 234 | } 235 | 236 | # add_file(): add a file entry to the prototype file 237 | # params: $1 = owner $2 = group $3 = permissions $4 = filename $5 = metafile suffix 238 | # Additions will be done to the file $metadir/prototype 239 | # $4 must be relative to $stagedir$prefix (or just $stagedir if using shortroot) 240 | add_file() 241 | { 242 | if [ $# -lt 5 ]; then 243 | error $E_MISSING_ARGS add_file 244 | fi 245 | local owner=$1 246 | local group=$2 247 | local perms=$3 248 | local file=$4 249 | local secname=$5 250 | 251 | if [ -r "$file" ]; then 252 | echo "f none $file $perms $owner $group" >> $metadir/prototype.$secname 253 | else 254 | error $E_BAD_FILE add_file 255 | fi 256 | } 257 | 258 | # add_proto(): Add entries to prototype file 259 | # params: $1 = permission $2 = owner $3 = group $4 = filespec $5 = metafile suffix 260 | # $5 is usually the section header from pkgdef 261 | # Additions will be done to the file $metadir/prototype.$secname 262 | add_proto() 263 | { 264 | if [ $# -lt 5 ]; then 265 | error $E_MISSING_ARGS add_proto 266 | fi 267 | local i 268 | local defperm=$1 269 | local owner=$2 270 | local group=$3 271 | local fspec=$(_upls $4) 272 | local secname=$5 273 | 274 | local FILES=$(${__find} $fspec -type f -print|${__tee} -a $metadir/files.tmp) 275 | OIFS=$IFS 276 | IFS=" 277 | " 278 | for i in $FILES 279 | do 280 | IFS=$OIFS 281 | if [ "$defperm" == "-" ]; then 282 | permlist=$(${__ls} -l "$i" | ${__cut} -d " " -f 1) 283 | perm=$(compute_octal $permlist) 284 | else 285 | perm=$defperm 286 | fi 287 | echo "f none $i $perm $owner $group" >> $metadir/prototype.$secname 288 | done 289 | IFS=$OIFS 290 | # Handle symlinks 291 | local FILES=$(${__find} $fspec -type l -print|${__tee} -a $metadir/files.tmp) 292 | OIFS=$IFS 293 | IFS=" 294 | " 295 | for i in $FILES 296 | do 297 | IFS=$OIFS 298 | if [ "$defperm" == "-" ]; then 299 | permlist=$(${__ls} -l "$i" | ${__cut} -d " " -f 1) 300 | perm=$(compute_octal $permlist) 301 | fi 302 | local temp=`${__ls} -l "$i"|${__cut} -d '>' -f 2` 303 | local symval=${temp# } 304 | echo "s none $i=$symval $perm $owner $group" >> $metadir/prototype.$secname 305 | done 306 | IFS=$OIFS 307 | # Handle directories 308 | local FILES=$(${__find} $fspec -type d -print|${__tee} -a $metadir/files.tmp) 309 | OIFS=$IFS 310 | IFS=" 311 | " 312 | for i in $FILES 313 | do 314 | IFS=$OIFS 315 | if [ "$defperm" == "-" ]; then 316 | permlist=$(${__ls} -ld "$i" | ${__cut} -d " " -f 1) 317 | perm=$(compute_octal $permlist) 318 | else 319 | perm=$defperm 320 | fi 321 | echo "d none $i $perm $owner $group" >> $metadir/prototype.$secname 322 | done 323 | IFS=$OIFS 324 | # Handle hardlinks - FIXME! 325 | } 326 | 327 | # add_dir(): Add a single dir to prototype file 328 | # params: $1 = perms $2 = owner $3 = group $4 = dir $5 = metafile suffix 329 | add_dir() 330 | { 331 | if [ $# -lt 5 ]; then 332 | error $E_MISSING_ARGS add_dir 333 | fi 334 | local defperm=$1 335 | local owner=$2 336 | local group=$3 337 | local dir=$(_upls $4) 338 | local secname=$5 339 | 340 | if [ "$defperm" == "-" ]; then 341 | permlist=$(${__ls} -ld "$dir" | ${__cut} -d " " -f 1) 342 | perm=$(compute_octal $permlist) 343 | else 344 | perm=$defperm 345 | fi 346 | echo "d none $dir $perm $owner $group" >> $metadir/prototype.$secname 347 | echo "$dir" >> $metadir/files.tmp 348 | } 349 | 350 | # identify_compiler(): This outputs information about the compiler 351 | # params: $1 = { log } 352 | # This generates the compiler information used in relnotes and logging 353 | identify_compiler() 354 | { 355 | local mycc 356 | local compiler 357 | local compiler_temp 358 | 359 | if [ $suncc -eq 0 ]; then 360 | [ -n "$CC" ] && mycc=$CC || mycc=gcc 361 | [ "$1" = "log" ] && $mycc -v 362 | compiler="$($mycc -v 2>&1 | ${__sed} -n '/^gcc/p')" 363 | else # not gcc 364 | [ -n "$CC" ] && mycc=$CC || mycc=cc 365 | [ "$1" = "log" ] && $mycc -version 366 | compiler="$($mycc -version 2>&1)" 367 | if [ "$CXX" = "g++" ]; then 368 | # SUN cc with gnu g++ 369 | [ "$1" = "log" ] && $CXX -v 370 | compiler_temp="$($CXX -v 2>&1 | ${__sed} -n '/^gcc/ s/gcc/g++/p')" 371 | compiler="$((echo $compiler; echo $compiler_temp) | ${__awk} '{ printf "%s\\n",$0 }')" 372 | compiler="${compiler%\\*}" 373 | fi 374 | fi 375 | [ -z "$1" ] && echo "$compiler" 376 | } 377 | 378 | # auto_rel(): Fix up and add releasenotes to stagedir 379 | # params: $1 = secname 380 | # This will make some substitutions on a release note template 381 | # and then copy the result to $stagedir/${metainstalldir}relnotes/$topdir-$version-$pkgver.txt 382 | auto_rel() 383 | { 384 | local secname=$1 385 | local i 386 | local rn 387 | 388 | for i in relnotes relnotes.${_os} relnotes.$secname relnotes.${_os}.$secname 389 | do 390 | [ -r ${metadir}/${i} ] && rn=${metadir}/$i 391 | done 392 | # No local relnotes use global template 393 | if [ ! -r "${rn}" ]; then 394 | echo "auto_rel: Using global relnotes template" 395 | rn=$buildpkgscripts/relnotes.template.irix 396 | fi 397 | local relmetadir=${stagedir}${metainstalldir}relnotes/$secname-$version-$pkgver 398 | ### compute configure info for relnotes 399 | [ -n "$ac_overrides" ] && local aco="$(for ar in $ac_overrides; do echo $ar; done | ${__awk} '{ printf "%s \\\\ \\n",$0 }')" 400 | local fullcf="${aco}${__configure} "${configure_args[@]}"" 401 | ### 402 | local pkgnam=$(get_pkgname $secname) 403 | local vendor=$(get_pkgvendor $secname) 404 | local packager="${pkgedby} <${email}>" 405 | ### Compute SHA1 sums for all source entries 406 | local s 407 | local path 408 | local file 409 | local source_sha1sum 410 | local temp_source_sha1sum="" 411 | # older bash 2.x doesn't like C-style for loops (observed on Solaris 2.x) 412 | #for ((snum=0; $snum < ${#source[@]}; s++)) 413 | local snum=0 414 | while [ $snum -lt ${#source[@]} ] 415 | do 416 | path="$(get_source_path ${source[$snum]})" 417 | file="$(get_source_filename ${source[$snum]})" 418 | (cd "$path"; ${__sha1sum} "$file") >> $metadir/sums.${secname} 419 | let snum=snum+1 420 | done 421 | [ -r "$metadir/sums.${secname}" ] && temp_source_sha1sum="$(cat $metadir/sums.${secname} | ${__awk} '{ printf "%s\\n",$0 }')" 422 | source_sha1sum="${temp_source_sha1sum%\\*}" 423 | ### End of SHA1 sum computing 424 | ### Extract environtment variables 425 | local temp_extracted_env="$(${__sed} -e 's/export /echo ENV /g' ${buildpkgbase}/${pkgdir}/build.sh | ${__bash} | ${__sed} -n 's/^ENV \([^=]*\)=.*/echo \1=$\1/p' | ${__bash} | ${__awk} '{ printf "%s\\n",$0 }')" 426 | # Remove trailing \n 427 | local extracted_env="${temp_extracted_env%\\*}" 428 | ### 429 | ### Add dependencies 430 | local temp_deps="$(${__cat} $metadir/depend.$secname.all | ${__sed} -e '/^$/d;/^ /d' | ${__sort} -u | ${__sed} -e 's;\&;\\&;g' | ${__awk} '{ printf "%s\\n",$0 }')" 431 | local deps="${temp_deps%\\*}" 432 | ### 433 | ${__mkdir} -p $relmetadir 434 | ${__gsed} -e "s;%%PKGNAME%%;${pkgnam};g" \ 435 | -e "s;%%SOURCE_AND_VER%%;${topdir}-${version};g" \ 436 | -e "s;%%CONFIGURE%%;${fullcf};g" \ 437 | -e "s;%%COMPILER%%;$(identify_compiler);g" \ 438 | -e "s;%%VENDOR%%;${vendor};g" \ 439 | -e "s;%%PKGEDBY%%;${packager};g" \ 440 | -e "s;%%SOURCE_SHA1SUM%%;${source_sha1sum};g" \ 441 | -e "s;%%ENVIRONMENT%%;${extracted_env};g" \ 442 | -e "s;%%DEPENDENCIES%%;${deps};g" \ 443 | ${rn} > "$relmetadir/${secname}.txt" 444 | 445 | # Add a ChangeLog 446 | echo "auto_rel: Adding ChangeLog to relnotes" 447 | echo >> "$relmetadir/${secname}.txt" 448 | cat $metadir/ChangeLog >> "$relmetadir/${secname}.txt" 449 | 450 | ### Add the relnotes to the prototype file 451 | add_dir $defaultperms $defaultuid $defaultgid "${metaprefix}relnotes" $secname 452 | add_proto $defaultperms $defaultuid $defaultgid "${metaprefix}relnotes/$secname-$version-$pkgver" $secname 453 | } 454 | 455 | # auto_dir(): Make sure all necessary dir entries are in prototype 456 | # param: $1 = secname 457 | # To avoid an endless amount of dir entries in the pkgdef this 458 | # function will try to automatically determine all the needed 459 | # entries and then add anyone missing 460 | auto_dir() 461 | { 462 | local secname=$1 463 | 464 | local fdirs 465 | local ddirs 466 | local i 467 | local j 468 | 469 | fdirs=$(${__awk} '/^[fs]/ { print $3 }' $metadir/prototype.$secname | ${__sed} -e 's,\(.*\)=.*$,\1,' | ${__sed} -e 's,\(.*\)/.*$,\1,' | ${__sort} -u) 470 | ddirs=$(${__awk} '/^d/ { print $3 }' $metadir/prototype.$secname | ${__sort} -u) 471 | 472 | for i in $fdirs 473 | do 474 | # Ugly, but we need to strip first in the while loop to be able to 475 | # determine exit condition properly 476 | local path_comp="$i/dummy" 477 | local done=0 478 | # for each fdir we verify that all path components have dir entries 479 | # by checking with ddirs. If one is missing it is added 480 | while [ $done -eq 0 ] 481 | do 482 | # To see if we're done the string must be the same after stripping 483 | [ "$path_comp" = "${path_comp%/*}" ] && done=1 484 | path_comp=${path_comp%/*} 485 | #echo "auto_dir: Checking $path_comp" 486 | local found=0 487 | for j in $ddirs 488 | do 489 | if [ "$path_comp" = "$j" ]; then 490 | found=1 491 | break 492 | fi 493 | done 494 | if [ "$found" -eq 0 ]; then 495 | # No match, we must add an entry 496 | ddirs="$(echo $ddirs $path_comp)" 497 | ### FIXME defaultperms, defaultuid and defaultgid as essentially uninitialized here! 498 | add_dir $defaultperms $defaultuid $defaultgid "$path_comp" $secname # Add dir entry 499 | echo "auto_dir: Adding $path_comp for $secname" 500 | fi 501 | done 502 | done 503 | } 504 | 505 | # dep_pkg_name: Given a filename it will look it up and find the PKGNAME 506 | # Params: A list of filenames 507 | # For each file we use pkgchk -l -p to find the package containing it 508 | dep_pkg_name() 509 | { 510 | local pkg 511 | local i 512 | while read files 513 | do 514 | for i in $files 515 | do 516 | [ -L "$i" -a $deps_resolve_symlinks -eq 1 ] && i=$(${__readlink} -f "$i") 517 | pkg=$(pkgchk -l -p $i | ${__awk} '/^\t/ { print $1 }') 518 | if [ -n "$pkg" -a $(echo $pkg | wc -l) -eq 1 ]; then 519 | #echo "Found $i in $pkg" >> /tmp/depdebug 520 | echo "$pkg" 521 | else 522 | echo "dep_pkg_name: $i returned more than one package" >> /tmp/depdebug 523 | fi 524 | done 525 | done 526 | } 527 | 528 | # extract_deps(): Given a section name it will extract the dependencies 529 | # params: $1 = section name (like libiconv) 530 | # It goes through the prototype.$1 file and computes the dependencies 531 | # for all files and returns the PKGINST attribute 532 | extract_deps() 533 | { 534 | local secname=$1 535 | # Can't use setdir since it has output 536 | cd ${stagedir}${topinstalldir} 537 | 538 | # Grab the filelist and classify files 539 | local filelist=$(${__awk} '{ print $3 }' $metadir/prototype.$secname | ${__grep} '.') 540 | local exelist=$(echo $filelist | ${__xargs} ${__file} | ${__egrep} -v ":.* (commands|script)" | ${__grep} -v "ar archive" | ${__grep} ":.*executable" | ${__cut} -d: -f1) 541 | local scriptlist=$(echo $filelist | ${__xargs} ${__file} | ${__egrep} ":.* (commands|script)" | ${__cut} -d: -f1) 542 | local liblist=$(echo $filelist | ${__xargs} ${__file} | ${__grep} -v "ar archive" | ${__grep} ":.*dynamic lib" | ${__cut} -d: -f1) 543 | 544 | # Compute dependencies for executables 545 | if [ -n "$exelist" ]; then 546 | for f in $exelist; do 547 | [ -r $f -a -x $f ] || continue 548 | # Generic Solaris ldd 549 | ${__ldd} $f | ${__grep} -v 'not found' | ${__awk} '/\=/ { print $3 }' 550 | done | ${__sort} -u | dep_pkg_name | ${__sort} -u 551 | fi 552 | # Compute dependencies for dynamic libraries 553 | if [ -n "$liblist" ]; then 554 | for f in $liblist; do 555 | [ -r $f ] || continue 556 | # Generic Solaris ldd 557 | ${__ldd} $f | ${__grep} -v 'not found' | ${__awk} '/\=/ { print $3 }' 558 | done | ${__sort} -u | dep_pkg_name | ${__sort} -u 559 | fi 560 | # Compute dependencies for scripts 561 | if [ -n "$scriptlist" ]; then 562 | for f in $scriptlist; do 563 | [ -r $f -a -x $f ] || continue 564 | interp="$(${__head} -n 1 $f | ${__cut} -d\! -f2- | ${__sed} -e 's/ -.*//')" 565 | if [ -L "$interp" ]; then 566 | echo $(${__file} -h "$interp" | ${__sed} -e 's/.* to //') 567 | else 568 | if [ "$(echo $interp | ${__cut} -d' ' -f1)" = "/usr/bin/env" ]; then 569 | echo "/usr/bin/env" 570 | else 571 | echo $interp 572 | fi 573 | fi 574 | done | ${__sort} -u | dep_pkg_name | ${__sort} -u 575 | fi 576 | } 577 | 578 | # auto_deps(): Compute dependencies 579 | # params: $1 = section name $2 = pkgname 580 | # It will call extract_deps() to get the packagenames of the 581 | # dependencies. The dependencies will be added to $metadir/depend.$1.auto 582 | auto_deps() 583 | { 584 | local j 585 | local deps 586 | local i 587 | local ignore 588 | local secname=$1 589 | local pkgname=$(get_pkgname $secname) 590 | local temp 591 | local depend_file=depend 592 | 593 | # Check and see if there is an arch specific depend file 594 | [ -r $metadir/depend.$arch ] && depend_file=depend.$arch 595 | [ -r $metadir/depend.$build_arch ] && depend_file=depend.$build_arch 596 | 597 | deps="$(extract_deps $secname | ${__sort} -u)" 598 | # We need to sort out any packages created from the same build 599 | # Internal deps *must* be recorded in a depend file instead 600 | for j in $(list_pkgs) 601 | do 602 | temp=$(get_pkgname $j) 603 | deps=$(echo $deps | ${__sed} -e "s/$temp//") 604 | done 605 | # Parse any speciel depends 606 | # We don't do ignore_deps processing for these deps 607 | if [ -r $metadir/$depend_file ]; then 608 | local extra_pkgname # Package that should have the depend 609 | local extra_dep_pkgname # The name of depend (either a pkgname or a secname) 610 | local extra_dep_version # version of the depend (or auto keyword) 611 | ${__sed} -n "/^$pkgname /p" $metadir/$depend_file | 612 | while read extra_pkgname extra_dep_pkgname extra_dep_version 613 | do 614 | local internal_dep=0 615 | for i in $(list_pkgs) 616 | do 617 | [ "$extra_dep_pkgname" = "$i" ] && internal_dep=1 618 | done 619 | if [ $internal_dep -eq 1 ]; then 620 | echo "P $(get_pkgname $extra_dep_pkgname) $(get_pkgdesc $extra_dep_pkgname)" 621 | else 622 | echo "P $extra_dep_pkgname $(pkgparam $extra_dep_pkgname NAME)" 623 | fi 624 | if [ $create_versioned_deps -eq 1 ]; then 625 | # create versioned_deps 626 | if [ "$extra_dep_version" = "auto" ]; then 627 | if [ $internal_dep -eq 1 ]; then 628 | extra_dep_version="$(get_pkgversion $extra_dep_pkgname)" 629 | extra_dep_pkgname=$(get_pkgname $extra_dep_pkgname) # For later use we can now resolve this permanently 630 | else 631 | extra_dep_version="$(pkgparam $extra_dep_pkgname VERSION)" 632 | fi 633 | fi 634 | # Only for deps with $pkgprefix? 635 | if [ $version_all_deps -eq 0 ]; then 636 | [ -n "$(echo $extra_dep_pkgname | ${__grep} $pkgprefix)" ] && echo -e "\t($arch) $extra_dep_version" 637 | else 638 | echo -e "\t($arch) $extra_dep_version" 639 | fi 640 | fi 641 | done > $metadir/depend.$secname.auto 642 | fi 643 | 644 | if [ $include_all_deps -eq 0 ]; then 645 | deps=$(echo $deps | sed -n "/$pkgprefix/p") 646 | fi 647 | for j in $deps 648 | do 649 | ignore=0 650 | for i in $ignore_deps 651 | do 652 | # if there's a match then set ignore flag and break the loop 653 | [ "$i" = "$j" ] && ignore=1 && break 654 | done 655 | [ $ignore -eq 0 ] && echo "P $j $(pkgparam $j NAME)" 656 | if [ $ignore -eq 0 -a $create_versioned_deps -eq 1 ]; then 657 | # create versioned_deps 658 | # Only for deps with $pkgprefix? 659 | if [ $version_all_deps -eq 0 ]; then 660 | [ -n "$(echo $j | ${__grep} $pkgprefix)" ] && echo -e "\t($arch) $(pkgparam $j VERSION)" 661 | else 662 | echo -e "\t($arch) $(pkgparam $j VERSION)" 663 | fi 664 | fi 665 | done >> $metadir/depend.$secname.auto 666 | } 667 | 668 | # parse_pkgdef(): Read in $metadir/$pkgdef_file 669 | # params: none 670 | # This will parse the package descriptions in 671 | # pkgdef that tells us how many packages there 672 | # should be and what they include. 673 | parse_def() 674 | { 675 | local section=0 676 | local foundfiles=0 677 | local secname="" 678 | local secpos=0 679 | local legalend=0 680 | local hasaddedpkginfo=0 681 | local condexpr="" 682 | 683 | while read line 684 | do 685 | case ${line:0:1} in 686 | '#') ;; 687 | '[') 688 | if [ $section -eq 1 ]; then 689 | error $E_BAD_SECTION_BEGIN parse_def 690 | else 691 | section=1 692 | secname="${line:1:((${#line}-2))}" 693 | legalend=0 694 | # Set default value for maxinst for the new section 695 | maxinst=1 696 | fi 697 | ;; 698 | '') 699 | if [ $section -eq 0 ]; then 700 | error $E_BAD_SECTION_END parse_def 701 | else 702 | section=0 # Finished this section 703 | foundfiles=0 # 704 | legalend=1 # We encountered a syntacticly correct section end 705 | hasaddedpkginfo=0 706 | fi 707 | ;; 708 | *) 709 | equalindex=$(${__expr} index "$line" =) 710 | if [ ! $equalindex -eq 0 ]; then 711 | case "${line:0:(($equalindex-1))}" in 712 | 'pkgname') 713 | pkgname="$(_upls ${line:$equalindex:${#line}})" 714 | ;; 715 | 'name') 716 | name="$(_upls ${line:$equalindex:${#line}})" 717 | ;; 718 | 'pkgcat') 719 | pkgcat="$(_upls ${line:$equalindex:${#line}})" 720 | ;; 721 | 'pkgvendor') 722 | pkgvendor="$(_upls ${line:$equalindex:${#line}})" 723 | ;; 724 | 'pkgdesc'|'shortdesc') 725 | pkgdesc="$(_upls ${line:$equalindex:${#line}})" 726 | ;; 727 | 'pkgver') 728 | pkgver="$(_upls ${line:$equalindex:${#line}})" 729 | ;; 730 | 'maxinst') 731 | maxinst="$(_upls ${line:$equalindex:${#line}})" 732 | ;; 733 | esac 734 | else # Perhaps we hit 'files'? 735 | if [ "${line:0:5}" == "files" ]; then 736 | triplet="${line:6:((${#line}-5-2))}" 737 | defaultperms=$(echo $triplet | ${__awk} -F, '{ print $1 }') 738 | defaultuid=$(echo $triplet | ${__awk} -F, '{ print $2 }') 739 | defaultgid=$(echo $triplet | ${__awk} -F, '{ print $3 }') 740 | foundfiles=1 741 | if [ $hasaddedpkginfo -eq 0 ]; then 742 | # start a new package 743 | pack_info $secname # Create pkginfo 744 | # Start the prototype file by adding the pkginfo file 745 | add_meta_file pkginfo "$metadir/pkginfo.$secname" $secname 746 | hasaddedpkginfo=1 747 | fi 748 | else 749 | if [ $foundfiles -eq 1 ]; then # We already found the 'files' line so this must be the filelist 750 | if [ "${line:0:4}" == "dir " ]; then 751 | add_dir $defaultperms $defaultuid $defaultgid "${line:4}" $secname # Add dir entry 752 | elif [ "${line:0:3}" = "if(" ]; then 753 | # Conditional expression 754 | condexpr=${line#if(} 755 | condexpr=${condexpr%%)*} 756 | if [ "x${!condexpr}" != "x" ]; then 757 | # value of condexpr was defined so we should process the line as normal 758 | add_proto $defaultperms $defaultuid $defaultgid "${line#if(*)}" $secname 759 | fi 760 | elif [ "${line:0:12}" = "default_docs" ]; then 761 | add_proto $defaultperms $defaultuid $defaultgid "${line:12}${metaprefix}${_docdir}/${secname}-${version}" $secname # Add std. doc location 762 | else 763 | add_proto $defaultperms $defaultuid $defaultgid "$line" $secname # Build protype file from filespec 764 | fi 765 | fi 766 | fi 767 | fi 768 | ;; 769 | esac 770 | done < $metadir/$pkgdef_file 771 | # If there is no blank line at the end of a pkgdef section (if there is only one section that is very 772 | # likely) then we end up here without having executed the 'section end' actions (case '' above) 773 | if [ $legalend -eq 0 ]; then 774 | if [ $section -eq 0 ]; then 775 | error $E_BAD_SECTION_END parse_def 776 | else 777 | section=0 # Finished this section 778 | foundfiles=0 # 779 | fi 780 | fi 781 | } 782 | 783 | # check_unpackaged(): Check if there are unpackaged files in the stage area 784 | # params: none 785 | check_unpackaged() 786 | { 787 | local upf 788 | local i 789 | local indent4=" " 790 | 791 | ${__find} . -type f -print|${__sed} -e 's/\.\///g' > $tmpdir/files.tmp 792 | ${__find} . -type l -print|${__sed} -e 's/\.\///g' >> $tmpdir/files.tmp 793 | ${__find} . -type d -print|${__sed} -e 's/\.\///g'|${__grep} -v '^\.' >> $tmpdir/files.tmp 794 | ${__sort} $metadir/files.tmp|${__uniq} > $tmpdir/f1 795 | ${__sort} $tmpdir/files.tmp > $tmpdir/f2 796 | upf="$(${__cat} $tmpdir/f1 $tmpdir/f2 | ${__sort} | ${__sed} -e '/^relnotes/d' | ${__uniq} -u)" 797 | if [ ! -z "$upf" ]; then 798 | echo "There are unpackaged files in the stagedir:" 799 | for i in $upf 800 | do 801 | echo "${indent4}${i}" 802 | done 803 | ${__rm} -f $tmpdir/f1 $tmpdir/f2 804 | if [ "$ignore_unpackaged_files" -eq 0 ]; then 805 | error $E_UNPACKAGED_FILES check_unpackaged 806 | fi 807 | fi 808 | ${__rm} -f $tmpdir/f1 $tmpdir/f2 809 | } 810 | 811 | # get_pkgname(): Extract pkgname (PKG) from a pkginfo file 812 | # params: $1 = metafile suffix 813 | get_pkgname() 814 | { 815 | local secname=$1 816 | 817 | if [ -r $metadir/pkginfo.$secname ]; then 818 | local pn=$(${__grep} PKG $metadir/pkginfo.$secname) 819 | local pname=$(_upls ${pn##PKG=}) 820 | echo $pname 821 | fi 822 | } 823 | 824 | # get_pkgrev(): Extract pkgrev (REV part of VERSION field) from pkginfo file 825 | # params: $1 = metafile suffix 826 | get_pkgrev() 827 | { 828 | local secname=$1 829 | 830 | local verfield="$(${__grep} VERSION $metadir/pkginfo.$secname|${__sed} -e 's/"//g')" 831 | local secver=$(_upls ${verfield#*REV=}) 832 | echo $secver 833 | } 834 | 835 | # get_pkgversion(): Extract pkgversion (VERSION field) from pkginfo file 836 | # params: $1 = metafile suffix 837 | get_pkgversion() 838 | { 839 | local secname=$1 840 | 841 | local verfield="$(${__grep} VERSION $metadir/pkginfo.$secname|${__sed} -e 's/"//g')" 842 | local secver=$(_upls ${verfield##VERSION=}) 843 | echo $secver 844 | } 845 | 846 | # get_pkgdesc(): Extract pkgdesc from a pkginfo file 847 | # params: $1 = metafile suffix 848 | get_pkgdesc() 849 | { 850 | local secname=$1 851 | 852 | if [ -r $metadir/pkginfo.$secname ]; then 853 | local pd=$(${__grep} NAME $metadir/pkginfo.$secname) 854 | local pdesc=$(_upls ${pd##NAME=}) 855 | echo $pdesc 856 | fi 857 | } 858 | 859 | # get_pkgvendor(): Extract upstram vendor information from a pkginfo file 860 | # params: $1 = metafile suffix 861 | get_pkgvendor() 862 | { 863 | local secname=$1 864 | 865 | if [ -r $metadir/pkginfo.$secname ]; then 866 | local pv=$(${__sed} -n 's/VENDOR=\(.*\) - .*/\1/p' $metadir/pkginfo.$secname | ${__tr} -d '"') 867 | echo $(_upls $pv) 868 | fi 869 | } 870 | 871 | # compat(): Add a series of entries to a compver file 872 | # params: $1 = secname $2 = version $3 = startrev $4 = endrev 873 | compat() 874 | { 875 | local secname=$1 876 | local compat_version=$2 877 | local startrev=$3 878 | local endrev=$4 879 | local i 880 | 881 | while [ $startrev -le $endrev ] 882 | do 883 | echo "$compat_version,REV=$startrev" >> $metadir/compver.${secname} 884 | let "startrev=startrev+1" 885 | done 886 | } 887 | 888 | # docs_for(): Add files from srcdir to specific package doc dir 889 | # params: $1 = secname $2....x = files to copy 890 | # Copies files from $srcdir to $_docdir/$secname-$version 891 | docs_for() 892 | { 893 | local secname=$1 894 | shift 895 | 896 | local f 897 | local ddir # Holds internal value of _docdir 898 | 899 | if [ ! -z $# ]; then 900 | setdir source 901 | ddir=${stagedir}${prefix}/${_docdir}/${secname}-${version} 902 | ${__mkdir} -p $ddir 903 | echo "Adding docs" 904 | until [ -z "$1" ] 905 | do 906 | for f in $(_upls $1) 907 | do 908 | (${__tar} -cf - "$f")|(cd $ddir; ${__tar} -xvBpf -) 909 | done 910 | shift 911 | done 912 | fi 913 | } 914 | 915 | # do_strip_bin(): Strip binaries 916 | # params: none 917 | do_strip_bin() 918 | { 919 | echo "Stripping ELF binaries..." 920 | for f in `${__find} . -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -exec ${__file} {} \; | \ 921 | ${__grep} -v ' dynamic lib ' | \ 922 | ${__sed} -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p'`; do 923 | ${__strip} $strip_elf_args $f || : 924 | done 925 | } 926 | 927 | # do_strip_shared(): Strip shared libraries 928 | # params: none 929 | do_strip_shared() 930 | { 931 | echo "Stripping ELF shared objects..." 932 | # Strip ELF shared objects (see brp-strip-shared from RPM) 933 | # Please note we don't restrict our search to executable files because 934 | # our libraries are not (should not be, at least) +x. 935 | for f in `${__find} . -type f -a -exec ${__file} {} \; | \ 936 | grep ' dynamic lib ' | \ 937 | ${__sed} -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do 938 | ${__strip} $strip_shared_args $f 939 | done 940 | } 941 | 942 | # do_strip_static(): Strip static archives 943 | # params: none 944 | do_strip_static() 945 | { 946 | echo "Stripping static archives..." 947 | # Strip static libraries. (see brp-strip-static-archive from RPM) 948 | for f in `${__find} . -type f -a -exec ${__file} {} \; | \ 949 | ${__grep} 'current ar archive' | \ 950 | ${__sed} -n -e 's/^\(.*\):[ ]*current ar archive,.*/\1/p'`; do 951 | ${__strip} $strip_static_args $f 952 | done 953 | } 954 | 955 | ##################################################### 956 | # Define generic functions for different build stages 957 | ##################################################### 958 | # generic_pack(): Build package using files from 'install' stage 959 | # params: none 960 | # We expect generic_install to have made $stagedir the "root" dir 961 | # in that all paths below will be complete (ie. /usr/local/bin and not 962 | # just bin) *unless* shortroot=1. 963 | generic_pack() 964 | { 965 | if [ "$1" == "shortroot" ]; then 966 | error $E_ARG_OBSO generic_pack 967 | fi 968 | 969 | # Before doing any expensive operations 970 | # check that the ChangeLog is in order 971 | check_changelog 972 | 973 | clean meta 974 | if [ -d "${stagedir}${topinstalldir}${dir_prefix}/${_mandir}" ]; then 975 | setdir ${stagedir}${topinstalldir}${dir_prefix}/${_mandir} 976 | [ "$catman" -eq 1 ] && fix_man 977 | [ "$gzman" -eq 1 ] && compress_man 978 | fi 979 | if [ -d "${stagedir}${topinstalldir}${dir_prefix}/${_infodir}" ]; then 980 | setdir ${stagedir}${topinstalldir}${dir_prefix}/${_infodir} 981 | [ "$gzinfo" -eq 1 ] && compress_info 982 | fi 983 | # pkgdef entries should always be relative to topinstalldir 984 | # except for the auto ones - src,dist,relnotes 985 | # In that case we use metaprefix to designate their position relative 986 | # to topinstalldir (note metainstalldir can never be above topinstalldir) 987 | # ie. topinstalldir=/usr/local/gcc & metainstalldir=/usr/local is a no no. 988 | # but topinstalldir=/usr/local & metainstalldir=/usr/local is okay and is the 989 | # default 990 | # This mostly matters when we have topinstalldir=/ and prefix=/usr/local like 991 | # with prngd and openssh 992 | # Also note that metaprefix is entirely for internal use in create_idb when 993 | # we create the "auto" entries. 994 | # Determine at what level metainstalldir is compared to topinstalldir 995 | metaprefix=${metainstalldir##$topinstalldir} 996 | metaprefix="${metaprefix#/*}" 997 | # If we have a path then we'll need a / appended 998 | [ ! -z "$metaprefix" ] && metaprefix="${metaprefix}/" 999 | # We need to add slash to the end of metainstalldir but *only* if 1000 | # metainstalldir is not /. We do this to avoid creating an absolute path 1001 | # which could happen with metainstalldir=/ if we unconditionally add /. 1002 | [ ! "$metainstalldir" = "/" ] && metainstalldir="${metainstalldir}/" 1003 | # pkgdef should list files relative to topinstalldir 1004 | setdir "${stagedir}${topinstalldir}" 1005 | parse_def 1006 | for i in $(list_pkgs) 1007 | do 1008 | auto_dir $i 1009 | done 1010 | check_unpackaged 1011 | # Create a list of all the packages that we are going to build 1012 | for i in $(list_pkgs) 1013 | do 1014 | auto_deps $i 1015 | add_scripts $i 1016 | auto_rel $i 1017 | make_pkg $i 1018 | done 1019 | } 1020 | 1021 | # vim: set filetype=sh : # 1022 | # vim: set sts=4 : # 1023 | # vim: set shiftwidth=4 : # 1024 | -------------------------------------------------------------------------------- /buildpkg.tools: -------------------------------------------------------------------------------- 1 | # Global tool defintions for buildpkg 2 | 3 | # Define tool programs in rpm style __ prefixed namespace 4 | __bash=/usr/tgcware/bin/bash 5 | __strip=/usr/bin/strip 6 | __uname=/usr/bin/uname 7 | __tar=/usr/tgcware/bin/tar # GNU tar v1.14 or better please! 8 | __vtar=/usr/bin/tar # vendor supplied tar 9 | __bzip2=/usr/tgcware/bin/bzip2 10 | __gzip=/usr/tgcware/bin/gzip 11 | __xz=/usr/tgcware/bin/xz 12 | __lzip=/usr/tgcware/bin/lzip 13 | __patch=/usr/tgcware/bin/patch # GNU patch 2.5 or better please! 14 | __rm=/usr/bin/rm 15 | __rmdir=/usr/bin/rmdir 16 | __mkdir=/usr/bin/mkdir 17 | __make=/usr/tgcware/bin/make # GNU make 3.80 or better please! 18 | __find=/usr/bin/find # vendor supplied find, GNU find will require changes to the script 19 | __xargs=/usr/bin/xargs 20 | __cat=/usr/bin/cat 21 | __awk=/usr/bin/nawk # This must be nawk or GNU awk - plain /usr/bin/awk will *not* work 22 | __sed=/usr/bin/sed 23 | __gsed=/usr/tgcware/bin/sed 24 | __sort=/usr/bin/sort 25 | __cut=/usr/bin/cut 26 | __ls=/usr/bin/ls 27 | __expr=/usr/bin/expr 28 | __mv=/usr/bin/mv 29 | __mkdir=/usr/bin/mkdir 30 | __cp=/usr/bin/cp 31 | __gcp=/usr/tgcware/bin/cp 32 | __tee=/bin/tee 33 | __grep=/bin/grep 34 | __egrep=/bin/egrep 35 | __ggrep=/usr/tgcware/bin/grep # GNU grep 36 | __uniq=/bin/uniq 37 | __basename=/bin/basename 38 | __dirname=/bin/dirname 39 | __tr=/bin/tr 40 | __file=/usr/bin/file # Used by do_strip() 41 | __ln=/usr/bin/ln 42 | __ln_s="/usr/bin/ln -s" 43 | __install=/usr/tgcware/bin/install # BSD compatible install - usually GNU install 44 | __compress=/usr/bsd/compress 45 | __pack=/usr/bin/pack 46 | __sha1sum=/usr/tgcware/bin/sha1sum 47 | __unzip=/usr/tgcware/bin/unzip 48 | __head=/usr/bin/head # Must support -n 49 | __perl=/usr/tgcware/bin/perl 50 | __readlink=/usr/tgcware/bin/readlink 51 | __ldd=/usr/bin/ldd 52 | __curl=/usr/tgcware/bin/curl 53 | 54 | # Groff stuff for manpages 55 | __nroff=/usr/tgcware/bin/nroff 56 | NROFFOPTS="-c -mandoc -Tascii -t" 57 | -------------------------------------------------------------------------------- /image.conf: -------------------------------------------------------------------------------- 1 | sw Software 2 | swo32 Software (o32) 3 | sw64 Software (n64) 4 | man Documentation 5 | opt Optional components 6 | -------------------------------------------------------------------------------- /newpkg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # A simple script to create a sandbox for a new package 4 | # 5 | # params: $1=topdir ie. bash 6 | # 7 | . ${BUILDPKG_SCRIPTS}/buildpkg.functions 8 | 9 | REQ_DIRS="stage src meta" 10 | 11 | topdir=$1 12 | if [ -z "$topdir" ]; then 13 | error $E_MISSING_ARGS 14 | else 15 | setdir "$buildpkgbase" 16 | fi 17 | 18 | echo "Creating sandbox for $topdir" 19 | ${__mkdir} "$topdir" 20 | for i in $REQ_DIRS 21 | do 22 | ${__mkdir} $topdir/$i 23 | done 24 | 25 | ${__cp} $buildpkgscripts/build.sh.generic $topdir/build.sh 26 | if [ "$(${__uname} -s)" == "IRIX" -o "$(${__uname} -s)" == "IRIX64" ]; then 27 | ${__sed} -e "s;/bin/bash;$__bash;g" $topdir/build.sh > $topdir/build.sh.tmp 28 | ${__mv} $topdir/build.sh.tmp $topdir/build.sh 29 | ${__cp} $buildpkgscripts/pkgdef.template.irix $topdir/meta/pkgdef 30 | fi 31 | 32 | if [ "$(${__uname} -s)" == "SunOS" ]; then 33 | ${__cp} $buildpkgscripts/pkgdef.template $topdir/meta/pkgdef 34 | fi 35 | 36 | ${__cp} $buildpkgscripts/relnotes.template.irix $topdir/meta/relnotes 37 | # Make build script executable 38 | chmod 755 $topdir/build.sh 39 | -------------------------------------------------------------------------------- /pkgdef.template: -------------------------------------------------------------------------------- 1 | [main] 2 | pkgname="${pkgprefix}${topdir}" 3 | name="$topdir" 4 | pkgcat="application" 5 | pkgvendor="http://change.me/please" 6 | pkgdesc="mumble mubmle... hmm someone forgot to fill this out!" 7 | pkgver="$pkgver" 8 | files(-,root,bin) 9 | $_bindir 10 | $_libdir 11 | -------------------------------------------------------------------------------- /pkgdef.template.irix: -------------------------------------------------------------------------------- 1 | [common] 2 | pkgname="${pkgprefix}${topdir}" 3 | name="$topdir" 4 | pkgver="$pkgver" 5 | pkgvendor="http://change/me/please" 6 | shortdesc="change me please" 7 | 8 | [base] 9 | subsys=sw.base 10 | files(-,root,sys) 11 | $_bindir 12 | $_sharedir 13 | $_docdir 14 | 15 | [lib] 16 | subsys=sw.lib 17 | files(-,root,sys) 18 | $_libdir/*.so.* 19 | 20 | [man] 21 | subsys=man.man 22 | files(-,root,sys) 23 | $_mandir/?a?[12456789] 24 | 25 | [mandev] 26 | subsys=man.dev 27 | files(-,root,sys) 28 | $_mandir/?a?3 29 | 30 | [info] 31 | subsys=man.info 32 | files(-,root,sys) 33 | $_infodir 34 | 35 | [devel] 36 | subsys=sw.dev 37 | files(-,root,sys) 38 | $_includedir 39 | $_libdir/*.so 40 | $_libdir/*.a 41 | 42 | -------------------------------------------------------------------------------- /pkginfo.in: -------------------------------------------------------------------------------- 1 | PKG="%%pkgname%%" 2 | NAME="%%name%%" 3 | ARCH="%%arch%%" 4 | VERSION="%%version%%,REV=%%pkgver%%" 5 | CATEGORY="%%pkgcat%%" 6 | VENDOR="%%pkgvendor%%" 7 | EMAIL="%%email%%" 8 | PSTAMP="%%pstamp%%" 9 | BASEDIR="%%topinstalldir%%" 10 | CLASSES="none" 11 | DESC="%%pkgdesc%%" 12 | MAXINST="%%maxinst%%" 13 | -------------------------------------------------------------------------------- /relnotes.template.irix: -------------------------------------------------------------------------------- 1 | PACKAGE DETAILS 2 | --------------- 3 | Name: %%PKGNAME%% 4 | Version: %%SOURCE_AND_VER%% 5 | Vendor: %%VENDOR%% 6 | Packager: %%PKGEDBY%% 7 | 8 | Source (sha1sum): 9 | %%SOURCE_SHA1SUM%% 10 | 11 | BUILD DETAILS 12 | ------------- 13 | Compiler: 14 | %%COMPILER%% 15 | 16 | Environment: 17 | %%ENVIRONMENT%% 18 | 19 | Configure: 20 | %%CONFIGURE%% 21 | 22 | KNOWN DEPENDENCIES 23 | ------------------ 24 | %%DEPENDENCIES%% 25 | 26 | ERRORS/MISCELLANEOUS 27 | -------------------- 28 | -------------------------------------------------------------------------------- /subsys.conf: -------------------------------------------------------------------------------- 1 | sw.base default base software 2 | swo32.base nodefault base software (o32) 3 | sw64.base nodefault base software (n64) 4 | sw.lib default shared libraries 5 | sw64.lib nodefault shared libraries (n64) 6 | sw.dev nodefault development files 7 | man.doc default other documentation 8 | man.man default man pages 9 | man.info default info pages 10 | man.dev nodefault development man pages 11 | opt.relnotes default release notes 12 | opt.src nodefault source, patches etc. 13 | opt.dist nodefault distribution files 14 | --------------------------------------------------------------------------------