pax_global_header00006660000000000000000000000064147514331320014515gustar00rootroot0000000000000052 comment=479d1f7c99355c10a18ba874a69bebf4f3d69640 acr-2.2.0/000077500000000000000000000000001475143313200122635ustar00rootroot00000000000000acr-2.2.0/.github/000077500000000000000000000000001475143313200136235ustar00rootroot00000000000000acr-2.2.0/.github/dependabot.yml000066400000000000000000000003501475143313200164510ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" commit-message: prefix: "##build " prefix-development: "##build " labels: - buildsystem acr-2.2.0/.github/workflows/000077500000000000000000000000001475143313200156605ustar00rootroot00000000000000acr-2.2.0/.github/workflows/ci.yml000066400000000000000000000024101475143313200167730ustar00rootroot00000000000000# This is a basic workflow that is manually triggered name: ci on: push # Controls when the action will run. Workflow runs when manually triggered using the UI # or API. # on: # workflow_dispatch: # # Inputs the workflow accepts. # inputs: # name: # # Friendly description to be shown in the UI instead of 'name' # description: 'Build and test' # # Default value if no value is explicitly provided # default: 'ACR' # # Input has to be provided for the workflow to run # required: true # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: build: # The type of runner that the job will run on runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Clone run: cd .. ; rm -rf acr ; git clone https://github.com/radare/acr ; cd acr - name: Configure run: ./configure --prefix=/usr - name: Build and install run: make ; sudo make install - name: Run tests run: make -C tests - name: Regenerate run: sh autogen.sh - name: Debian run: make -C dist - name: Pub uses: actions/upload-artifact@v4 with: path: dist/acr/*.deb acr-2.2.0/.gitignore000066400000000000000000000000341475143313200142500ustar00rootroot00000000000000src/vim/install.sh Makefile acr-2.2.0/.hgtags000066400000000000000000000000571475143313200135430ustar00rootroot0000000000000037b53e53a2260d8acf87ac6ed7ed75cc24736785 0.8.9 acr-2.2.0/AUTHORS000066400000000000000000000001231475143313200133270ustar00rootroot00000000000000main developer: pancake url: http://www.nopcode.org/?t=acr acr-2.2.0/Changelog000066400000000000000000000366031475143313200141050ustar00rootroot000000000000000.5.1 - - fix a big bug in the check_library function, inminent release! - make sure LIL_ENDIAN is 0 or 1 - fix a bug on endianness check '\n' char - fix a bug on string concatenation 0.5 - ? #- overview -# - final script is now serialized. No stages now. - lot of portability fixups and code cleanup. - hide code blocks by ##MARKS## in files handled by SUBDIRS. - add libtool support. - strip support for acr: smaller scripts for nested purposes. - amr is now in semi-usable stage. - better flags parse (getopt) - better ruby support. - add perl threads support. - guess_os now uses config.guess if it exists. - cleaner debug output - add support to include modules. - new commands: DIENOW, IFOR, IFNOTOR, INCLUDE, CHKUSR, CHKGRP - deprecated commands: USE_BACKUP, LOCAL, GLOBAL #- detailed -# - less 'cat' usage. - add acr -g (print out autogen.sh) - Fixes on acr -m and amr -m - AMR complete support for really basic C projects. - Documentation fixups - VPATH subst now creates the directories correctly - functionalize the CHKLIB and CHKINC - Deprecate the '<-' assignation. similar to IFEQVAL - Deprecate the IFEQVAL keyword in pro to IFEQ - Initial import of functionalized checks for includes - acr-vim plugin installation script now comes with -force - One word comments has been deprecated. - New comment style that looks closer to C ( /* .. */ ) - Standarize SIZEOF varnames to GNU like ones - SIZEOF now supports emphasys with '!' - SIZEOF ; now exports HAVE_SIZEOF_* to 0 or 1 - Some fixups for the acr -m - Some fixups on Makefile generation by AMR - initial import of amr-tutorial - minor typo fix on src/acr help message - sync vim syntax plugin for the new commands - fix LANG_JAVA for the new ARG_* rules - simplify conditionals - major cleanup of variable usage - HAVE_CLASSPATH_foo is now exported by CHK_CP - ARG_* allows to work with flag or by environ - refix perl-threads support - chkprg now checks if varname is a valid executable before PATH search - sync ARG_* usage for the manpage - add some examples in configure.acr(5) - PKGCFG exports a HAVE_PKGCFG_blabla variable - fix tr portability - simplify the _REQUIRED variable abuse - add enter_mode function to simplify the blobs - documentation the new stuff of chkver - deprecate USE_BACKUP command and sync documentation. - enhace test.sh script and documentation for unitary tests - export HAVE_(pkg-config-name)_VERSION_(version-number) in chkver - implement ! in CHKVER command - export RUBY and RUBY_VERSION with LANG_RUBY - Fix ruby and python module checks when no ruby/python found. - Check ACR_RMFILES in do_remove before rm anything - Move examples/csharp.acr to modules/ - Refresh examples to pass unit tests (make test) - Whoops missing mode-callback defined for CHK_PY - Make use of config.guess when exists - Stop parsing when invalid operation on assignment - Cleaner debug output - Implement the string mode. Faster string concat and better debug output. - Reread all the code to reduce some expressions and drop unused code - Add HAVE_PROGNAME foreach CHKPRG (repercutes on USE_LIBTOOL) - fix DIENOW command - deprecate LOCAL and GLOBAL commands - add LIBTOOL_STATIC export for USE_LIBTOOL command - fix acr homepage everywhere - call do_remove everytime a compilation failes - add configure.amr(5) manpage - Implement more stuff on AMR, basic usage and documentation. - Some minor size optimization (about 130 bytes) - Add new way to DIE: DIENOW - Rename DIE to DIEIF and DIENOT to DIEIFNOT (usability) - New conditional keywords IFOR and IFNOTOR - Fix check command to match the new infrastructure - Add support for multiple includes (foo.h+bar.h) - Fix a problem with the BSD awk and shell (fixes CHKPRG) - unknown flags are handled as warnings instead of fatal errors. - fix percentatge '%' usage in SCRIPT (fixes SIZEOF bug) - also export [HOST|BUILD|TARGET]_[CPU|OS] - Beutify the progress bar when including modules. - Warn on un-supported flags passed to the ./configure - Documentate and securize INCLUDE keyword. - Add INCLUDE keyword. - flags now uses the standard value when no argument is passed. - add CHKUSR and CHKGRP commands. - add 'doc/flag-arguments' file. - show default arg_* value in FLAGREPORT and --help - Redefine a new standard for ARG_* commands. - Check foreach variable definition. - Fix '!' token for LANG_* - Use 'cut' instead of 'awk in some places. - Fix distribution file creation code inside the acr-sh - use ${PERL} instead of perl. - Fix perl support again (serialization must be done in the SCRIPT). - fix NKEYS insanity. - drop LOCAL/GLOBAL keywords. Now handled by a serialization. - add GPL license in the proper way. - Cleanup of unused variables - check includes and libraries supported by C and C++ - change URL to the current one - fix all licensing stuff. - rename LICENSE -> COPYING - use vim foldering - Move all keywords to a single case statement - Serialize script generation (!!) - call command -v from other shell () or sh -c. - install 'amr' - add -s in 'acr' to strip default code. - fixups for amr (best cdeps prediction, fix cdeps in report) - reuse for USE_BACKUP - use MODE instead of huge IF (4% faster) (needs testing) - fixups for CHECK_PROG (error string and argument handler) - add libtool support (USE_LIBTOOL and USE_LIBTOOL!) - initial import of amr (the auto make replacement) - use getopt to fetch arguments from command line - add hidden blocks by using ##MARKS## in SUBDIRS - Add support for ObjectiveC - drop /-n/ in conditionals - incremented performance by using the arithmetic extension $((aOPb)) - reduced configure size by using : {FOO:=BAR} 0.4 - 20050921 #- overview -# - added 'else' - support for contexts - added a reverse engineering tool to recover .acr files from the final script generated by acr. - progressbar added - lot of fixes - better documentation - more debugging information - possibility to get the value of the target variable - enhanced java support - add ruby language support - adopt GNU like crosscompile - add CHECK_ENDIAN - support for multiple library checks - now SUBDIRS supports files.acr as targets - syntax highlighting for VIM - acr -D creates the dist tarball of the project - new command: install-acr - support for standard variable definitions (VAR = VALUE) #- detailed -# - ppc -> powerpc - install script for vim syntax highlighting scripts - autodetect GNU systems in $GNU variable (-gnu) - add -w flag - support for "" and '' values (null string value) - force strict new standard variable definitions - add checks before creating files (clean crash) - support for standard variable definitions (VAR = VALUE) - add install-acr manpage - type some install-acr stuff. - doc+man CHECK command - initial import of install-acr - order help flags in manpage - add '-D' flag --dist . creates a tar.gz from a configure.acr project - fix '-n' flag. - create src/vim to store the VIM syntax highlighting plugin - add REPORT in manpage!! - fix manpage PKG_CONFIG -> PKGCONFIG - doc SUBDIRS+files, dislike SUBST_FILES :P - alphabetically ordened --help flags. - add .PHONY in /acr -m/ mode and Makefile - fix 'command not found' in EXEC when command is not found. - DIE works for "1" and non "0" strings, DIENOT for "0" and "" - also allow --r flag as --report alias - add sunos, syllable on USE_DL - fi'smiley-ascii art %) - check for dupped USE_DL - SUBDIRS support for target files - do not overwrite on failed attempts (src/acr) - add INSTALL_LIB and INSTALL_MAN envwords - <- operator fixed - add INCLUDEDIR into the ENVWORDS - allows multiple libs checks CHKLIB c+m - support for multiple libs checks - LD_LIBS -> DL_LIBS - conditional bugs fix - update autogen.sh to do things well - change --version message - add doc for endianness checks with ACR. (doc/endian) - fixes the use of '*' in SIZEOF kw - crosspath+vpath+subst_files bug fixed. (read doc/crosspath-build FMI) - add ENDIAN | CHECK_ENDIAN keywords - awk -> expr for sums optimizations - all language bindings renamed from CHK to CHK_ - add [!] mode for each CHK_ - add RUBY extensions check support - add RUBY support - adopt GNU like crosscompile (thx2jemarch ;) - fix cpp 2.9x problem - fix relative path bug for VPATH - fix VPATH bug for subdirs. (thx sepharad) - fix gnu-awk warnings - drop external program executions - use_pthread requires lang_c - drop cats from the house. (optimization) - use_pthreads requires lang_c - fix OS-X eval bug - autoexport cflags-ldflags on pkgconfig - added automatic context switching ( local inside {} ) - add_envword fixups and optimization - changelog separation in overview/detailed - more integration in context and nested concepts. - add }{ and }ELSE{ aliases to branch alternative conditionals. - fix 102% bug :) - optimize progressbar - better syntax documentation - documentate contexts - add LOCAL and GLOBAL contexts to manage definitions ( =,+=...) - documentate IFEQVAL - documentate nested conditionals - add nested conditionals '{' and '}' keywords. - hide last NOP command in debug - fix mktemp portability bug - drop CVS tags from dist file - catch control-c in acr (remove tmp file) - update make test to use -p - add CSHARP example (may help someone :) - add progressbar (-p|--progress-bar) - split gmake into env_gmake and use_gmake - fix MAKE stuff, GMAKE=0|1 - add REPORT_TOOLS - new debug output format - use numberline in errors - add -n|--do-nothing flag into acr - add wordcounter for better debugging - add <- operator. - allow to get value of variables (<-VAR) - one word comments support '#.*' (manpage) - add embed support to acr-recover - add -e|--embed to acr - add acr-recover manpage - add metadatas for acr -r - add_envword cleanup - show prefix in ./configure output - initial import of acr-recover - update software signature in acr - add -r|--recovery flag into acr - add -o|--output flag into acr - documentate sizeof, add example, update manpage - fix whitespace before ';' in manpages - add SIZEOF command - add '((' '))' comments - add <- definition. (get value of varname xx) - add warnings for dupped exported variables - add warnings for common typos - add doc/make-tips - add SUBST alias for SUBST_FILES - fix REPORT_CXX - fine get environment procedure (add_envword) - move ENDSCRIPT before IFSCRIPTS - split SEDFLAGS into different args (to be POSIX compliant) - use mv -f to avoid user interactivity - make pkg-config continue when no executable or package found. - add EXPORT_DEFINED - to export only the defined variables (!""||0) - fix EOF bug when configure.acr ends with one-word keyword. - add NOP keyword. - fix .h creation when VPATH is used. - Be autodetected by url2pkg from pkgsrc. - add CHECK_CLASSPATH_REQUIRED - fix sub -> gsub (reported by sepharad) - add syntax tips into configure.acr 0.3 - 20050421 - sync documentation and manpages - add NOBACKUP command to drop .backup stuff - unsubst gnumake-function integration with -m flag - add 'security' check in SUBST_FILES by adding .backup and .orig - `-> read doc/backup FYI - fix ENVWORDS on env_java - add S|H|SH_FILES into clean target makefile generation - change all !"" to -z or -n - use command instead of my_whereis - use (exec) instead of direct access to the cmd. (netbsd sh tip) - check pthread_testcancel for PTHREADS and HAVE_LIBS=1 - register pthread into REQUIRED/OPTIONAL report - add REQUIRE_ACR_VERSION. - few documentation for acr hackers - my_whereis checks for -x instead of -e - switch from '-e' to '-f' (portability) - fix jsh problem with [ -e '' ] (Solaris) - LANG_PYTHON, CHK_PY documented into manpage - simple process messages (creating...) - add manpage entries for PYTHON and IF* - more fixes on --help message - add IFNULL and IFNOTNULL - all conditional strings ends with ';' - add IFEQVAL / IFNOTEQVAL conditional - some conditional codes rewritted - allow the use of \; on strings - add 'concat' function for readibility - conditional documentation added. - major conditional syntax changes - export HAVE_LANG_xxx after check each language. - fix tabspaced flags (now uses spaces, support for long variable names) - fix env_% envwords - *WARNING* further change makes acr to break backward compat. *WARNING* - split all language supports into required and supported (''/'!') - fix env_c to take CFLAGS and LDFLAGS - Entire rewrite of acr cmdline parser - Use IS_KEYWORD for unexpected EOF. - fix --help returns when no lang defiend. - boolean flags also reset the value at the end of script. - fix IFAND/IFNOTAND. It doesn't does what manpage says. - fix CHKINC bug (doesn't check CFLAGS), doesn't uses HAVE_PROGS. - fix bug parsing cmdline flags. (eval) - more info in 'SUPPORT' file - Hide errors when no pkg-config is found. - Fix sh-portability tips on pkg-config stuff - drop QUITE flag (-q, --silent, --quite) no sense - add sandbox documentation - Add --sandbox for sandboxed installs - Cleaner (tabs) --report output. - Some --help message fixups. - USE_JNI must depends on LANG_C - Use JAVA_HOME for javac checks - Add envhelp for java - initial crosscompile support (doc/crosscompile) - add LANG_PYTHON and CHECK_PYTHON_MODULE - fix missing keyword on manpage - drop autoconf compatibility command. - fix end with word bug. - add JNI support. - add CHKCP for classpath checks. - catch control-c, centralize temporaly files. - fixups for report langs - drop test target from 'all' target. - better makefile generation - best c++ checks - fix remove of temporally lang files. - fix mar references in doc 0.2 - 20050220 - fix version string - fix some problems with add_flag - fix variable overwritting bug - drop --oldincludedir - fix for REPORT (-r) cleanup output - Create manpages - Rename some commands - Add EXEC command - Add INSTALL_* environs - Fix environ code using test -z - Drop SHAREDSTATEDIR and OLDINCLUDEDIR from environ (deprecated) - Fix standard SH tips for portability - Add -m to acr wrapper to create Makefile.acr - Add PERL support (PERL_THREAD,USE_PERL,CHK_PM) - Fix sed expression bug - Add --report|-r flag to the final ./configure - add USE_X11 directive - add LANG_TCL and USE_TK - check length of --flags for clean --help output - add USE_ICONV USE_DL - add more --help typos - add USE_PTHREAD command - autodetect .orig files in subst stage - catch [C|LD]FLAGS as exportable ones - Add PKGCFG command - Add -x flag for cmdline execution - Check version of libraries - Add ?= assignation - Add IF[*]+ commands - Add -d flag for Debugging mode - Solve SED portability problems - Set SH to the bash when LANG_BASH is defined. - Add support for crosspath buildings - Add support for '##'/'##' comments - Add SUBCONF directive - Add new examples - Add the EXPORT directive - Split HOST BUILD TARGET into _OS and _CPU and export them - Conditional assignation now is an array - Fix assignations spaces tip - Renamed from MAR to ACR - Add DIE/DIENOT crash commands - Add IF/IFNOT/IFAND conditional scripts - Add AUTOCONF directive to enable some GNU compatibility - Solve ENVWORDS stage bug. - Solve problems checking libs against CFLAGS/LDFLAGS - Create mar and mar-sh scripts separattely (userfriendly) - Add cmdline flags to mar - Add documentation and tutorials - Errors piped to stderr - Add VERSION and PKGNAME to ENVWORDS - Solve my_whereis problem - Separate CHECKLIB functionality into CHECK_LIB and CHECK_FUNC 0.1 - 2004/11/27 - Initial release acr-2.2.0/LICENSE000066400000000000000000000431331475143313200132740ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. acr-2.2.0/Makefile.acr000066400000000000000000000057721475143313200145020ustar00rootroot00000000000000VPATH=@VPATH@ VERSION=@VERSION@ DESTDIR?= INSTALL_SCRIPT?=@INSTALL_SCRIPT@ INSTALL_DATA?=@INSTALL_DATA@ INSTALL_MAN?=@INSTALL_DATA@ BINDIR=${DESTDIR}/@BINDIR@ MANDIR=${DESTDIR}/@MANDIR@ DATADIR=${DESTDIR}/@DATADIR@ VERSION=@VERSION@ .PHONY: all todo test install deinstall dist clean mrproper all: @echo void build todo: cat TODO cat src/*.orig | grep -e TODO -e XXX test: cd tests/ && sh test.sh install: mkdir -p "$(BINDIR)" sed -e 's,@''VERSION@,$(VERSION),g' "$(VPATH)/src/acr" > "$(BINDIR)/acr" chmod +x "$(BINDIR)/acr" sed -e 's,@''VERSION@,$(VERSION),g' "$(VPATH)/src/acr-cat" > "$(BINDIR)/acr-cat" chmod +x "$(BINDIR)/acr-cat" sed -e 's,@''VERSION@,$(VERSION),g' "$(VPATH)/src/acr-sh" > "$(BINDIR)/acr-sh" chmod +x "$(BINDIR)/acr-sh" $(INSTALL_SCRIPT) "$(VPATH)/src/amr" "$(BINDIR)/amr" $(INSTALL_SCRIPT) "$(VPATH)/src/acr-wrap" "$(BINDIR)/acr-wrap" $(INSTALL_SCRIPT) "$(VPATH)/src/acr-install" "$(BINDIR)/acr-install" mkdir -p "$(MANDIR)/man1/" "$(MANDIR)/man5/" ${INSTALL_MAN} "$(VPATH)/man/man1/acr.1" "$(MANDIR)/man1/" ${INSTALL_MAN} "$(VPATH)/man/man1/acr-wrap.1" "$(MANDIR)/man1/" ${INSTALL_MAN} "$(VPATH)/man/man1/amr.1" "$(MANDIR)/man1/" ${INSTALL_MAN} "$(VPATH)/man/man1/acr-cat.1" "$(MANDIR)/man1/" #${INSTALL_MAN} "${VPATH}/man/man1/install-acr.1 $(MANDIR)/man1/" ${INSTALL_MAN} "$(VPATH)/man/man5/configure.acr.5" "$(MANDIR)/man5/" ${INSTALL_MAN} "$(VPATH)/man/man5/configure.amr.5" "$(MANDIR)/man5/" mkdir -p "$(DATADIR)/doc/acr/examples" for A in `find "$(VPATH)/examples" -maxdepth 1 -type f`; do \ $(INSTALL_DATA) "$${A}" "$(DATADIR)/doc/acr/examples" ; done mkdir -p "$(DATADIR)/doc/acr/developers" for A in `find "$(VPATH)/doc" -maxdepth 1 -type f`; do \ $(INSTALL_DATA) "$${A}" "$(DATADIR)/doc/acr" ; done for A in `find "$(VPATH)/doc/developers" -maxdepth 1 -type f`; do \ $(INSTALL_DATA) "$${A}" "$(DATADIR)/doc/acr/developers" ; done mkdir -p "$(DATADIR)/doc/acr/vim/ftplugin" mkdir -p "$(DATADIR)/doc/acr/vim/syntax" $(INSTALL_SCRIPT) "$(VPATH)/src/vim/install.sh" "$(DATADIR)/doc/acr/vim/install.sh" $(INSTALL_DATA) "$(VPATH)/src/vim/ftplugin/acr.vim" "$(DATADIR)/doc/acr/vim/ftplugin/acr.vim" $(INSTALL_DATA) "$(VPATH)/src/vim/syntax/acr.vim" "$(DATADIR)/doc/acr/vim/syntax/acr.vim" $(INSTALL_DATA) "$(VPATH)/src/vim/vimrc" "$(DATADIR)/doc/acr/vim/vimrc" mkdir -p "$(DATADIR)/acr/modules/" -$(INSTALL_DATA) "$(VPATH)/modules"/* "$(DATADIR)/acr/modules/" uninstall deinstall: -rm -f $(BINDIR)/acr-sh $(BINDIR)/acr $(BINDIR)/amr -rm -f $(BINDIR)/acr-cat $(BINDIR)/acr-install -rm -f $(BINDIR)/acr-wrap -rm -f $(MANDIR)/man1/acr.1 $(MANDIR)/man5/configure.acr.5 -rm -f $(MANDIR)/man1/acr-cat.1 $(MANDIR)/man1/amr.1 -rm -f $(MANDIR)/man1/acr-wrap.1 -rm -f $(MANDIR)/man5/configure.amr.5 -rm -rf $(DATADIR)/doc/acr/examples $(DATADIR)/doc/acr -rm -rf $(DATADIR)/acr dist: rm -rf acr-$(VERSION) git clone . acr-$(VERSION) rm -rf acr-$(VERSION)/.git tar czvf acr-$(VERSION).tar.gz acr-$(VERSION) clean: rm -f src/vim/install.sh rm -f Makefile mrproper: clean rm -f configure acr-2.2.0/README.md000066400000000000000000000007621475143313200135470ustar00rootroot00000000000000ACR: Auto Conf Replacement ========================== ![ci](https://github.com/radare/acr/workflows/ci/badge.svg) ACR tries to replace autoconf functionality generating a full-compatible 'configure' script (runtime flags). But using shell-script instead of m4. This means that ACR is faster, smaller and easy to use. ACR is released under the GPLv2 license. See 'COPYING'file. If you have new ideas, features, comments, tips, etc, please, feel free to inform them to me at: pancake@nopcode.org acr-2.2.0/SUPPORT.md000066400000000000000000000013461475143313200137650ustar00rootroot00000000000000By now ACR is known to be very portable on posix shell based systems: Supported OSs: * GNU/FreeBSD (kFreeBSD) * GNU/Linux * GNU/Hurd * Darwin * macOS * MacOS-X * NetBSD * FreeBSD * OpenBSD * Solaris Supported languages: * C * C++ * V * Vala * ObjectiveC * Go * Java * Bash * Perl * Ruby * Python * TCL Known system strings: * ppc-unknown-linux * ppc-unknown-linux-gnu * x86-unknown-linux Autoconf diff: * --quite/--silent -> no sense . You can pipe to /dev/null * VPATH vs srcdir for crosspath builds * some cleanup of old-not-used flags * acr implements --report for easy to look packages * sandbox support * faster and smaller final script PD: Send me mails for adding support to other OSs or bug reports to: pancake@nopcode.org acr-2.2.0/TODO000066400000000000000000000103021475143313200127470ustar00rootroot00000000000000TODO ==== - config.log with full output BUGS ==== - CHKFNC not working for c++ Missing languages ================= - Go - LANG_CXX in USE_LIBTOOL (must be tested) - CPP is never used/checked - mono/dotgnu/msc (semi-done as a module) - elisp/clisp/guile/chicken/newlisp - luvit ?? - icon Random issues ============= - SUBCONF IS BROKEN CONCEPT ?!?!! - IF XX FOO += BAR ; is also broken!! works with IF XX { ... } ; next change!! - optimize cat foo|awk -> awk < foo - make something generic to create HAVE_BLABL variables - add yacc/lex/bison/flex support USE_LEX_AND_YACC - cdeps in AMR is nonsense ? amr must be redefined from the ground! - add LICENSE keyword. Store a pool of licenses. - finish the "optimized by a single function call" (not only for CHKINC and CHKLIB) - allow to run commands without {} keys in conditionals: IF FOO BAR DIENOW bla ; - manage user creation, etc. (portable tool to create/remove user/groups..) - install command replacement to autogenerate PLISTs - chkup2date: check if there's new versions of the program - add bitmasks -> change 'ifs' by using: case "foo" in *fo) echo pop ;; esac - config.log - configure.log >> outputs build stuff ACR_LOGS | GEN_LOGS (use $LINENO) Automake: ========= - add keyword REBUILD, to mark the variables that has changed, to force a make clean - lot of testing and dubidu TOTHINK: ======== - absolute VPATH? (GNU doesn't) - add INSTALL_DATA_DIR INSTALL_MAN_DIR INSTALL_SCRIPT_DIR ... LIB .. - ensure acr is using acr-sh from the correct path. it could be autofixable - set -x for debugging (-dd ?) // too many debug!! - check defines on includes...useful for the HURD MAX_PATH_LEN & related - Implement the "HIDE" keyword ?!? is stupid - regexp to parse by sed...just use // instead of \, :? - report on file, only requested variables: OUTPUT_H PREFIX+HAVE_LIB_NCURSES config.h; ## only prefix and ncurses ## - if -L is used, also -Wl,-R must be - add -pc- when it's a i.86 IMHO NO! - check if the crosscompiler matches (gcc -dumpmachine) EXEC GCCTARGET gcc -dumpmachine ; IFNOTEQ GCCTARGET TARGET { DIE Crosscompiler mismatch } -- must be integrated with -- drop -unknown- keyword in hosts - separate acr-sh into different script files. (maybe this will never be achieved) - SUBDIRS => MAKEPATHS, MAKEFILEPATH, ... --x-includes \___ add these flags into USE_X11 (talk to sepharad) --x-libraries / - ==================================== -> this makes sandbox useless. (to think!) - sandbox VS make install PREFIX=/usr/local/foo - support for multiline flag comments. (sed \n -> \t\t\t\t\n)? - add -q (quite ?) - check for RPATH -Wl,-R (only for darwin?) -- not proper imho - SEARCHPATH only for TCL :? - add CHECK_BUILD -> build & execute? what kind of file ?...etc..long wish >> example usage: CHECK_BUILD VAR EOF ; JAVAC CLASSPATH ; import java.io.*; public static void main() { System.out.println("this is mooed"); } EOF -------- IMHO this is useless, we have CHECK command that does the same. - IFZERO ? instead of IFNOT ?? - if SUBST_FILES is a directory just handle the entire contents of the directory. AutoInstall =========== create install-acr: ? - Same install functionality - Allow multiple files - auto PLIST generation - install-acr :?? (to generate a PLIST) - add -i flag that reads the acr.conf or something similar and runs (install) ./configure with the desired flags. runs make/gmake and installs (install) (like DotGNU's madcow does :) - may use the native pkg system to install the required dependencies, etc :) ...aka TWD Modules ======= - add INSMOD -> insert module - this will include the requested acrm file for example: - file: qt.acrm - add_flag.... ENVWORDS="${ENVWORDS} FOO BAR" - - acr will check if the requested file exists, (local dir, share dir) - documentation required. TIPS: ===== - pkg-config --exists "gtk2-java >= 2.7" - code a lighter pkgconfig alternative?? :) ## just for history? ## - conditionals in Makefile SUBST -> this will make 'make' happy and portable >>false > cat file | awk 'BEGIN{a=0;}{ if (/##MARK##/) { if(a==0){a=1} else {a=0}; } else {if (a==0) print; }}' >>true > cat file | awk 'BEGIN{a=0;}{ if (/##MARK##/) { if(a==0){a=1} else {a=0}; } else { print; }}' ## /history ## acr-2.2.0/autogen.sh000066400000000000000000000004461475143313200142650ustar00rootroot00000000000000#!/bin/sh # # autogen script to create configure PATH=./.bin/bin:${PATH} rm -rf .bin mkdir .bin src/acr-sh > configure chmod +x configure ./configure --prefix=/ $@ chmod +x ./src/acr ./src/acr-sh ./src/acr-cat ./src/acr-install make install DESTDIR=$PWD/.bin acr -e -p make clean rm -rf .bin acr-2.2.0/configure000077500000000000000000000245331475143313200142010ustar00rootroot00000000000000#!/bin/sh # This script was automatically generated by ACR v2.2.0 # @author: pancake # @url: http://www.nopcode.org # @repo: git clone https://github.com/radare/acr [ -z "${AWK}" ] && AWK=awk do_remove() { if [ "${ACR_RMFILES}" ]; then printf "cleaning temporally files... " rm -f ${ACR_RMFILES} echo "done" fi } control_c() { printf "\n\n^C control-c : script execution interrupted.\n" do_remove exit 1 } trap control_c 2 split_host() { S="$" while : ; do ENVWORDS="${ENVWORDS} $1_CPU $1_OS" STR=`eval "echo ${S}$1"` SPLIT_CPU="`echo "$STR" | cut -d - -f 1`" SPLIT_OS="`echo "$STR" | $AWK -F - '{ if ($2=="unknown"){ if (NF<3) { print $2; } else { print $3; } } else { if ($2=="linux") { print $2; } else if (NF<3) { print $2; } else { print $3; } } }'`" eval "$1_CPU=\"$SPLIT_CPU\"" eval "$1_OS=\"$SPLIT_OS\"" shift [ -z "$1" ] && break done } QUIET=0 be_quiet() { QUIET=1 } VPATH=`dirname ${0}` if [ "${VPATH}" = "." ]; then WODIS=current else if [ "${VPATH}" = "${PWD}" ]; then VPATH=. WODIS=current else WODIS=crosspath CURDIR=$PWD cd $VPATH VPATH="${PWD}/" cd $CURDIR fi fi guess_os() { if [ -e "${VPATH}/config.guess" ]; then sh ${VPATH}/config.guess return fi CPU="`uname -m|sed -e 's, ,,g'|cut -d - -f 1`" OS="`uname -s|tr A-Z a-z`" uname -r | grep -qE "(Microsoft|WSL)" 2>/dev/null && OS="wsl" GNU="`uname --help 2>&1 | grep gnu`" [ "${GNU}" ] && OS="${OS}-gnu" [ "${CPU}" = ppc ] && CPU="powerpc" echo "${CPU}-unknown-${OS}" } SEARCHPATH="/usr /usr/local /usr/pkg /sw" : ${PREFIX:=/usr/local} CROSSBUILD=0 BUILD=`guess_os` HOST="${BUILD}" TARGET="${HOST}" ETCDIR="/etc" SYSCONFDIR="" DESCRIPTION="automatic configuration replacement tool" create_environ() { : ${EPREFIX:="${PREFIX}"} : ${SPREFIX:="${PREFIX}"} : ${BINDIR:="${SPREFIX}/bin"} : ${SBINDIR:="${PREFIX}/sbin"} : ${ETCDIR:="${SPREFIX}/etc"} : ${LIBDIR:="${SPREFIX}/lib"} : ${PKGCFG_LIBDIR:='${exec_prefix}/lib'} : ${PKGCFG_INCDIR:='${prefix}/include'} : ${LIBEXECDIR:="${SPREFIX}/libexec"} : ${INCLUDEDIR:="${SPREFIX}/include"} : ${DATADIR:="${SPREFIX}/share"} : ${INFODIR:="${DATADIR}/info"} : ${MANDIR:="${DATADIR}/man"} : ${DOCDIR:="${DATADIR}/doc/acr"} : ${LOCALSTATEDIR:="${SPREFIX}/var"} for A in `echo ${PATH} | sed -e 's,:, ,g'` ; do [ -e "$A"/ginstall ] && : ${INSTALL:="$A"/ginstall} && break [ -e "$A"/install ] && : ${INSTALL:="$A"/install} && break done : ${INSTALL_DIR:=${INSTALL} -d} : ${INSTALL_DATA:=${INSTALL} -m 644} : ${INSTALL_SCRIPT:=${INSTALL} -m 755} : ${INSTALL_PROGRAM:=${INSTALL} -m 755} : ${INSTALL_PROGRAM_STRIP:=${INSTALL} -m 755 -s} : ${INSTALL_MAN:=${INSTALL} -m 444} : ${INSTALL_LIB:=${INSTALL} -m 755 -c} PKGNAME='acr' ; VERSION='2.2.0' ; VERSION_MAJOR=2; VERSION_MINOR=2; VERSION_PATCH=0; VERSION_NUMBER=20200; CONTACT_MAIL="pancake@nopcode.org" ; CONTACT_NAME="pancake" ; CONTACT="pancake " ; } show_usage() { cat <" echo "" exit 0 } take_environ() { : ${SH:=/bin/sh} : ${PREFIX:=/usr/local/} } ochof() { [ "$QUIET" = 1 ] && return printf "$*" } ocho() { [ "$QUIET" = 1 ] && return echo "$*" } show_version() { if [ "$QUIET" = 1 ]; then echo "2.2.0" exit 0 fi echo "acr-2.2.0 configuration script done with acr v2.2.0. The 'Free Software Foundation' message is only for autodetection. Originally written by pancake ." exit 0 } parse_options() { flag=`echo $1| cut -d = -f 1` value=`echo $1| $AWK 'BEGIN{FS="=";}{print $2}'` flag2=`echo $flag|cut -f2- -d -| sed -e 's,-,_,g' -e 's,^_,,g'|tr '[a-z]' '[A-Z]'` if [ "${TARGET_OS}" = "darwin" ]; then LIBPATH=-Wl,-install_name, else LIBPATH=-Wl,-R fi case $flag in -h|--help|--hel|--h|--he|-help) show_usage ; ;; -qV|-quiet-version|--quiet-version) be_quiet show_version ; ;; -q|-quiet|--quiet) be_quiet ; ;; -V|-version|--version) show_version ; ;; -r|--r|--report) echo "PKGNAME: acr" echo "VERSION: 2.2.0" echo "AUTHOR: pancake" echo "EMAIL: pancake@nopcode.org" echo "DESCRIPTION: automatic configuration replacement tool" exit 0 ;; --cache-file) # ignored: acr have no cache ;; --build) BUILD="$value"; split_host BUILD ; ;; --host) CROSSBUILD=1 # XXX HOST="$value"; split_host HOST ; ;; --target) TARGET="$value"; split_host TARGET ; ;; --prefix) PREFIX="$value"; ;; --exec-prefix) EPREFIX="$value"; ;; --sandbox|--sprefix) SPREFIX="$value"; ;; --bindir) BINDIR="$value"; ;; --sbindir) SBINDIR="$value"; ;; --libexecdir) LIBEXECDIR="$value"; ;; --docdir) DOCDIR="$value"; ;; --datadir) DATADIR="$value"; ;; --sysconfdir) SYSCONFDIR="$value" ETCDIR="$value"; ;; --etcdir) SYSCONFDIR="$value" ETCDIR="$value"; ;; --sharedstatedir) SHAREDSTATEDIR="$value"; ;; --localstatedir) LOCALSTATEDIR="$value"; ;; --libdir) LIBDIR="$value" PKGCFG_LIBDIR="$value"; ;; --libpath) LDFLAGS="${LDFLAGS} ${LIBPATH}$value"; ;; --includedir) PKGCFG_INCDIR="$value" INCLUDEDIR="$value"; CFLAGS="${CFLAGS} -I$value"; ;; --infodir) INFODIR="$value"; ;; --mandir) MANDIR="$value"; ;; *) if [ "$value" ]; then eval "`echo $flag2=$value`" ; else echo ; echo "WARNING: Unknown flag '$flag'." >&2 ; echo ; fi ;; esac } # MAIN # take_environ split_host BUILD HOST TARGET [ -z "$ACRHOOK" ] && ACRHOOK=./configure.hook [ -e "$ACRHOOK" ] && . ${ACRHOOK} while : ; do [ -z "$1" ] && break parse_options "$1" shift done ENVWORDS="MANDIR DESCRIPTION INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR ETCDIR SYSCONFDIR DATADIR DOCDIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_NUMBER PKGCFG_LIBDIR PKGCFG_INCDIR PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL HAVE_INSTALL" create_environ ocho "checking build system type... ${BUILD}" ocho "checking host system type... ${HOST}" ocho "checking target system type... ${TARGET}" [ "${CROSSBUILD}" = 1 ] && echo "using crosscompilation mode." #split_host BUILD HOST TARGET [ -n "${prefix}" ] && PREFIX="${prefix}" ocho "checking for working directories... ${WODIS}" ocho "using prefix '${PREFIX}'" ACR_RMFILES="" ochof "checking for install... " if [ -x "${INSTALL}" ]; then FIND=${INSTALL} else FIND="" IFS=: for A in ${PATH} ; do if [ -x "${A}/install" ]; then FIND="${A}/install" break; fi done unset IFS fi if [ -n "${FIND}" ]; then ocho ${FIND}; HAVE_INSTALL=1 INSTALL=${FIND} else HAVE_INSTALL=0 INSTALL=install if [ "" = 1 ]; then echo "Cannot find install" >&2 else echo no fi ; fi SEDFLAGS=" -e '" COUNT=0 for A in ${ENVWORDS} ; do [ "${A}" = VPATH ] && continue [ "${A}" = srcdir ] && continue eval "VAR=\$${A}" VAR="`echo ${VAR} | sed -e 's/\,/\\\,/g'`" [ $COUNT = 10 ] && COUNT=0 && SEDFLAGS="${SEDFLAGS}' -e '" COUNT=$(($COUNT+1)) SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;" done SEDFLAGS="${SEDFLAGS}'" for A in . src/vim/install.sh ; do # SUBDIRS if [ -f "${VPATH}/${A}.acr" ]; then SD_TARGET=${A} else if [ -d "${VPATH}/${A}" ]; then SD_TARGET=${A}/Makefile mkdir -p ${A} else echo "ERROR: Cannot find ${VPATH}/${A}.acr" >&2 exit 1 fi fi ocho "creating ${SD_TARGET}" [ "${VPATH}" != '.' ] && mkdir -p $(echo ${A} | sed -e "s,/`basename ${A}`$,,g") cat ${VPATH}/${SD_TARGET}.acr | \ eval sed -e "s,@VPATH@,${VPATH}/${A},g" ${SEDFLAGS} > ${SD_TARGET}.tmp for A in ${ENVWORDS}; do VALUE=`eval echo "$"${A}` if [ "$VALUE" = 0 ]; then ## FALSE MARK="##${A}##" if [ -n "`grep \"${MARK}\" ${SD_TARGET}.tmp`" ]; then mv ${SD_TARGET}.tmp ${SD_TARGET}.tmp2 cat ${SD_TARGET}.tmp2 | MARK=$MARK $AWK 'BEGIN{a=0;}{if($1==ENVIRON["MARK"]){if(a)a=0;else a=1}else{if(!a)print;}}' > ${SD_TARGET}.tmp fi fi done mv ${SD_TARGET}.tmp ${SD_TARGET} && rm -f ${SD_TARGET}.tmp2 if [ ! $? = 0 ]; then echo Cannot write target file ; control_c ; fi done if [ "$QUIET" = 0 ]; then echo echo "Final report:" for A in SPREFIX PREFIX INSTALL VERSION CONTACT ; do eval VAL="\$${A}" [ -z "${VAL}" ] && VAL="\"\"" echo " - ${A} = ${VAL}" done fi #ACR# /* package information */ #ACR# PKGNAME acr #ACR# VERSION 2.2.0 #ACR# CONTACT pancake ; pancake@nopcode.org #ACR# #ACR# DESCRIPTION automatic configuration replacement tool ; #ACR# #ACR# /* needed programs */ #ACR# CHECK_PROGRAM INSTALL install #ACR# #ACR# /* directories */ #ACR# SUBDIRS . src/vim/install.sh ; #ACR# /* src/acr src/acr-sh */ #ACR# #ACR# /* final report */ #ACR# REPORT SPREFIX PREFIX INSTALL VERSION CONTACT ; acr-2.2.0/configure.acr000066400000000000000000000005261475143313200147360ustar00rootroot00000000000000/* package information */ PKGNAME acr VERSION 2.2.0 CONTACT pancake ; pancake@nopcode.org DESCRIPTION automatic configuration replacement tool ; /* needed programs */ CHECK_PROGRAM INSTALL install /* directories */ SUBDIRS . src/vim/install.sh ; /* src/acr src/acr-sh */ /* final report */ REPORT SPREFIX PREFIX INSTALL VERSION CONTACT ; acr-2.2.0/dist/000077500000000000000000000000001475143313200132265ustar00rootroot00000000000000acr-2.2.0/dist/Makefile000066400000000000000000000001161475143313200146640ustar00rootroot00000000000000all: make -C acr clean: make -C acr clean mrproper: make -C acr mrproper acr-2.2.0/dist/acr/000077500000000000000000000000001475143313200137735ustar00rootroot00000000000000acr-2.2.0/dist/acr/CONFIG000066400000000000000000000002171475143313200146630ustar00rootroot00000000000000PACKAGE=acr ARCH=all SECTION=devel PRIORITY=optional MAINTAINER=pancake VERSION=$(shell ../../configure --quiet-version) acr-2.2.0/dist/acr/DESCR000066400000000000000000000001161475143313200145540ustar00rootroot00000000000000autoconf replacement Minimalistic autoconf replacement written in shellscript acr-2.2.0/dist/acr/Makefile000066400000000000000000000005571475143313200154420ustar00rootroot00000000000000PACKAGE_DIR=$(shell pwd) include ./CONFIG DEPENDS= ABSROOT=$(shell pwd)/root SUDO=fakeroot SUDO=sudo SUDO= all: $(SUDO) rm -rf control data ${MAKE} clean $(MAKE) root cp -aRf root data ${MAKE} control ${MAKE} deb root: $(ABSROOT) $(ABSROOT): mkdir $(ABSROOT) cd ../.. ; ./configure --prefix=/usr ; make install DESTDIR=$(ABSROOT) include ../deb_hand.mak acr-2.2.0/dist/deb_hand.mak000066400000000000000000000071251475143313200154510ustar00rootroot00000000000000# Create .deb without using dpkg tools. # # Author: Tim Wegener # # Use 'include deb_hand.mak' after defining the user variables in a local # makefile. # # The 'data' rule must be customised in the local make file. # This rule should make a 'data' directory containing the full file # layout of the installed package. # # This makefile will create a debian-binary file a control directory and a # a build directory in the current directory. # Do 'make clobber' to remove these generated files. # # Destination: # PACKAGE_DIR - directory where package (and support files) will be built # defaults to the current directory # # Sources: # SOURCE_DIR - directory containing files to be packaged # ICON_SOURCE - 26x26 icon file for maemo # DESCR - description with summary on first line # preinst, postinst, prerm, postrm - optional control shell scripts # These fields are used to build the control file: # PACKAGE = # VERSION = # ARCH = # SECTION = # PRIORITY = # MAINTAINER = # DEPENDS = # # SOURCE_DIR = # ICON_SOURCE = # (ICON_SOURCE is optional) # *** NO USER CHANGES REQUIRED BEYOND THIS POINT *** ifeq ($(shell uname),Darwin) MD5SUM=md5 else MD5SUM=md5sum endif GAWK=awk PACKAGE_DIR?=$(shell pwd) ifeq (${PACKAGE_DIR},) all: @echo Invalid package directory false endif CONTROL_EXTRAS ?= ${wildcard preinst postinst prerm postrm} ${PACKAGE_DIR}/control: ${PACKAGE_DIR}/data ${CONTROL_EXTRAS} DESCR \ ${ICON_SOURCE} #rm -rf $@ mkdir -p $@ ifneq (${CONTROL_EXTRAS},) cp ${CONTROL_EXTRAS} $@ endif # Make control file. echo "Package: ${PACKAGE}" > $@/control echo "Version: ${VERSION}" >> $@/control echo "Section: ${SECTION}" >> $@/control echo "Priority: ${PRIORITY}" >> $@/control echo "Architecture: ${ARCH}" >> $@/control ifneq (${DEPENDS},) echo "Depends: ${DEPENDS}" >> $@/control endif echo "Installed-Size: ${shell du -s ${PACKAGE_DIR}/data|cut -f1}" \ >> $@/control echo "Maintainer: ${MAINTAINER}" >> $@/control printf "Description:" >> $@/control cat DESCR | ${GAWK} '{print " "$$0;}' >> $@/control #ifneq (${ICON_SOURCE},) # echo "Maemo-Icon-26:" >> $@/control # base64 ${ICON_SOURCE} | ${GAWK} '{print " "$$0;}' >> $@/control #endif # Make md5sums. cd ${PACKAGE_DIR}/data && find . -type f -exec ${MD5SUM} {} \; \ | sed -e 's| \./| |' \ > $@/md5sums ${PACKAGE_DIR}/debian-binary: echo "2.0" > $@ ${PACKAGE_DIR}/clean: rm -rf ${PACKAGE_DIR}/data ${PACKAGE_DIR}/control ${PACKAGE_DIR}/build *.deb ${PACKAGE_DIR}/build: ${PACKAGE_DIR}/debian-binary ${PACKAGE_DIR}/control \ ${PACKAGE_DIR}/data rm -rf $@ mkdir $@ cp ${PACKAGE_DIR}/debian-binary $@/ cd ${PACKAGE_DIR}/control && tar cJvf $@/control.tar.xz * cd ${PACKAGE_DIR}/data && \ COPY_EXTENDED_ATTRIBUTES_DISABLE=true \ COPYFILE_DISABLE=true \ tar cpJvf $@/data.tar.xz ./* # Convert GNU ar to BSD ar that debian requires. # Note: Order of files within ar archive is important! ${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb: ${PACKAGE_DIR}/build ${AR} -rc $@ $ $@fail #rm -f $@tmp #mv $@fail $@ .PHONY: data data: ${PACKAGE_DIR}/data .PHONY: control control: ${PACKAGE_DIR}/control .PHONY: build build: ${PACKAGE_DIR}/build .PHONY: clean clean: ${PACKAGE_DIR}/clean rm -f debian-binary .PHONY: mrproper mrproper: clean echo ${PACKAGE_DIR} rm -rf root .PHONY: deb deb: ${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb clobber:: rm -rf ${PACKAGE_DIR}/debian_binary ${PACKAGE_DIR}/control \ ${PACKAGE_DIR}/data ${PACKAGE_DIR}/build push: scp *.deb radare.org:/srv/http/radareorg/cydia/debs acr-2.2.0/doc/000077500000000000000000000000001475143313200130305ustar00rootroot00000000000000acr-2.2.0/doc/amr-tutorial000066400000000000000000000031761475143313200154020ustar00rootroot00000000000000AMR tutorial ============ This document describes how to use AMR to automagically create a basic ACR project configuration. Stay in root of your project: -- $ pwd ~/src/hello $ ls -FR .: README src/ ./src: main.c -- So, let's see what's in main.c: -- $ cat src/main.c #include #include "main.h" int main() { printf("Hello World\n"); return 0; } -- That's ok, so now run amr -a: -- $ amr -a | tee configure.amr ## sample configure.amr ## CDIR ./src/ CSOURCES main.c ; CINCLUDES stdio.h ; -- Now we have the AMR configuration file. This is a template file that AMR uses to create configure.acr or Makefile.acr. This command can be used recursively for each directory of your source project. So you'll be able to autogenerate all required checks for your project. Let's generate a configure.acr template: -- $ amr -c | tee configure.acr ## sample configure.acr ## PKGNAME hello VERSION 0.1 CONTACT your name ; your@email LANG_C! CHKINC! stdio.h SUBDIRS . ./src/ ; -- Now we must create the Makefiles: -- $ amr -m > Makefile.acr $ cd src $ amr -m > Makefile.acr $ cd - -- That's fine. Everything is done. We can test't now: -- $ acr $ ./configure checking build system type... i686-unknown-linux-gnu checking host system type... i686-unknown-linux-gnu checking target system type... i686-unknown-linux-gnu checking for working directories... current using prefix '/usr/local' checking for c compiler... gcc checking for stdio.h... yes creating ./Makefile creating ./src//Makefile cleaning temporally files... done $ make gcc -c -o src//main.o src//main.c gcc ./src//main.o -o hello $ ./hello Hello World! -- acr-2.2.0/doc/backup000066400000000000000000000035201475143313200142200ustar00rootroot00000000000000backups in ACR ============== Imagine this scenario: You already typed ./configure and you have some files filtered by SUBST_FILES command into the configure.acr. Then you modify one of the filtered files, instead of the .orig. As you can see. Your final code will be overwritten by your Makefile and configure will remove your original code by the .orig one. This kind of problems can make you loss parts of code. ACR 0.3 integrates a new feature in SUBST code that makes a diff between foo and foo.backup. If they differ ./configure will fail showing an error message. To solve this just "diff -u foo.backup foo" and patch foo.orig using the diff output by hand. This kind of stuff can't be fixed automatically, because it's a programmer's problem. Make sure to modify your Makefiles to use this new feature removing/checking the .backup existence. This feature could change in the future. But needs more feedback against end users. Please, mail me about this feature explaining your ideas, fixes, changes or proposals. You can use this GNU-make function to check and cleanup properly your .orig and .backup files. instead of using -rm ${FILE} you must use: $(call unsubst,${FILE}) and the following function: --------------------->8----------------------- define unsubst @if [ -f "${1}.backup" ]; then\ if [ -f "${1}" ]; then\ if [ -n "`diff -u ${1} ${1}.backup`" ]; then\ echo "It looks like '${1}' has changed. Check .backup peer."; \ exit 1; \ else\ rm -f ${1}.backup;\ mv ${1}.orig ${1};\ fi\ fi\ fi endef -----------------------8<--------------------- A sample Makefile will look like: ---------------Makefile---------------- define unsubst (...) endef clean: $(call unsubst,CONFIG) $(call unsubst,src/config.h) --------------------------------------- acr-2.2.0/doc/check-user000066400000000000000000000016141475143313200150060ustar00rootroot00000000000000Checking users with ACR ======================= *NOTE* This feature was added in acr 0.5. You can check for user or group existence by using the CHKUSR and CHKGRP commands. There's one problem by using this stuff in the configure stage, because some build systems runs only runs 'make install' as root, the rest with an unprivileged user. This may cause a fail. Another way to check users and groups, maybe parsing the /etc/passwd and /etc/group, instead of trying to chown a file. You can segmentate your configure into another tiny script by appending '-s' to 'acr' just like this: ---------------------------------------- $ cd src $ acr -s $ tail Makefile.acr install: ./configure # check for users. mkdir -p ${BINDIR} ${INSTALL} program ${BINDIR}/ ---------------------------------------- Don't forget to use CHKUSR! and CHKGRP! if you want to stop the script there if an error has occurred. acr-2.2.0/doc/cmdline000066400000000000000000000031031475143313200143630ustar00rootroot00000000000000Command-Line usage of ACR ========================= ~$ ./acr -h acr: Usage './acr' [ -flag | acrfile ] -x: execute the script directly -v: show version information -d: run acr in debug mode -m: generate main Makefile.acr file -h: show this help ACR only permits one argument. This may look as a restriction or limitation, but...isn't really needed. [ -x | --exec ] Use this flag to execute directly the configure.acr script without generating any configure script. - on the fly - >> for example: ~/acr-tests$ acr -x --help 'configure' configures this package to adapt to many kinds of systems. (...) [ -m ] Auto-generate the Makefile.acr using some configure.acr stuff [ -v | -V | --version ] Prints the version number of ACR. [ -d | --debug ] Makes a trace of the configure.acr script. This flag is useful to find syntax errors not caught by ACR. >> for example: ~/acr-tests$ acr -d |- LANG_C |- USE_DL |- CHKLIB |- CHECK_VERSION `- gtk+-2.0 `- 2.6.0 |- REPORT `- LDFLAGS `- HAVE_LIB_DL acr: ./configure script created successfully. ~/acr-tests$ [ -p | --progress-bar ] Shows a progressbar. >> for example: pancake@pl2:/tmp/csharp$ acr -p csharp.acr 14% [########---------------------------------------------------------------] [ -o | --output ] [file] Changes the final output file, by default 'configure' [ -e | --embed ] Embed configure.acr into the final configure script. [ -r | --recover ] Recovery mode. (see acr-cat(1)) [ -h | --help ] Shows the help message. [ -n | --do-nothing ] Do not generate the final configure script. acr-2.2.0/doc/conditionals000066400000000000000000000062731475143313200154510ustar00rootroot00000000000000Conditionals ============ ACR conditionals are handled after checks and assignations. Version 0.3 uses a new conditional syntax that allows you to write more complex ones. But...isn't backward compatible. By the way is good to read this document to understand how they work. Conditionals are grouped by keywords: - IF / IFNOT - IFNULL / IFNOTNULL - IFAND / IFNOTAND - IFOR / IFNOTOR - IFEQ / IFNOTEQ - IFEQVAL / IFEQVAL IF A /* if ( A = 1 ) */ IFNOT A /* if ( A = 0 ) */ IFNULL A /* if ( A = '' ) */ IFNOTNULL A /* if ( A != '' ) */ IFAND A B /* if ( A = 1 && B = 1 ) */ IFNOTAND A B /* if ( A = 0 && B = 0 ) */ IFOR A B /* if ( A = 1 || B = 1 ) */ IFNOTOR A B /* if ( A = 0 || B = 0 ) */ IFEQ A B /* if ( A = B ) */ IFEQVAL A B /* if ( A = '$B' ) */ IFNOTEQVAL A B /* if ( A != '$B' ) */ f.ex: IFEQ HOST_OS TARGET_OS FOO = BAR ; There'r some operations to do when conditionals matches: - = : assignation. - ?= : assignation when not defined. - += : concatenation. Nesting conditionals: ===================== You can nest conditionals by using the '{' '}' keys. f.e.: IF HOST_OS linux { DIENOW I don't want to be built on top of a penguin! ; } When create a new frame for a conditional, you can add any code you want inside. Is not restricted to variable assignations. This will probably be expanded in the future. But keeping backward compatibility or auto translation for the new syntax. A bit of documentation: ======================= [ IF | IFNOT ]========================================================== SYNTAX: IF [varname] [setvarname] [operation] [value] ; EXAMPLE: IF HAVE_LIB_C HaveLibC = 1 ; EXPLANATION: Checks if the content of [varname] is equal to 1 (IF) or 0 (IFNOT). [ IFNULL | IFNOTNULL ]================================================== SYNTAX: IFNULL [varname] [setvarname] [operation] [value] ; EXAMPLE: IFNULL JAPANESE JSUPPORT = 1 ; EXPLANATION: Checks if the content of [varname] is empty (IFNULL) or not (IFNOTNULL) [ IFAND | IFNOTAND ]==================================================== SYNTAX: IFAND [varname] [varname] [setvarname] [operation] [value] ; EXAMPLE: IFAND FOO BAR FooBar += FOO and BAR are equal to 1 ; EXPLANATION: Checks if the content of both varnames are equal to 1 (IFAND) or 0 (IFNOTAND) [ IFOR | IFNOTOR ]==================================================== SYNTAX: IFOR [varname] [varname] [setvarname] [operation] [value] ; EXAMPLE: IFOR FOO BAR FooBar += FOO or BAR is 1 ; EXPLANATION: Checks if the content of any of these variables contains 1 (IFOR) or 0 (IFNOTOR) [ IFEQ | IFNOTEQ ]====================================================== SYNTAX: IFEQ [varname] [value] ; [setvarname] [operation] [value] ; EXAMPLE: IFEQ HOST_OS netbsd ; NiceOS = 1 ; EXPLANATION: Checks if the content of [varname] is equal to [value]. [ IFEQVAL | IFNOTEQVAL ]================================================ SYNTAX: IFEQVAL [varname] [varname] [setvarname] [operation] [value] ; EXAMPLE. IFEQVAL FOO BAR FooEqualToBar = 1 ; EXPLANATION: Checks if values of both [varnames] are equal. acr-2.2.0/doc/crosscompile000066400000000000000000000062311475143313200154570ustar00rootroot00000000000000Crosscompiling with ACR ======================= *WARNING* ACR integrates crosscompile in v0.3 *WARNING* GNU compatible crosscompile since v0.4 Running ./configure you'll see these three flags: --target = arch/os that our program will generate code for. --build = where the program is built (autodetected) --host = where the program will run. The 'canadian cross' term is related to a build that target, build and host are different between them. --target flag is only used for compilers that will generate code for the target os/architecture. This must be used internally in your program. --build flag is autodetected and unmodifiable. And refers to the local architecture. --host flag is used to point to the os/arch where your program will run, for example: if you want to build a Solaris/sparc binary from your NetBSD/x86 box you must use --host=solaris-unknown-sparc or whatever the GCC toolchain prefix tells. A canadian cross example may be to build a solaris compiler that generates code for linux-x86 from your NetBSD/mips box. Well, using them you'll be able to crosscompile your projects in a simple way. Imagine that you need to build a win32 application. But you don't want to use any proprietary software, and you prefer to stay on your UNIX box. Then you'll need to crosscompile. Crosscompile allows you to build binaries for other architectures or OS. Before anything you'll need to install the desired toolchain (mingw32, cygwin, or gcc-mips, etc...). The next step is just simple: $ ./configure --target=i586-pc-mingw32 checking build system type... i686-unknown-linux checking host system type... i586-pc-mingw32 checking target system type... i686-unknown-linux checking for working directories... current checking for c compiler... i586-pc-mingw32-gcc checking for cpp... i586-pc-mingw32-cpp cleaning temporally files... done Final report: - CC = i586-pc-mingw32-gcc As you can see, CC is reassigned to use the desired target compiler. By now, just type 'make'. And everything must go fine. --- Problems and tips ================= As you'll understand, target binaries for w32 will be called 'foo.exe', and you'll need to ifdef all your Makefiles to modify CFLAGS and files to be removed, etc. A sample Makefile.acr would be: Note that this is only for the GNU Make --------------8<----------------- HOST_OS=@HOST_OS@ VPATH=@VPATH@ CC=@CC@ CFLAGS=@CFLAGS@ LDFLAGS=@LDFLAGS@ OBJS=foo.o bar.o ifeq ($(HOST_OS),mingw32) BIN=foo.exe FLAGS+=-mwindows LIBS=-lwsock32 -lSDL_mixer -lSDL_image -lSDL -lopengl32 -lglu32 -lm else BIN=foo endif all: ${OBJS} ${CC} ${FLAGS} ${LIBS} ${OBJS} -o ${BIN} clean: -rm -f ${BIN} ---------->8--------------------- GCC specific checks =================== You (and probably acr in the future) can check for `gcc -dumpmachine` to check the target of the compiler. OS/ARCH checks in .acr ====================== Sometimes your programs will be restricted to certain OSs or architectures. For example: Your program is linux-based and nonportable to other OSs: = OS_OK 0 ; IFEQ HOST_OS linux ; OS_OK = 1 ; DIENOT OS_OK You need a GNU/Linux system to run this program. These rules are easy to modify, to make checks for architecture, etc. acr-2.2.0/doc/crosspath-build000066400000000000000000000051571475143313200160660ustar00rootroot00000000000000CrossPath building with ACR =========================== ** IMPORTANT ** Read carefully the entire document. At the end there's detailed information to create well written crosspath Makefiles (only for acr>=0.4) (older ones are buggy). ** IMPORTANT ** Crosspath building is a way to build sources in a clean way. And is also useful for crosscompiling and make parallel builds. This feature is an internal 'make' tool tip. But must be enabled in all Makefiles and the ./configure must know that to allow it. All Makefile.acr files must a line like this: VPATH=@VPATH@ This is the same that GNU autoconf does with: VPATH=@srcdir@ ACR internally will autodetect if you are using a crosspath and will set this path to the correct one when generating the Makefiles from the .acr files. This is an example: $ tar xzvf foo-0.1.tar.gz $ mkdir build $ cd build $ ../foo/configure $ make By this way source directory will be kept clean, and all files, objects and modifications generated by ACR will be done in build/ directory instead of foo/ one. Install target ============== I was noticed that GNU and BSD Makefiles ignores VPATH when currentpath files are found in the install stage. This bug is fixed in acr v0.4, and requires some changes in the Makefile.acr. Simple explanation of the problem: ---------------------------------- You've two directories called 'alice' and 'bob' :) The first one contains the configure script and two source files: $ ls alice configure Makefile.acr a.c b.c the configure script SUBST the a.c file. On <0.4 will do: - mv a.c a.c.orig - sed {sedflags} a.c.orig > a.c this is ok for non-crosspath builds, but crosspath builds forces the build to keep intact the source tree. By this way acr 0.4 fixes this tip just sedding them into the current path: - sed {sedflags} {vpath}/a.c a.c By now, the a.c file in current dir will override the {vpath}/a.c. (handled by VPATH rule in make). The problem is that make only handles VPATH fine on builds. If you'r installing you'r forced to specify the entire path to the file. BTW all non substed files must be referenced by a ${VPATH} prefix and substed files without it. A simple example is 'here', in the ACR's Makefile.acr: ---[ acr's makefile.acr ]--- ... VPATH=@VPATH@ INSTALL_SCRIPT?=@INSTALL_SCRIPT@ BINDIR=@BINDIR@ install: mkdir -p ${BINDIR} ${INSTALL_SCRIPT} src/acr ${BINDIR}/acr ${INSTALL_SCRIPT} src/acr-sh ${BINDIR}/acr-sh ${INSTALL_SCRIPT} ${VPATH}/src/acr-cat ${BINDIR}/acr-cat ... ---[ acr's makefile.acr ]--- ---[ acr's configure.acr ]--- ... (( directories )) SUBDIRS . ; SUBST_FILES src/acr src/acr-sh ; ... ---[ acr's configure.acr ]--- acr-2.2.0/doc/developers/000077500000000000000000000000001475143313200152005ustar00rootroot00000000000000acr-2.2.0/doc/developers/adding_new_language000066400000000000000000000011401475143313200210610ustar00rootroot00000000000000How to add a new language into ACR ================================== Just follow these steps: *) edit src/acr-sh *) init lang environ (in ##INIT## section) LANG_XXX="" LANG_XXX_REQUIRED="" LANG_XXX_ENV="" *) add keyword in ##LANGS## section "LANG_XXX") env_xxx; ;; "LANG_XXX") env_xxx; LANG_XXX_REQUIRED=1 ; ;; *) add env_xxx in ##ENV_LANG## section env_xxx() { if [ "${LANG_XXX_ENV}" = "1" ]; then return ; fi LANG_XXX_ENV="XXX" ENVHELP=`cat <&2 leave_string_mode ;; (...) esac acr-2.2.0/doc/developers/unit-tests000066400000000000000000000004731475143313200172460ustar00rootroot00000000000000Unitary tests for ACR ===================== There's a make target called 'test' that tries to parse and execute all examples/* files and returns a number of failed results. Would be good to write more unitary tests in examples, to try to avoid portability problems and track syntax changes on different versions. acr-2.2.0/doc/developers/using_cvs000066400000000000000000000020101475143313200171140ustar00rootroot00000000000000Using acr with version control systems: ======================================= I heard some people talking about the conflicts between cvs/svn and autoconf. IMHO this is not a autoconf problem, is just a developer problem. The main problem of using control versions and auto build systems is that you can subst some tags from one file and acr will make a backup from the original file with name : (old-name).orig If you up/ci your repository these files will be obviously modified, and may result on corrupt sources with diff tags like rows ("=====>") or erroneous commits. To fix this tips, I recommend to use always SUBDIRS, and be aware if you use SUBST_FILES because it creates backups and overrides the original content of the file. Just type "-mv -f (file).orig (file)" into your Makefile's /clean/ target and don't forget to type "make clean" before each cvs update! Also remember that cleaning this, your modified files will be lost, be aware, and modify only the .orig files when they exists, and re-run ./configure acr-2.2.0/doc/endian000066400000000000000000000056161475143313200142210ustar00rootroot00000000000000ENDIAN CHECKS ============= There'r some checks that are interesting to do before the build stage, to prevent runtime programs for this checks, change build paths or other tips. One of these checks is the "ENDIAN". Some CPUs are little endian (intel,vax), another ones big endian (68k,sparc), other ones are bytesexual or bi-endian like (ppc, arm, alpha, mips, pa-risc or ia64). And finally another ones are middle-endian (some VAXes for fp ops) also called PDP endian. The endianness of an architecture defines how it stores and loads data from registers and memory: +-------+------------+---------------+---------------+ | human | big endian | little endian | middle endian | +-------+------------+---------------+---------------+ | 1234 | 1234 | 4321 | 3412 | +-------+------------+---------------+---------------+ ACR only checks for big and little endian, middle ones are not in plans to be supported. About the bytesexual architectures they may only work in one of them, not both in the same running system. It requires an entire system build for the proper work. ACR provides a keyword to include the check for endianness in the final configure script. It's called "CHECK_ENDIAN" or "ENDIAN". This keyword exports three new variables to the acr environment: --[ on little endian machine (x86) ]-- BYTEORDER = 4321 LIL_ENDIAN = 1 BIG_ENDIAN = 0 --[ on big endian machine (sparc) ]-- BYTEORDER = 1234 LIL_ENDIAN = 0 BIG_ENDIAN = 1 To check endianness in the build stage you may also use what your system provides: "endian.h" --[ simple us of endian.h ]-- #include #if __BYTE_ORDER == __LITTLE_ENDIAN /* little endian stuff */ #else /* big endian stuff */ #endif --[ simple us of endian.h ]-- Reference: http://en.wikipedia.org/wiki/Endian 32-64-128 BITS CHECK ==================== Another interesting check may be to know the size of registers in the target architecture. In ACR this check is inherit into the SIZEOF keyword, that allows the programmer to know the size of the desired variable type. The difference between different size of register architectures is done by getting the size of a pointer or integer. But's recommended to check the size of a pointer. SIZEOF void* ; A simple example may be: ----[ shell ] $ cat configure.acr LANG_C SIZEOF void* ; REPORT SIZEOF_VOID_PTR ; $ ./configure checking build system type... i686-unknown-linux checking host system type... i686-unknown-linux checking target system type... i686-unknown-linux checking for working directories... current using prefix /usr/local checking for c compiler... gcc checking size of void*... 4 cleaning temporally files... done Final report: - SIZEOF_VOID_PTR = 4 ----[ shell ] Multiplying the SIZEOF_VOID_PTR value for 8 gives the user the size of the register size of the processor. 4*8 = 32 bit (x86, ppc...) 8*8 = 64 bit (ia64, g5...) ... Reference: http://en.wikipedia.org/wiki/64-bit acr-2.2.0/doc/flag-arguments000066400000000000000000000035021475143313200156670ustar00rootroot00000000000000ACR flag arguments =================== Flag argument use in ACR are very simple. But also powerful :) From the user view arguments are checked by the main argument parsing loop, where the script checks for flags like '--prefix' '--host'. But the user can add some new flags to allow some program specific options. For example: $ ./configure --report | grep FLAGS FLAGS: --enable-debug $ ./configure --prefix=/usr --enable-debug Types of arguments: ------------------- There'r two type of argument flags in ACR. The boolean and the variable ones. Boolean: -------- Boolean flag arguments are just flags that allows a true or false values. They are used to enable or disable some options of your program. The '--with' and '--enable' ones have a default value of 0, giving a true value to the variable when the user calls ./configure with this flag. The '--without' and '--disable' are just the inverse of above. Let's see an example of a boolean flag argument: Type this in your favorite configure.acr file :) ----8<------------------------ ARG_ENABLE DEBUG debug compiles the program with debugging features. ; --------->8------------------- This will add a --enable-debug flag in your ./configure script that sets DEBUG=0 at the beginning of the script. And sets DEBUG=1 when the user uses the --enable-debug flag. Variable: --------- Variable flag arguments are used to specify paths, strings or something variable for the user. Let's see an example of use: ---8<------------------------ ARG_WITH WWWUSER=www wwwuser sets the default user for http. ; ARG_WITH WWWROOT=/home/www/ wwwroot sets the default root for http. ; ------->8-------------------- This will set WWWUSER to "www" allowing the user to change this value by using the --with-wwwuser=VALUE. For example: $ ./configure --with-wwwroot=/var/www --with-wwwuser=webmaster acr-2.2.0/doc/gnumake000066400000000000000000000011401475143313200143760ustar00rootroot00000000000000GNU make ======== GNU make extends the syntax for the original Makefiles allowing you to use some interesting expressions. If you're using gnu makefiles in your project you must specify't in your configure.acr configuration file by adding this line: USE_GMAKE This flag makes configure script fail if no gnu make program is found on your system. So, you must re-define the MAKE variable on each Makefile by adding this line at top of each Makefile.acr: MAKE=@MAKE@ This will make run happy on BSD systems (for example) where 'make' command is not the GNU one, wrapping the concurrent calls to 'gmake'. acr-2.2.0/doc/hello_world000066400000000000000000000064771475143313200153030ustar00rootroot00000000000000hello_world example for the ACR =============================== Introduction: ------------- As you knows after read the ../README file. ACR is an autotools replacement. This tool allows developers to create portable and lightweight 'configure' scripts in a lightweight way. Configure script allows end-users and developers to check what libs are installed on the system, allowing the user to choose between different options and prepare all scripts and Makefiles to build the target package with the chosen options. The Hello World: ---------------- The most faster way to understand how acr works is creating a simple program like this hello.c: ----8<------ #include int main(int argc, char *argv[]) { printf("Hello World!\n"); return 0; } ---->8------ Ok, now we have our powerful hello world program created. The first thing you must think about is what kind of requirements will your program need... - C compiler - stdio.h - printf function In a second term we can add new flags to the configure script to allow end-users to modify some functionality of our program like: - disable message output - build it statically - etc.. Creating the configuration file ------------------------------- It's recommended to read the doc/syntax and doc/keywords files to understand all ACR commands, possibilities and syntax. Now we create this file called 'configure.acr': -----8<------------ PKGNAME helloworld VERSION 1.0 LANG_C! // we need a C compiler \\ // check for includes and libraries \\ CHKINC! stdio.h CHKLIB! c printf // Makefiles \\ CHECK_PROG INSTALL install SUBDIRS . ; ----->8------------ Ok, Now that looks fine. Generating the ./configure script --------------------------------- That's the most easy tip of the tutorial =) Just type "acr" and ./configure script will be generated. $ acr acr: ./configure script created successfully. $ ls configure configure.acr hello.c $ Creating the Makefile --------------------- All above work must be joined into the Makefiles that will build and install our program. Now we have to create a Makefile prototype. A file used by 'configure' to create the final Makefile. ACR can filter Makefiles and simple plain text files, by now, we only need to filter a Makefile. Then we will use "SUBDIRS" command to tell ACR what directories must find for Makefile.acr files. For this reason out 'configure.acr' file has the 'SUBDIRS . ;' line. Our Makefile will use the @VAR@ syntax like autotools does. Let's see how Makefile.acr looks like: ---------8<--------------- all: @CC@ hello.c -o hello install: mkdir -p @PREFIX@/bin @INSTALL@ hello @PREFIX@/bin/hello clean: rm -f hello Makefile -------->8---------------- Testing ------- Everything is done now. We can test that. $ ls Makefile.acr configure configure.acr hello.c $ ./configure --prefix=/tmp/hello/ checking build system type... i686-unknown-linux checking host system type... i686-unknown-linux checking target system type... i686-unknown-linux checking for c compiler... gcc checking for cpp... cpp checking library c : printf()... yes checking for stdio.h... yes checking for install... /usr/bin/install configure: (tags) filtering ./Makefile.acr cleaning temporally files... done $ make gcc hello.c -o hello $ make install mkdir -p /tmp/hello/bin /usr/bin/install hello /tmp/hello/bin/hello That's all... easy no? :) acr-2.2.0/doc/keywords000066400000000000000000000177631475143313200146400ustar00rootroot00000000000000Keywords for the ACR configuration file: ======================================== Tips: ----- - Arguments of the functions doesn't have '<' or '>' tags. - '"' character means that contains the text of the above line All LANG_?? sets HAVE_LANG_?? variable to 1 or 0. Append '!' character to crash when no target lang found. operations: ----------- = <...> ; += <...> ; ?= <...> ; Assigns or appends the typed to the selected keywords: --------- PKGNAME Sets the target package name to be used. VERSION Sets the version number for the package AUTHOR ; Sets the Author string for --help. The author, is the person who starts the project environment: AUTHOR_MAIL: -> author email AUTHOR_NAME: -> author name CONTACT ; Sets the Contact string for --help, the address to contact for support environment: CONTACT_MAIL: -> contact email CONTACT_NAME: -> contact name REQUIRE_ACR_VERSION Check for ACR version before generating the configure. REPORT ; Shows a final report of the results of ./configure script. LANG_C[!] Tells to ACR that package needs a C compiler. - sets CC to 'gcc' if not defined. - adds implicit LANG_CPP LANG_CC[!] LANG_CXX[!] Tells to ACR that package needs a C++ compiler. - sets CXX to 'g++' if not defined. LANG_BASH[!] Looks for bash shell installed on the system - sets SH to the BASH path LANG_TCL[!] Looks for tcl version and libraries. - Sets TCL_VERSION, TCL_LIBS and HAVE_TCL=[0|1] - for more information look at ${pfx}/lib/tclConfig.sh LANG_JAVA[!] Tells to use java - adds --with-jikes and --with-kjc flags - export JAVAC environ LANG_VALA[!] checks for vala and valac programs and gets libvala version environment: VALA VALAC VALA_VERSION HAVE_VALA HAVE_VALAC HAVE_LANG_VALA LANG_PERL Looks for perl installed on current system LANG_RUBY Looks for ruby binaries and exports HAVE_LANG_RUBY, RUBY and RUBY_VERSION USE_PERL_THREADS[!] Looks for perl-threads on the system - Sets HAVE_PERL_THREAD to 0|1 USE_JNI Checks JAVA_HOME to use it for building java native interfaces. - Sets JCFLAGS USE_DL Autodetects if system needs libdl and sets LIBS_DL environ - Sets LIBS_DL to -ldl or "" - Sets HAVE_LIB_DL to 1|0 USE_ICONV Autodetects if system needs libiconv. - Sets LIBS_ICONV USE_PTHREAD Finds POSIX threads implementation and sets PTHREAD_LIBS variable to the properly one that must be attached to the LDFLAGS by the user. NOP Does nothing keyword. (NO OPERATION) USE_BACKUP Use the .backup feature to recheck SUBST_FILES. (doc/backup) EXPORT_DEFINED Export only variables that value != "" and != 0 USE_X11 Adds --with-x11base=xx and --without-x flags - Sets X11BASE USE_TK Adds --with-tk-libdir flag - Sets HAVE_TK TK_VERSION TK_CFLAGS and TK_LIBS USE_GMAKE Finds the GNU version of make. - sets MAKE to the GNU make path CHECK <..code..> CHECK_EXEC <..code..> Executes the <..code..> delimited by the keyword and marks varname as the target variable to be defined by the script. (see examples/check.acr fmi) CHECK_INCLUDE[!] CHKINC[!] Finds the requested include file - needs LANG_C or LANG_CXX - sets HAVE_INCLUDE_H to 1 or 0 CHKFNC[!] CHECK_FUNCTION[!] Checks if desired function exists in libname - sets HAVE_FUNCTION environ to 0 or 1. -> for example: CHECK_FUNCTION SDL_mixer Mix_Linked_Version CHKLIB[!] CHECK_LIBRARY[!] Finds the functionname in libname - sets HAVE_LIB_LIBNAME environ to 0 or 1 -> for example: CHECK_LIBRARY SDL ENDIAN CHECK_ENDIAN Checks for host endianness (big or little) (not middle supported ;) This keyword exports BYTEORDER LIL_ENDIAN and BIG_ENDIAN vars. BYTEORDER is 1234 on little endian machines and 4321 for big endian. LIL_ENDIAN and BIG_ENDIAN values are 0 xor 1 INCLUDE Allows to include a file called 'module-name' in the acr module directory ( ${prefix}/share/acr/modules/ ) or in the current directory. SIZEOF varname ; Gets the size of the target value and assigns it to the variable. SIZEOF_VARNAME. -> for example: SIZEOF int ; SIZEOF long long ; CHK_PM CHECK_PERL_MODULE Checks if the system have installed the desired perl module - Sets HAVE_PM_xxx to 0|1 CHKVER CHECK_VERSION Checks if pkgname (software package registered into pkg-config db) is <= version. CHKPRG[!] CHECK_PROGRAM[!] Finds the program in ${PATH} or uses the environment variable. - define to path to CHK_CP[!] CHECK_CLASSPATH[!] <""> Checks if the desired package name (java.util, org.gnu.gtk...) is inside the CLASSPATH and can be used. CHK_PY[!] CHECK_PYTHON_MODULE[!] Checks for the requested python module. Sets HAVE_PY_xxx. CHK_RU[!] CHECK_RUBY_EXTENSION[!] Checks for the requested ruby extension. Sets HAVE_PY_xxx. OUTPUT_H ; Generates a .h file that #defines all environment variables OUTPUT_SH ; Generate a shell-script compatible file that sets all result variables. SUBST_FILES ; Subst all @VARNAME@ to value of ${VARNAME} SUBDIRS ; Finds in dirs for Makefile.acr files to generate the final Makefile (acr>=0.4) if the target is a file plus '.acr' then will use this file as incoming filtering. SUBCONF ; Call recursively other ./configure scripts found in passing the root ./configure flag arguments. ARG_WITH ; ARG_WITHOUT " " " " ARG_ENABLE " " " " ARG_DISABLE " " " " Adds a with/without/enable/disable flag to the configure script. For example: ARG_ENABLE STATIC static Build static binaries ; -> will be used: ./configure --enable-static ARG_WITH DATAPATH datapath Sets the path for the data -> will be used: ./configure --with-datapath=/path/to/data CHECK Executes the and sets to set the varname. For example: CHECK SDL_sound < ; Exports a new varname to the ACR environment. This is used to subst @XXX@ strings on files NOT Negates the value of the requested varname. IF ; IFNOT ; Sets to when = (IF=1,IFNOT=0) IFNULL ; IFNOTNULL ; Sets to when = "" or not IFEQ ; ; IFNOTEQ ; ; If value of varname is equal to the given then will set the to the . IFEQVAL ; IFNOTEQVAL ; If value of varname is equal to the value of then will set the to the . IFAND ; IFNOTAND ; If value of is the same that then variable will have the value of . DIE ; DIENOT ; Configure script fails when = (DIE=1,DIENOT=0) DIE will print the array of words after crash. VALAPKG Check if the given Vala package name exists PKGCFG PKGCONFIG PKGCFG+ PKGCONFIG+ Uses pkg-config to set the cflags and ldflags values. Suffixing the command by the '+' sign pkg-config output will be appended at the end of the desired variable name. EXEC VAR command to be executed ; Sets VAR=`command to be executed` - Exports it. acr-2.2.0/doc/libtool000066400000000000000000000015331475143313200144210ustar00rootroot00000000000000USING LIBTOOL WITH ACR ====================== - write this rule in your configure.acr: PKGNAME libmoo VERSION 1.0.2 USE_LIBTOOL Now acr will find for libtool and export the following environ: LIBTOOL_CC LIBTOOL_SHARED LIBTOOL_INSTALL Now you must edit the Makefile.acr and put something like that: LIB_VERSION=@VERSION@ LIBTOOL_CC=@LIBTOOL_CC@ LIBTOOL_SHARED=@LIBTOOL_SHARED@ LIBTOOL_INSTALL=@LIBTOOL_INSTALL@ Now things will look like this: LIB_VERSION=@VERSION@ LIBTOOL_CC=@LIBTOOL_CC@ LIBTOOL_SHARED=@LIBTOOL_SHARED@ LIBTOOL_INSTALL=@LIBTOOL_INSTALL@ LIBDIR=@LIBDIR@ LIBNAME=libtest %.lo:%.c ${LIBTOOL_CC} $< all: file1.lo file2.lo ${LIBTOOL_SHARED} ${LIBNAME}.la file1.lo file2.lo install: mkdir -p ${LIBDIR} ${LIBTOOL_INSTALL} ${LIBNAME}.la ${LIBDIR} clean: -rm -rf .libs -rm *.o *.lo *.la acr-2.2.0/doc/make-tips000066400000000000000000000013431475143313200146460ustar00rootroot00000000000000Makefiles suggestions ===================== Always get the environment variables from ACR: CC=@CC@ PREFIX=@PREFIX@ VPATH=@VPATH@ INSTALL_PROGRAM=@INSTALL_PROGRAM@ Start writing the makefile from the template created with 'acr -m' may be a good idea. Conditionals: ============= For GNU make: ifeq ($(HAVE_SDL_MIXER),1) LDFLAGS+=-lSDL_mixer endif For BSD make .if ${HAVE_SDL_MIXER} == "1" LDFLAGS+=-lSDL_mixer .endif This is so tricky and system dependent...you can use ACR to fix this: IF HAVE_SDL_MIXER LDFLAGS += -lSDL_mixer ; But remember, this LDFLAGS will be world-wide, and may be interesting to use different LDFLAGS for each program or directory src: = GAME_LDFLAGS ; IF HAVE_SDL_MIXER GAME_LDFLAGS += -lSDL_mixer ; acr-2.2.0/doc/pkg-config000066400000000000000000000012271475143313200150010ustar00rootroot00000000000000pkg-config with ACR =================== You can easily create .pc files for your program by adding a simple template file like this in your project: --- libfoo.pc.acr # Package Information for pkg-config prefix=@PREFIX@ exec_prefix=${prefix} libdir=@LIBDIR@ includedir=@INCLUDEDIR@ Name: @PKGNAME@ Description: Your description Version: @VERSION@ Libs: -L${libdir} -Wl,-R${libdir} -lfoo Cflags: -I${INCLUDEDIR} --- You must add the following line in your Makefile.acr: --- Makefile.acr install: ${INSTALL_DATA} libfoo.pc ${LIBDIR}/pkgconfig/ --- And of course...you must handle this file into the configure.acr: --- configure.acr SUBDIRS libfoo.pc ; --- acr-2.2.0/doc/sandbox000066400000000000000000000027001475143313200144100ustar00rootroot00000000000000ACR sandbox =========== ACR implements --sandbox-prefix flag to allow users to install programs in a sandbox-way. For example: Suppose you have a chroot/jailed environment for some users on your box in /home/jailed/ directory. In this directory you have another system installed (/usr,/home,/etc...). If you use --prefix=/home/jailed/ you'll probably have problems when running the target application into the jailed environment. Because program will find their files in /home/jailed/usr/share/data/... And this directory only exists out of the box. Another scene could be: I want to install a program in /usr directory, like all the rest of the system. But I want to know the /PLIST/, the list of all files installed, generate a MD5 checksum and reinstall the application to the properly path (or just cp -Ra). To solve this kind of problems, ACR implements a new flag called --sandbox-prefix, that allows you to specify the directory where all files will be installed. SPREFIX (sandbox-prefix) points by default to PREFIX. Logically your Makefiles will require some new stuff, this is an example: ----------------------------8<----------------------- # pfx stf PREFIX=@PREFIX@ SPREFIX=@SPREFIX@ SPREFIX?=${PREFIX} # oth stf VPATH=@VPATH@ INSTALL=@INSTALL@ INSTALL_DIR=@INSTALL_DIR@ INSTALL_SCRIPT=@INSTALL_SCRIPT@ (...) install: ${INSTALL_DIR} ${SPREFIX}/bin ${INSTALL_SCRIPT} bin/hello ${SPREFIX}/bin ------------------>8--------------------------------- acr-2.2.0/doc/syntax000066400000000000000000000032411475143313200143010ustar00rootroot00000000000000Syntax: ======= This documents explains the ACR syntax, not the keywords. The Configure.Acr file: ----------------------- Acr needs a configure.acr configuration file to create the final configure script. Now I will explain some syntax tips. You don't have to think about all the autotools complexity. This is ACR, and the *ONLY* compatible tip with autotools is the final generated "./configure" script. This is a word-parsed file. Acr doesn't know anything about the line or eofs. Instead of that, acr uses three different syntax strings: - fixed ones - Function knows how many parameters requires. for example: PKGNAME HelloWorld CHECK_LIB c printf - array ones - There'r some keywords that require a space separated list of names. Acr gets them until a semicolon ';' is found. for example: OUTPUT_H config.h src/config.h ; += CFLAGS -Dfoo ; - piped ones - It's also possible to create external scripts, long multi-line messages for example: CHECK COW <temp.java \ echo "class temp{public static void main(){Vector v=null;}}" >>temp.java \ ${JAVAC} -source 1.5 temp.java >/dev/null 2>&1 \ JAVA5=$? \ rm -f temp.java <temp.java \ echo "class temp{public static void main(){Vector v=null;}}" >>temp.java \ ${JAVAC} -source 1.5 temp.java >/dev/null 2>&1 \ JAVA5=$? \ rm -f temp.java < acr-2.2.0/man/man1/acr-wrap.1000066400000000000000000000011351475143313200154700ustar00rootroot00000000000000.Dd Aug 12, 2022 .Dt ACR-WRAP 1 .Os .Sh NAME .Nm acr-wrap .Nd compile meson wrap files into makefiles .Sh SYNOPSIS .Nm acr-wrap .Op Ar configure-script .Sh DESCRIPTION acr-wrap is script that generates a makefile from a meson wrap file. .Pp This way it is possible to use meson subprojects without depending on meson to work. Reducing maintainance costs when multiple build systems are in use, but also enabling make-based projects to use a cleaner syntax for external source projects. .Sh SEE ALSO .Xr amr 1 .Xr acr 1 .Xr acr-cat 1 .Xr configure.acr 5 .Sh AUTHOR Written by pancake acr-2.2.0/man/man1/acr.1000066400000000000000000000035061475143313200145250ustar00rootroot00000000000000.Dd Aug 12, 2022 .Dt ACR 1 .Os .Sh NAME .Nm acr .Nd autoconf replacement .Sh SYNOPSIS .Nm acr .Op Fl dDehmnprvwx .Op Ar -o file .Op Ar file | args .Sh DESCRIPTION ACR tries to replace the autoconf functionality generating a full compatible "configure" script. The main difference is that ACR uses shell script instead of m4, and final generated script looks smaller, faster, easy to read and maintain. .Pp There's a new concept that consists on adding simple rules. And trying to skip all programming and non-portable stuff. That breaks standarization of software packages. .Bl -tag -width indent .It Fl d -debug Runs ACR in debug mode. This will show a branch tree for all command calls, allowing the developer to see if the target script is parsed properly. .It Fl D -dist Scans current project directory, resets to the initial state and creates a distname tarball 'pkgname-version.tar.gz'. .It Fl e -embed Embeds configure.acr into the final configure script. .It Fl h -help Show the usage message to the console. .It Fl m -makefile Creates a sample "Makefile.acr" using configure.acr file. .It Fl n -do-nothing Do not create the final configure script. .It Fl o -output Ar [file] Generate the configure script into a different filename. .It Fl p -progress-bar Show progress bar. .It Fl r Recovery mode. See acr-cat(1) for more information. .It Fl s Strip default code generation, this is flag parsing and system checks. .It Fl v --version Show version information. .It Fl w --word [number] Cats the 'configure.acr' file and colorizes the desired word number. .It Fl x -exec Generates and executes the configure.acr directly without creating the "configure" file. You can also pass the cmdline flags like \-\-prefix, etc. .El .Sh SEE ALSO .Xr amr 1 .Xr acr-cat 1 .Xr acr-wrap 1 .Xr configure.acr 5 .Xr configure.amr 5 .Sh AUTHOR pancake acr-2.2.0/man/man1/amr.1000066400000000000000000000026241475143313200145370ustar00rootroot00000000000000.Dd Aug 12, 2022 .Dt AMR 1 .Os .Sh NAME .Nm amr .Nd automake replacement .Sh SYNOPSIS .Nm amr .Op Fl acmrshv .Sh DESCRIPTION AMR allows you to autogenerate sample/final Makefiles. This allows you to maintain all the makefiles of your project in a simple and centralized way. You'll probably need to use AMR for the initial port to acr for you applications. .Pp AMR is on early and experimental stage. So you'll probably find a lot of problems, bugs and missfeatures. Please feel free to documentate, and send patches and ideas for it. .Sh USAGE AMR allows you to create different kind autogenerated ACR files: configure.amr, configure.acr, Makefile.acr. .Bl -tag -width indent .It Fl a Scan source code files recursively from the current directory and generates a configure.amr. Is recommended to run this command for each directory where you have source files. (acr \-d) .It Fl c Parses the configure.amr and prints out a sample configure.acr. .It Fl d Reads the configure.amr and prints the directories where you'll need to run amr. You can easily automate this process in autogen.sh .It Fl m Parses configure.amr to generate the Makefile.acr .It Fl s Generate shellscripts instead of Makefiles. .It Fl r Show report. .It Fl h Show help message. .It Fl v Prints the version number of AMR. .El .Sh SEE ALSO .Xr acr 1 .Xr acr-cat 1 .Xr acr-wrap 1 .Xr configure.acr 5 .Xr configure.amr 5 .Sh AUTHOR pancake acr-2.2.0/man/man1/install-acr.1000066400000000000000000000021441475143313200161660ustar00rootroot00000000000000.Dd Aug 12, 2022 .Dt INSTALL-ACR 1 .Os .Sh NAME .Nm install-acr .Nd acr wrapper for install program .Sh SYNOPSIS .Nm install-acr .Op Fl program|script|library|data .Op Ar -P plist-file .Op Ar source target .Sh DESCRIPTION install-acr is an '/usr/bin/install' program wrapper. The main purpouse of it is to bring to the end user some interesting features to install programs, by this way you can create realtime PLISTs of the installed files and directories, and set default permissions by a simple word like '-program'. .Bl -tag -width indent .It Fl -program sets the proper flags to set permissions to install programs. .It Fl -script sets the proper flags to set permissions to install an script. .It Fl -library sets the proper flags to set permissions to install libraries. .It Fl -data sets the proper flags to set permissions to install a data directory or file (like share/ files (images, documentation, etc) .It Fl -h --help Shows install and install-acr help messages. .El .Sh SEE ALSO .Xr install 1 .Xr acr 1 .Xr amr 1 .Xr acr-cat 5 .Xr configure.acr 5 .Xr configure.amr 5 .Sh AUTHOR pancake acr-2.2.0/man/man5/000077500000000000000000000000001475143313200136765ustar00rootroot00000000000000acr-2.2.0/man/man5/configure.acr.5000066400000000000000000000365171475143313200165250ustar00rootroot00000000000000.Dd Feb 25, 2022 .Dt CONFIGURE.ACR 5 .Os .Sh NAME .Nm configure.acr .Nd configuration script for ACR .Sh DESCRIPTION configure.acr is the target file to be parsed by ACR to generate the final "configure" script for end-users. .Pp Inside this file you must set some directives to indicate ACR what kind of languages are planning to be used in the package, libraries to be checked, variables to be exported, name for the package, version, vendor information, and other stuff. .Pp The recommended order of checks and commands is: .Bl -bullet -compact .It check operating system .It check paths .It check required languages .It libraries/includes/modules checks, dies .It pkg-config checks: version/assignations .It final conditionals and dies .It generation of .acr files with SUBDIRS and SUBST_FILES .El .\" .Sh SYNTAX The configure.acr file is a word-based configuration file for ACR. .Pp This means that each word must be separated with space, tab or new-lines. The ';' separator to terminate strings must be also a separated word. .Pp Each word is called "keyword", there are these types: .Bl -tag -width indent .It Miscelaneous-Keys: { } ; .It Command: ( Any active keyword ) .It Conditionals [ IF IFEQ IFEQVAL IFAND IFOR ] [IFNOT-[EQ|EQVAL|AND|OR] .It Argument: ( keywords after commands or conditionals ) .It Comment: Block comments: /* */ Line commentsr: // Note that one-word comments has been deprecated. But you can use line comments // .It Definitions: ( Global or local variable assignations. '=' '+=' '?=' ) From the version 0.4, acr supports the normal variable assignation syntax format. Now you can use things like that: VAR = VALUE ; .Bl -bullet -compact .It "=" resets the value of the target variable. .It "+=" appends the value to the target variable. .It "?=" checks if the target variable is yet defined, and does not overwrites its content. .It "<-" the target value gets the content of the variable defined in the text content. .El .It Substitutions: You can use SUBDIRS to define a list of directories to find Makefile.acr files to generate Makefile peers. You can also use this for files instead of directories by giving a name, it'll parse the 'filename.acr' to generate the 'filename' file. .Pp You can use ##MARK## to define a range of code to show or hide depending on the value of the MARK variable (0 or 1). (This is available from acr 0.5) .It Comments: .Pp You can add comments to your configure.acr files by using: .Pp // comment \\\\ or ## comment ## .El .Pp Note that you can create multi-line comments using these tags, because everything in this file is word-based. .Pp You are allowed to use one-word-comments, it's simple. Just prefix the desired word with a hash '#' sign. for example: #FOO PKGNAME FOO .Pp Some keyword commands can be suffixed by '!'. This tells ACR to stop execution of the configure script when the condition fails, instead of adding one DIE for each check at the end of script. .Pp For more information read acr(1) about the use of the '\-d' flag. .\" .Sh PACKAGE INFORMATION .Bl -tag -width indent .It PKGNAME Sets the target package name to be used. .It VERSION Sets the version number for the target package. .It CONTACT \ ; Sets the name of the developer and the contact mail to be used. This will export CONTANT_NAME and CONTACT_MAIL variables. .It DESCRIPTION \ ; Give a description for the package, this text is shown with `./configure -r` and it's also used for the pkgconfig files .El .\" .Sh ACR DIRECTIVES This directives are used internally by ACR to work in a different way. .Bl -tag -width indent .It USE_BACKUP This command has been deprecated for design purposes (good programmers doesn't need to use this command) in acr 0.5, and will no longer exist in 0.6. .Pp The backup command allows you to ensure that no files will be lost by calling the ./configure script or make clean. This option interacts with SUBST_FILES and Makefile generation with \-m. Read doc/backup for more info. .It EXPORT_DEFINED|ED Tells ACR to only export defined variables. This causes OUTPUT_H to export only the variables with value != "" and != "0". And OUTPUT_SH to export the != "" variables. .It INCLUDE Includes an external acr file from ${datadir}/acr/modules/ or in the current directory. called 'module-name.acr'. No nested includes allowed. .It NOP No Operation Keyword. This keyword is only for debugging purposes and it's used internally by ACR. This command does nothing. .El .\" .Sh LANGUAGES All language keywords exports a HAVE_LANG_xxx variable with value 0 or 1. You can append '!' to the language keyword to specify that the target language is required, and script must die when the desired language is not supported on the target machine. .Bl -tag -width indent .It LANG_C[!] ACR will look for a C compiler and sets CC, depends for implicit LANG_CPP. .It LANG_V[!] ACR will look for the V compiler and sets V and VFLAGS. .It LANG_CC[!] LANG_CXX[!] Adds C++ support and sets CXX environ. .It LANG_BASH[!] Tell acr to look for a bash on the target system. .It LANG_TCL[!] Looks for tcl version and libraries. Exports TCL_VERSION, TCL_CFLAGS and TCL_LDFLAGS to the environment. This will also adds the \-\-with-tcl-basedir to allow end-user to set the basedir for the TCL installation. .It LANG_PERL[!] Looks for perl installed on current system .It LANG_JAVA[!] Looks for javac in the current system. Exports JAVAC environ and adds \-\-with-jikes and \-\-with-kjc flags. .It LANG_VALA[!] Looks for valac in PATH. Exports VALAC environ and adds \-\-with-valac .It LANG_PYTHON[!] Finds a python executable on the current system. Exports PYTHON and HAVE_LANG_PYTHON. .It LANG_RUBY[!] Finds a ruby executable on the current system. Exports RUBY, HAVE_LANG_RUBY and RUBY_VERSION. .El .\" .Sh EXTERNAL SOFTWARE .Bl -tag -width indent .It USE_DL Sets LIBS_DL to \-ldl or "" depending on the target system. .It USE_LIBTOOL Checks for the libtool command and exports LIBTOOL_CC, LIBTOOL_CXX and some useful commands for your makefiles: LIBTOOL_SHARED, LIBTOOL_STATIC and LIBTOOL_INSTALL. .It USE_PKGCONFIG | USE_PKGCONFIG! Check for pkg-config or pkgconf program in PATH. Required for the PKGCFG directive .It USE_ICONV Sets LIBS_ICONV to \-liconv or "" depending if iconv functions are implemented into the LibC or not. .It USE_PTHREAD Checks for pthread on the current system and sets PTHREAD_LIBS to the proper value. .It USE_PERL_THREADS Checks if the target system have perl build with threads support. .It USE_X11 Adds \-\-with-x11base and \-\-without-x flags and sets X11BASE to the proper value. .It USE_TK Add \-\-with-tk-libdir flag and sets TK_CFLAGS, TK_VERSION .It USE_GMAKE Looks for a GNU make tool installed on the target system and sets MAKE properly. .It USE_JNI Uses JAVA_HOME to check and define the JCFLAGS for building java native interface programs. .El .\" .Sh CHECKS .Bl -tag -width indent .It REQUIRE_ACR_VERSION version Checks if acr version is greater or equal than the given version. .It CHECK varname < < delimited by the keyword and marks varname as the target variable to be defined by the script. (see examples/check.acr fmi) .It CHKEXE,CHECK_EXEC[!] varname program\ ; Execute program and set varname = !!!$? .It CHKPRG, CHECK_PROGRAM[!] varname program Finds the program in ${PATH} and sets variable environment to the properly path. Since 0.5 CHKPRG exports HAVE_varname variable and checks first if VARNAME is a valid executable file. .It CHKINC, CHECK_INCLUDE[!] include.h[+include2.h[+include3.h]] Checks if 'include.h' is found in the current system. Requires LANG_C and sets HAVE_include_H environment to 0 or 1 (for example: HAVE_STDIO_H) .It CHKFLG, CHECK_CFLAGS[!] varname cflags\ ; Checks if the selected C compiler supports the given CFLAGS (Useful for -std=c99 and such) .It CHKFNC, CHECK_FUNCTION[!] libname function Checks if the desired function exists in libname and sets HAVE_FUNCTION to 0 or 1 (for example: HAVE_PRINTF) .It CHKSYM, CHECK_SYMBOL[!] libname symbol Checks if the given symbol exists in libname and sets HAVE_SYMBOL to 0 or 1 (for example: HAVE_ENVIRON) .It CHKDECL, CHECK_DECLARATION[!] include constant Checks if the given constant is defined in the specified include file .It CHKLIB, CHECK_LIBRARY[!] libname Checks if the desired library exists on the system and sets HAVE_LIB_libname to 0 or 1 (for example: HAVE_LIB_SDL) .It ENDIAN|CHECK_ENDIAN Checks for the host endianness to be big or little. It'll export BYTEORDER=1234 on little endian hosts or 4321 for big endian ones. Also exports LIL_ENDIAN and BIG_ENDIAN with 0 xor 1 values. .It SIZEOF var\ ; Checks for the size of the desired variable and saves it into the variable SIZEOF_VARNAME. Requires LANG_C. .It CHECK_PERL_MODULE[!],CHK_PM[!] perl_module Checks if the target system have installed the selected perl module. and sets HAVE_PM_xxx to 0 or 1 (for example: HAVE_PM_NETDNS) .It CHECK_PYTHON_MODULE[!],CHK_PY[!] python_module Checks if the system have installed the desired python module and sets HAVE_PY_xxx to 0 or 1. .It CHECK_RUBY_EXTENSION[!],CHK_RU[] ruby_extension Checks if the system have installed the desired ruby extension and sets HAVE_RU_xxx to 0 or 1. .It CHECK_CLASSPATH[!],CHK_CP[!] java_package_name Checks if CLASSPATH contains the desired package (for example org.gnu.gtk). Exports the HAVE_CLASSPATH_(java-pkg-name) to 0 or 1. .It CHKUSR[!] username .It CHKGRP[!] group Checks the existence of the target user or group on the system. .El .\" .Sh DEFINITIONS Sets are processed at the beginning of the configure script. .Bl -tag -width indent .It = varname value\ ; Sets the value of varname to value. .It += varname value\ ; Appends the content of varname with value. .It ?= varname value\ ; If the content of varname is empty then assign the value to it. .It EXEC[!] variable command to execute\ ; Sets variable to the output (stdout) of the desired command to be executed. .It CHECK_VERSION,CHKVER[!] pkgname version Checks if pkgname (software package registered into pkg-config database) is <= version. And crashes execution if it fails. It exports the HAVE_(pkgname)_VERSION_(version) variable to 0 or 1. .It PKGCFG,PKGCONFIG[+] cflags_var ldflags_var pkg-config-name Use pkg-config to get the CFLAGS and LDFLAGS. If the '+' character is at the end of the command then ACR will concatenate the value of cflags_var and ldflags_var instead of overwrite the old value. This keyword exports also a variable called HAVE_PKGFG_{pkg-config-name|filtered} with 0 or 1 values. .It PKGCFG_DO pcfile\ libname\ requires\ ; Generate a pkg-config file for the given library name and make it depend on the word separated list of pkg-config requires .It VALAPKG[!] pkgname Checks if a Vala package is available for VALAC .El .\" .Sh CONDITIONALS All conditionals require an 'op'(operation) argument that defines how to set the setvarname. Valid operations are: '=' '+=' '?='. .Pp You can also nest conditionals inside other conditionals using the '{' '}' keywords. That allows you to concatenate a group of conditionals and definitions inside it. The nested conditionals support is available from acr 0.4. .Bl -tag -width indent .It IF|IFNOT varname { ..code.. } If the value of varname is equal to '1'(IF) or '0'(IFNOT) then ACR will set the 'setvarname' to the 'value'. .It IFNULL|IFNOTNULL varname { ..code.. } If the value of varname is equal to null (IFNULL) or not (IFNOTNULL)' then ACR will set the 'setvarname' to the 'value'. .It IFEQ|IFNOTEQ varname value ; { ..code.. } If the content of varname is equal(IFEQ) or different(IFNOTEQ) to value then setvarname to the value setvalue. .It IFEQVAL|IFNOTEQVAL varname varname2 { ..code.. } DEPRECATED: This keyword has been deprecated in 0.5 and will disappear in 0.6. Use IFEQ FOO $FOO ; instead. If the content of varname is equal(IFEQ) or different(IFNOTEQ) to the content of varname2 and finally sets setvarname to the value setvalue. .It IFAND|IFNOTAND var1 var2 { ..code.. } If var1 and var2 are equal to 1(IFAND) or 0(IFNOTAND) then setvar to setvalue. .It IFAND|IFNOTAND var1 var2 { ..code.. } If var1 and var2 are equal to 1(IFAND) or 0(IFNOTAND) then setvar to setvalue. .It IFOR|IFNOTOR var1 var2 { ..code.. } If var1 and var2 are equal to 1(IFAND) or 0(IFNOTAND) then setvar to setvalue. .It ECHO string\ ; Prints a string to stderr. .It DIEIF|DIE variable die_message\ ; .It DIEIFNOT|DIENOT variable die_message\ ; .It DIENOW die_message\ ; If the value of variable is equal to 1(DIE) or 0(DIENOT) then stop processing the ./configure script and shows the die message. Short keyword names (DIE, DIENOT) are going to be deprecated. .El .\" .Sh FLAGS .Bl -tag -width indent .It ARG_IGNORE flagname Ignore specific configure arg (do nothing) .It ARG_[WITH|WITHOUT|ENABLE|DISABLE] varname[=value] flagname description\ ; Adds a with/without/enable/disable flag to the final configure script. For example: .Pp ARG_WITH MPLAYER=/usr/bin/mplayer mplayer Sets path for the mplayer\ ; .Pp If no =value given, ARG_* will act as a boolean variable (0 for WITH and ENABLE, and 1 for WITHOUT and DISABLE). If the =value is given ACR will allow the user to construct flags like \-\-with-foo=bar. .Pp The 'value' argument must be: .Bl -bullet -compact .It "" (empty) : if you want to create a true/false flag (ex: \-\-without-x, \-\-enable-ssl) .It "=" : if you want that the user adds his own value. (ex: \-\-with-x11base=/usr/pkg/XFree86/ ) .It "something" : if you want to set the value to "something" when the flag is passed. (ex: \-\-with-kjc \-> sets JAVAC to kjc) .El .El .\" .Sh OUTPUT GENERATION .Bl -tag -width indent .It OUTPUT_H file1 file2\ ; Generates the file1 file2 with C-like syntax defining all exported variables with #defines. .It OUTPUT_SH file1 file2\ ; Generates the selected files like OUTPUT_H does but using a shellscript syntax. .It SUBST|SUBST_FILES file1 file2\ ; Replaces all @ENVWORDS@ with the exported variable proper value. Before doing the changes ACR copies the original file to file.orig. Remember to mv file.orig file on make clean target. This option is not recommended to use, because the problem you may experience by using acr+vcs systems. I recommend you to use SUBDIRS instead. (acr>=0.4) .It SUBDIRS dir1 dir2 file1 file2\ ; Finds Makefile.acr files in requested directories to generate the proper Makefile. acr>=0.4 allows to use SUBDIRS against files or directories, without difference. It's backward compatible. If the target name is a directory then acr will look for 'Makefile.acr', if not, it will get the filename.acr and will generate a new file keeping the name, but chopping the end '.acr'. You can also use the '%' keyword to match all Makefile.acr files under the current directory. This could be useful in case of changes on the directory structure of your project. .It SUBCONF dir1 dir2\ ; Calls recursively other ./configure scripts found in dir1, dir2 passing the root ./configure flag arguments. .It REPORT var1 var2\ ; Shows the varname and varvalue of the desired variables at the end of the final ./configure script. (useful for debugging) .El .Sh EXAMPLES .Bl -tag -width indent .It Simple example: .Bd -literal -offset indent PKGNAME helloworld CONTACT my real name ; my@email.com VERSION 1.0 LANG_C! SUBDIRS . src ; .Ed .It Some more checks .Bd -literal -offset indent PKGNAME gtkapp VERSION 1.0 LANG_C! PKGCFG+ CFLAGS LDFLAGS gtk+-2.0 SUBDIRS . src ; REPORT HAVE_PKGCFG_GTK_2_0 CFLAGS LDFLAGS ; .Ed .El .\" .Sh SEE ALSO .Xr acr 1 .Xr amr 1 .Xr acr-cat 1 .Xr configure.amr 5 .Sh AUTHOR pancake .Pp http://nopcode.org/wk.php/Acr acr-2.2.0/man/man5/configure.amr.5000066400000000000000000000010451475143313200165230ustar00rootroot00000000000000.Dd Apr 13, 2011 .Dt CONFIGURE.AMR 5 .Os .Sh NAME .Nm configure.amr .Nd configuration file for AMR .Sh DESCRIPTION This file is used by amr(1) to autogenerate the Makefile.acr files and/or configure.acr files. .Sh SYNTAX .Bl -tag -width indent .It CDIR path1 path2\ ; .It CSOURCES foo.c bar.c\ ; .It CINCLUDES include1 include2\ ; Include files used by the src files. .It CDEPS file1 file2 ; .El .Sh SEE ALSO .Xr acr 1 .Xr amr 1 .Xr acr-cat 1 .Xr configure.acr 5 .Sh AUTHOR Written by pancake .Pp http://nopcode.org/wk.php/Acr acr-2.2.0/modules/000077500000000000000000000000001475143313200137335ustar00rootroot00000000000000acr-2.2.0/modules/csharp.acr000066400000000000000000000010511475143313200156770ustar00rootroot00000000000000(( CSHARP module for ACR )) ARG_WITH MONO mono use the MONO .net environment ; ARG_WITH DOTGNU dotgnu use the DotGNU .net environment ; CHKPRG MCS mcs CHKPRG CSCC cscc _MCS = 0 ; _CSCC = 0 ; IFNOTEQ MCS mcs ; _MCS = 1 ; IFNOTEQ CSCC cscc ; _CSCC = 1 ; NOTEQ = 0 ; IFNOTEQVAL _MCS _CSCC NOTEQ = 1 ; CS_MODE = 0 ; IFAND NOTEQ _MCS CS_MODE = mono ; IFAND NOTEQ _CSCC CS_MODE = dotgnu ; IFAND MONO _MCS CS_MODE = mono ; IFAND DOTGNU _CSCC CS_MODE = dotgnu ; DIENOT CS_MODE No .NET compiler found on your system ; REPORT CS_MODE ; acr-2.2.0/modules/java-gtk.acr000066400000000000000000000004541475143313200161310ustar00rootroot00000000000000(( Java-GTK module for ACR )) LANG_JAVA! EXEC JG_CLASSPATH pkg-config gtk2-java --variable=classpath ; EXEC GL_CLASSPATH pkg-config glib-java --variable=classpath ; EXEC JG_LIBDIR pkg-config gtk2-java --variable=libdir ; CLASSPATH = $JG_CLASSPATH:$GL_CLASSPATH:$CLASSPATH ; CHK_CP! org.gnu.gtk acr-2.2.0/modules/sizes.acr000066400000000000000000000004061475143313200155570ustar00rootroot00000000000000(( Checks sizes of various C variables requires LANG_C )) LANG_C! SIZEOF! char ; SIZEOF! short ; SIZEOF! short int ; SIZEOF! int ; SIZEOF! long ; SIZEOF! long int ; SIZEOF! long long ; SIZEOF! double ; SIZEOF! long double ; SIZEOF! float ; SIZEOF! void* ; acr-2.2.0/src/000077500000000000000000000000001475143313200130525ustar00rootroot00000000000000acr-2.2.0/src/acr000077500000000000000000000105631475143313200135520ustar00rootroot00000000000000#!/bin/sh # # Copyright (C) 2005-2020 # pancake # # acr is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # acr is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with acr; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # #=========================================================================== # # ACR: AutoConf Replacement # # @license: GPLv2 # @author: pancake # @homepage: http://github.com/radare/acr # @version: @VERSION@ # # acr: # Main script that wraps the rest of acr scripts (mainly acr-sh) # DEBUG=0 EMBED=0 EXEC=0 NOPE=0 PBAR=0 STRIP=0 MAKEFILE=0 MAKEDIST=0 RECOVER=0 CONFIGURE="./configure" ACRFILE="configure.acr" TMP_FILE="" control_c() { echo echo "^C : interrupted execution." [ -n "${TMP_FILE}" ] && rm -f ${TMP_FILE} exit 1 } trap control_c 2 show_version() { echo "acr: version @VERSION@" exit 0 } show_usage() { cat<&2 PBAR=1 MAKEDIST=1 NOPE=1 ;; "-e"|"--embed") EMBED=1 ;; "-s"|"--strip") STRIP=1 ;; "-v"|"-V"|"--version") show_version ;; "-d"|"--debug") DEBUG=1 ;; "-m"|"--makefile") MAKEFILE=1 ;; "-h"|"--help") show_usage 0 ;; "-r"|"--recover"|"--recovery") ACRFILE=${CONFIGURE} RECOVER=1 ;; "-p"|"--progress-bar") PBAR=1 ;; "-n"|"--do-nothing") NOPE=1 ;; "-o"|"--output") CONFIGURE=$2 shift ;; "--") ;; *) ACRFILE="$1" ;; esac shift done #if [ "`echo ${ACRFILE}|cut -c 1`" = "-" ]; then # echo "error: unknown flag '${ACRFILE}'." >&2 # exit 1 #fi if [ "${RECOVER}" = 1 ]; then exec acr-cat ${ACRFILE} # TODO manage output exit 1 fi if [ ! -f "${ACRFILE}" ]; then echo "error: file ${ACRFILE} not found" >&2 exit 1 fi if [ -n "${WORD}" ]; then N=0 WORDS=`cat ${ACRFILE}` NW=`echo $WORDS | wc -w ` test $WORD -gt $NW &&\ echo "Word number out of range (limit $NW)." &&\ exit 1 for A in ${WORDS} ; do N=`expr $N + 1` if [ $N = $WORD ]; then printf -- "\e[35m$A\e[0m " else printf -- "$A " fi done echo exit 1 fi if [ "${EXEC}" = 1 ]; then shift TMP_FILE=`mktemp -t acr.XXXXXX` chmod 700 ${TMP_FILE} acr-sh "${ACRFILE}" "${CONFIGURE}" > ${TMP_FILE} sh ${TMP_FILE} $@ rm ${TMP_FILE} else if [ "${MAKEFILE}" = 1 ]; then env MAKEDIST=${MAKEDIST} STRIP=${STRIP} MAKEFILE=1 PBAR=${PBAR} NOPE=${NOPE} \ acr-sh "${ACRFILE}" "${CONFIGURE}" > /dev/null RET=$? elif [ "${NOPE}" = 1 ]; then env MAKEDIST=${MAKEDIST} STRIP=${STRIP} NOPE=1 PBAR=${PBAR} DEBUG=${DEBUG} \ acr-sh "${ACRFILE}" "${CONFIGURE}" > /dev/null RET=$? else TMP_FILE=`mktemp -t acr.XXXXXX` env NOPE=0 DEBUG=${DEBUG} STRIP=${STRIP} PBAR=${PBAR} \ acr-sh "${ACRFILE}" "${CONFIGURE}" > ${TMP_FILE} RET=$? if [ "$?" = 0 ]; then mv ${TMP_FILE} "${CONFIGURE}" chmod +x "${CONFIGURE}" [ "${EMBED}" = 1 ] && \ cat ${ACRFILE} | awk '{print "#ACR# " $0}' >> "${CONFIGURE}" else rm -f ${TMP_FILE} fi fi if [ "${RET}" = 0 ]; then [ "${NOPE}" = 0 ] && echo "acr: all done." exit 0 else echo "acr: error handled by acr." exit 1 fi fi acr-2.2.0/src/acr-cat000077500000000000000000000071541475143313200143210ustar00rootroot00000000000000#!/bin/sh # # acr is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # acr is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with acr; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # #=========================================================================== # # ACR: AutoConf Replacement # # @license: GPLv2 # @author: pancake # @homepage: http://www.nopcode.org/?t=acr # @version: @VERSION@ # # acr-cat: # Recovery utility that allows the user to recover the original configure.acr # file from a generated acr-configure script. # S="\$" CONFIGURE="" get_value_of() { VAR=$1 echo `./${CONFIGURE} --report | awk -F : '/'${VAR}':/{print $2}'` } get_library_name() { VAR=$1 echo ${VAR} | awk '{print (substr($1,4)); }' } if [ -z "$1" ]; then echo "usage $0 [configure-script]" exit 1 fi if [ ! -f "$1" ]; then echo "error: target file '$1' does not exist." >&2 exit 1 fi if [ ! -x "$1" ]; then echo "error: target file '$1' is not executable." >&2 exit 1 fi VERSION="`./${1} --version 2>/dev/null`" if [ -z "`echo ${VERSION} | grep ACR`" ]; then echo "error: this is not an acr generated configure script." >&2 exit 1 fi CONFIGURE="$1" ## TODO: if configure does not starts with / or ., add ./ at beginning # XXX: this grep is done twice, wtf EMBED="`grep '#ACR#' ${CONFIGURE}`" if [ -n "${EMBED}" ]; then grep '#ACR#' ${CONFIGURE} | cut -c 7- exit 0 fi REPORT=`./${CONFIGURE} --report | awk -F : '{print $1}' 2>/dev/null` if [ ! "$?" = "0" ]; then echo "error: configure script returns invalid value $?." exit 1 fi for A in ${REPORT}; do case ${A} in "PKGNAME") echo PKGNAME `get_value_of PKGNAME` ;; "VERSION") echo VERSION `get_value_of VERSION` ;; "LANGS") LANGS=`get_value_of LANGS` for B in ${LANGS}; do case ${B} in "c") echo LANG_C ;; "c++") echo LANG_CXX ;; "java") echo LANG_JAVA esac done ;; "REQUIRED") REQ=`get_value_of REQUIRED` for B in ${REQ}; do case ${B} in lib*) echo CHKLIB! `get_library_name "${B}"` ;; esac done ;; "OPTIONAL") REQ=`get_value_of OPTIONAL` for B in ${REQ}; do case ${B} in lib*) echo CHKLIB `get_library_name "${B}"` ;; esac done ;; esac done CONTACT="`./${CONFIGURE} --help | grep 'Report bugs to:'|cut -c 16-`" if [ -n "${CONTACT}" ]; then NAME="`echo ${CONTACT} | awk '{print $1}'`" MAIL="`echo ${CONTACT} | awk '{print substr($2,2,length($2)-2);}'`" echo "CONTACT ${NAME} ; ${MAIL}" fi ENDIAN=`grep BYTEORDER=1234 ${CONFIGURE}` if [ -n "${ENDIAN}" ]; then echo "CHECK_ENDIAN" fi SD="" SUBDIRS=`grep 'do # SUBDIRS' ${CONFIGURE} | cut -c 9-` if [ -n "${SUBDIRS}" ]; then for A in $SUBDIRS ; do if [ "${A}" = ";" ]; then break; fi SD="${SD} ${A}" done echo "SUBDIRS $SD ;" fi SD="" SUBDIRS=`grep 'do # SUBST_FILES' ${CONFIGURE} | cut -c 9-` if [ -n "${SUBDIRS}" ]; then for A in $SUBDIRS ; do [ "${A}" = ";" ] && break SD="${SD} ${A}" done echo "SUBST_FILES $SD ;" fi SD="" SUBDIRS=`grep 'do # REPORT' ${CONFIGURE} | cut -c 9-` if [ -n "${SUBDIRS}" ]; then for A in $SUBDIRS ; do [ "${A}" = ";" ] && break SD="${SD} ${A}" done echo "REPORT $SD ;" fi acr-2.2.0/src/acr-install000077500000000000000000000034521475143313200152150ustar00rootroot00000000000000#!/bin/sh # # if -d is set force +x ? or just warn when no X ? # # usage: # $ acr-install [options] source1 source2 ... destdir/file # $ acr-install -d dir1 dir2 dir3 # $ acr-install -P PLIST -D /usr/local -x dir/* bin/ # # acr-install -program : -c -s -o root -g root -m 555 # acr-install -library : -c -o root -g root -m 555 # acr-install -data : -o root -g root -m 755 # # -c : ignored # -d DIR : create directories # -g GROUP : change the group # -m MODE : # -o OWNER : # -R : recursive # -b : backup existing files before overwriting # -D DESTDIR : destdir # -p : preserve timestamps # -s : strip symbol tables # -S SUFFIX : override the default backup suffix # -P PLIST : append files copied to this file # -x : only copy executables # TODO: multiple sources flags="" noflags="" plist_file="" CMD="" show_help() { cat <> $plist_file fi acr-2.2.0/src/acr-sh000077500000000000000000002612031475143313200141610ustar00rootroot00000000000000#!/bin/sh # # Copyright (C) 2005-2024 # pancake # # acr is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # acr is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with acr; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # #=========================================================================== # # ACR: Auto Conf Replacement # # @license: GPLv2 # @author: pancake # @homepage: http://github.com/radare/acr # @version: @VERSION@ # # acr-sh: # acr configure script generator. # #== How to find things in this large file == # # Just search for the required string: # # ##INIT## : All variable initilializations # ##KEYWORDS## : switch/case with all keywords supported in configure.acr # ##FI## : Large enumeration of fi's :) # ##FUNCS## : helpkit functions # ##LANGS## : LANG_XXX keywords # ##ENV_LANG## : env_XXX for languages # #============================================================================= # ACR_VERSION=@VERSION@ CONFIGURE="$2" : {CONFIGURE:=./configure} : {STRIP:=0} if [ -z "$1" ]; then if [ -f "configure.acr" ]; then ACRFILE=configure.acr else echo "No 'configure.acr' found in current directory." >&2 echo "Give me the file name as argument." >&2 exit 1 fi else ACRFILE="$1" fi ##AWK## AWK=awk AWK_STRING="`awk 2>/dev/null`" if [ -z "${AWK_STRING}" ]; then Q=`${AWK} 2>&1` if [ 1 = "$(echo ${Q} | wc -l | awk '{print $1}')" ]; then AWK_STRING=awk else AWK_STRING="`awk -W version 2>&1`" fi fi [ `expr "$AWK_STRING" : "mawk"` -gt 0 ] && AWK="awk -W interactive" ## ## boolean() { ## case "$1" in ## ""|0) echo false ; ;; ## *) echo true ; ;; ## } ## ## {{{ Variable initialization ##INIT## SET_VAR="" TMP_VAR="" STR2="" STRING="" H_FILES="" SH_FILES="" MODE="" SCRIPT="" # The user code script buffer # Utilities S="$" # hacky stuff C="\`" # Language initialization LANG=0 # No langs yet defined LANG_V="" LANG_V_REQUIRED="" LANG_V_ENV="" LANG_C="" LANG_C_REQUIRED="" LANG_C_ENV="" LANG_CPP_ENV="" LANC_CXX="" LANG_CXX_REQUIRED="" LANG_CXX_ENV="" LANG_VALA="" LANG_VALA_REQUIRED="" LANG_VALA_ENV="" LANG_TCL="" LANG_TCL_REQUIRED="" LANG_TCL_ENV="" LANG_PERL="" LANG_PERL_REQUIRED="" LANG_PERL_ENV="" LANG_JAVA="" LANG_JAVA_REQUIRED="" LANG_JAVA_ENV="" LANG_PYTHON="" LANG_PYTHON_REQUIRED="" LANG_PYTHON_ENV="" LANG_RUBY="" LANG_RUBY_REQUIRED="" LANG_RUBY_ENV="" LANG_LUA="" LANG_LUA_REQUIRED="" LANG_LUA_ENV="" # Defaults PKGNAME="example" VERSION="0.1.0" _CONTACT=0 CONTACT_MAIL="" CONTACT_NAME="" DESCRIPTION="" PCGEN="" _AUTHOR=0 AUTHOR_MAIL="" AUTHOR_NAME="" # Report REPORT_REQUIRED="" REPORT_PKGCFG="" REPORT_OPTIONAL="" REPORT_FLAGS="" REPORT_LANGS="" REPORT_TOOLS="" # Environment ENVWORDS="MANDIR DESCRIPTION INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR ETCDIR SYSCONFDIR DATADIR DOCDIR" ENVWORDS="${ENVWORDS} LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX" ENVWORDS="${ENVWORDS} TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM" ENVWORDS="${ENVWORDS} INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA" ENVWORDS="${ENVWORDS} HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU" ENVWORDS="${ENVWORDS} VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_NUMBER" ENVWORDS="${ENVWORDS} PKGCFG_LIBDIR PKGCFG_INCDIR" ENVHELP="" # Checks CHKUSR_NAME="" CHKUSR_TARGET="" # ALL INTERNAL FLAGS # HAVE_LIBS=0 REPORT="" _REQUIRED=0 _USE_PKGCONFIG=0 _USE_LIBTOOL=0 _USE_LIBTOOL_REQUIRED=0 _USE_PTHREAD=0 _PC_CFLAGS="" _PC_LDFLAGS="" #-- ? --# USE_BACKUP=0 # XXX #_REPORT_DEFINED=0 _REQUIRE_ACR_VERSION=0 NKEYS=0 _EXEC=0 _EXEC_VAR="" _NOT=0 _USE_DL_USED=0 _CHKVER=0 _SIZEOF=0 _DIE_VAR="" _DIE_BOOL=0 _IF=0 _IF_VAR="" _IF_VAR2="" _IF_OP="" _IF_BOOL=0 _IF_SETVAR="" _IF_VALUE="" _IF_SETVALUE="" _IF_VALUE_EOF=0 _IFAND=0 _IFEQ=0 _IFEQVAL=0 #_REPORT=0 _CHK_PM=0 _CHK_RU=0 _CHK_PM_NAME="" #_CHKLIB=0 _CHKLIB_NAME="" _CHKFUNC=0 _CHKFUNC_NAME="" _CHKFUNC_LIB="" _CHKDECL=0 _CHKDECL_NAME="" _CHKDECL_INC="" _CHKPRG_VAR="" _CHKPRG_NAME="" CHECK_VAR="" CHECK_EOF="" CHECK_STR="" ARGUMENT="" # ARGUMENTS # ARG_VALUE="" ARG_NAME="" ARG_FLAG="" ARG_DESC="" FLAGHELP="" FLAGSCRIPT="" _EQUAL_3=0 EQUAL="" EQUALSCR="" _PKGNAME="" PACKAGE_BUGREPORT="" S_FILES="" # subst files S_MKDIR="" # subst directories to be created SD_FILES="" INIVARS="" SUBDIRS=0 SUBCONF=0 SUBCONF_DIRS="" ## }}} ## {{{ print_header print_header() { cat <<_EOF_ #!/bin/sh # This script was automatically generated by ACR v${ACR_VERSION} # @author: pancake # @url: http://www.nopcode.org # @repo: git clone https://github.com/radare/acr [ -z "${S}{AWK}" ] && AWK=awk do_remove() { if [ "${S}{ACR_RMFILES}" ]; then printf "cleaning temporally files... " rm -f ${S}{ACR_RMFILES} echo "done" fi } control_c() { printf "\\n\\n^C control-c : script execution interrupted.\\n" do_remove exit 1 } trap control_c 2 _EOF_ } ## }}} ## {{{ Help Functions ##FUNCS## add_envword() { for A in ${ENVWORDS}; do if [ "${A}" = "$1" ]; then if [ "${EQUAL}" = 1 ]; then # IFOP='=' echo "`word` < Warning: duplicated export variable '$1'." >&2 fi return; fi done [ "${DEBUG}" = 1 ] && echo " | env $1" >&2 ENVWORDS="${ENVWORDS} $1" } add_lang_envwords() { for A in `eval echo ${S}LANG_$1_ENV`; do add_envword ${A} done } word() { printf "%04d" $WORDS_N } append() { SCRIPT="`cat <&2 ; exit 1 ; ;; esac } concat() { OLD="$1" NEW="$2" [ "${NEW}" = "\;" ] && NEW=";" if [ -z "${OLD}" ]; then printf -- "${NEW}" else printf -- "${OLD} ${NEW}" fi } semver() { N=`echo "$1" | awk -F. '{print $'$2'}'` echo $(( $N )) } check_ifop() { IFOP=$1 case "${IFOP}" in "="|"+="|"?=") ;; "<-") echo "`word` | The '<-' keyword is deprecated. Use $VAR instead" >&2 ;; *) echo "`word` | Invalid operator '${IFOP}' in assignment." >&2 exit 1 ;; esac } ## }}} ## {{{ Check program path check_prg() { _CHKPRG_VAR=$1 _CHKPRG_NAME=$2 _CHKPRG_REQUIRED=$3 add_envword HAVE_${_CHKPRG_VAR} add_envword ${_CHKPRG_VAR} # XXX: -x check is also valid for directories SCRIPT=`cat <&2 else echo no fi EOF ` if [ "${_CHKPRG_REQUIRED}" = 1 ]; then SCRIPT=`cat <&2 exit 1 EOF ` fi SCRIPT="${SCRIPT} ; fi" _CHKPRG_NAME="" } ## }}} ## {{{ Vala lang_vala() { LANG=1 LANG_VALA=1 LANG_VALA_ENV="VALA VAVAC HAVE_LANG_VALA" SCRIPT=`cat <<_EOF_ ${SCRIPT} printf "checking vala compiler... " HAVE_LANG_VALA=1 HAVE_VALA=1 HAVE_VALAC=1 VALA_VERSION="" echo "void main(){}" > .test.vala ${S}{VALAC} .test.vala 2>&1 >/dev/null if [ ${S}? = 0 ]; then echo ${S}{VALAC}; VALA_VERSION=${S}(${S}{VALAC} --version | cut -d " " -f 2 | cut -d . -f 1,2); printf "checking vala... "; ${S}{VALA} .test.vala 2>&1 >/dev/null if [ ${S}? = 0 ]; then echo ${S}{VALA}; else echo no ; HAVE_LANG_VALA=0 ; HAVE_VALA=0 fi else echo no ; HAVE_LANG_VALA=0 ; HAVE_VALAC=0 fi _EOF_ ` if [ "${LANG_VALA_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} if [ \"${S}{HAVE_LANG_VALA}\" = 0 ]; then echo \"ERROR: ${S}{VALAC} cannot create C code\"; exit 1 fi " fi SCRIPT="${SCRIPT} rm -f .test.vala" } env_vala() { [ -n "${LANG_JAVA_ENV}" ] && return ACR_RMFILES="${ACR_RMFILES} .test.vala .test" add_lang_envwords "VALA" REPORT_LANGS="${REPORT_LANGS} vala" ENVHELP=`cat < test.java if [ "${S}{JAVAC}" = "javac" ]; then if [ "${S}{JAVA_HOME}" ]; then JAVAC="${S}{JAVA_HOME}/bin/javac" fi;fi ${S}{JAVAC} test.java 2>&1 >/dev/null if [ ${S}? = 0 ]; then echo ${S}{JAVAC}; else echo no ; HAVE_LANG_JAVA=0 _EOF_ ` if [ "${LANG_JAVA_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} echo \"ERROR: ${S}{JAVAC} cannot create bytecode\"; exit 1" fi SCRIPT="${SCRIPT} ; fi" } env_java() { [ -n "${LANG_JAVA_ENV}" ] && return LANG=1 LANG_JAVA=1 LANG_JAVA_ENV="JAVA JAVAC HAVE_LANG_JAVA JAVA_HOME" ACR_RMFILES="${ACR_RMFILES} test.java test.class" add_lang_envwords "JAVA" REPORT_LANGS="${REPORT_LANGS} java" ENVHELP=`cat <&2 exit 1 fi JCFLAGS="-I${S}{JAVA_HOME}/include -I${S}{JAVA_HOME}/include/linux" echo "#include " > test.c eval \\\\${S}${S}{COMPILER} test.c ${S}{JCFLAGS} -c >/dev/null 2>&1 if [ \"${S}?\" = 0 ]; then echo ok else echo no fi EOF ` } ## }}} ## {{{ Flag parsing (--enable-xxx) add_flag() { # $1 = type (with,without,enable,disable) # $2 = affected variable # $3 = flag name (-static) # $4 = default value # $5 = description # $6 = argument name? ## XXX NOT USED XXX REPORT_FLAGS="${REPORT_FLAGS} --${1}-${3}" add_envword ${2} _TMP_="" TABS="`echo \"--${1}-${3}\" | ${AWK} '{ len=22-length($1); if (len<1) { print ""; len=25 } ; for (i=0;i&1 >/dev/null if [ ${S}? = 0 ]; then echo yes ; SH=\`sh -c "command -v bash 2>/dev/null"\` else echo no ; fi _EOF_ ` add_envword "SH" ENVHELP=`cat </dev/null\\\` if [ "${S}{RUBY}" ]; then RUBY=\\\`echo ${S}{RUBY} | cut -d\ -f 1\\\` RUBY_VERSION=\\\`echo ${S}{RUBY} ${S}{A} | ${AWK} '{ print substr(${S}1,length(${S}2)+6) }'\\\` echo ${S}{RUBY} ; HAVE_LANG_RUBY=1 ; break fi done if [ -z "${S}{RUBY}" ]; then echo no _EOF_ ` if [ "${LANG_RUBY_REQUIRED}" ]; then SCRIPT=`cat <<_EOF_ ${SCRIPT} echo "ERROR: No ruby binaries found in PATH" >&2 exit 1 _EOF ` fi SCRIPT="${SCRIPT} ; fi" } ## }}} ## {{{ | Ruby Modules check_ru() { HAVE_LIBS=1 VAR=`echo "HAVE_RU_$1" | \ sed -e 's, ,,g' | \ sed -e 's,/,_,g' | \ ${AWK} '{ print toupper($0); }'` add_envword "${VAR}" SCRIPT=`cat < /dev/null\\\` fi if [ 0 = ${S}? ]; then ${VAR}=1 ; echo ok else ${VAR}=0 ; echo no EOF ` if [ "${_REQUIRED}" = 1 ]; then SCRIPT=`cat </dev/null\\\` if [ "${S}{PYTHON}" ]; then PYTHON=\\\`echo ${S}{PYTHON} | ${AWK} '{print ${S}1; }'\\\` echo ${S}{PYTHON} ; HAVE_LANG_PYTHON=1 ; break ; fi done if [ -z "${S}{PYTHON}" ]; then echo no _EOF_ ` if [ "${LANG_PYTHON_REQUIRED}" ]; then SCRIPT=`cat <<_EOF_ ${SCRIPT} echo "ERROR: No python binaries found in PATH" >&2 exit 1 _EOF_ ` fi SCRIPT="${SCRIPT} ; fi" } env_python() { [ -n "${LANG_PYTHON_ENV}" ] && return LANG=1 LANG_PYTHON=1 LANG_PYTHON_ENV="PYTHON HAVE_LANG_PYTHON" add_lang_envwords "PYTHON" REPORT_LANGS="${REPORT_LANGS} python" lang_python } ## }}} ## {{{ - modules check_py() { HAVE_LIBS=1 VAR=`var_filter "HAVE_PY_$1"` add_envword "${VAR}" SCRIPT=`cat <&1 >/dev/null\\\` 2>/dev/null fi if [ ${S}? = 0 ]; then ${VAR}=1 echo ok else ${VAR}=0 echo no EOF ` if [ "${_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} echo \"This python module is required.\" exit 1" fi SCRIPT="${SCRIPT} ; fi" } ## }}} ## {{{ Lua lang_lua() { SCRIPT="${SCRIPT} ochof \"checking for lua... \" HAVE_LANG_LUA=0 ${S}{LUA} -v > /dev/null 2>&1 if [ ${S}? = 0 ]; then echo ok ; HAVE_LANG_LUA=1 ; ocho \"checking for lua libs... \"" if [ "${LANG_C}" = 1 ]; then check_lib lua check_lib lua5.1 SCRIPT="${SCRIPT} if [ \"${S}{HAVE_LIB_LUA}\" = 1 ]; then LUA_LIBS=-llua fi if [ \"${S}{HAVE_LIB_LUA5_1}\" = 1 ]; then LUA_LIBS=-llua5.1 fi " fi SCRIPT="${SCRIPT} else echo no" if [ "${LANG_LUA_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} echo \"${LINENO}: You need lua.\" >&2 exit 1" ; fi SCRIPT="${SCRIPT} ; fi" } env_lua() { [ -n "${LANG_LUA_ENV}" ] && return LANG=1 LANG_LUA=1 LANG_LUA_ENV="LUA HAVE_LANG_LUA LUA_LIBS" add_lang_envwords "LUA" REPORT_LANGS="${REPORT_LANGS} lua" ENVHELP="${ENVHELP} LUA path to lua interpreter" lang_lua } ## }}} ## {{{ Perl env_perl_threads() { add_envword "HAVE_LANG_PERL_THREADS" if [ -z "${LANG_PERL}" ]; then echo "`word` You must set LANG_PERL before calling USE_PERL_THREADS" >&2 exit 1 fi SCRIPT="${SCRIPT} ochof \"checking for perl threads... \" HAVE_LANG_PERL_THREADS=1 ${S}{PERL} -e 'use threads;' 2>&1 > /dev/null if [ ${S}? = 0 ]; then echo ok; else echo no ; HAVE_LANG_PERL_THREADS=0 " if [ "${_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} echo \"ERROR: You need perl with threads.\" >&2 ; exit 1; fi" else SCRIPT="${SCRIPT} fi" fi } lang_perl() { SCRIPT="${SCRIPT} ochof \"checking for perl... \" HAVE_LANG_PERL=0 ${S}{PERL} -e '' 2>&1 > /dev/null if [ ${S}? = 0 ]; then ocho ok ; HAVE_LANG_PERL=1 ; else ocho no " if [ "${_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} echo \"${LINENO}: You need perl installed on your system.\" >&2 exit 1" fi SCRIPT="${SCRIPT} ; fi" } env_perl() { [ -n "${LANG_PERL_ENV}" ] && return LANG=1 LANG_PERL=1 LANG_PERL_ENV="PERL HAVE_LANG_PERL" ACR_RMFILES="${ACR_RMFILES} test.pl" add_lang_envwords "PERL" REPORT_LANGS="${REPORT_LANGS} perl" lang_perl } ## }}} ## {{{ + modules check_pm() { HAVE_LIBS=1 VAR=`var_filter "HAVE_PM_$1"` add_envword "${VAR}" SCRIPT="${SCRIPT} ochof \"checking for '${1}' perl module ... \" perl -m${1} -e '' 2>/dev/null if [ ${S}? = 0 ]; then ${VAR}=1 ocho ok else ${VAR}=0 ocho no " if [ "${_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} echo 'This perl module is required.' exit 1 " fi SCRIPT="${SCRIPT} fi" } ## }}} ## {{{ V lang_v() { SCRIPT=`cat <<_EOF_ ${SCRIPT} ochof "checking for V compiler... " HAVE_LANG_V=1 if [ "${S}{CROSSBUILD}" = 1 ]; then (command -v ${S}{HOST}-${S}{V} >/dev/null 2>&1) if [ ${S}? = 0 ]; then V="${S}{HOST}-${S}{V}"; fi fi echo "fn main() {}" > .test.v (exec ${S}{V} ${S}{VFLAGS} .test.v >/dev/null 2>&1) if [ ${S}? = 0 ]; then echo ${S}{V}; else echo no ; HAVE_LANG_V=0 _EOF_ ` if [ "${LANG_V_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} do_remove echo \"ERROR: ${S}{V} cannot create executables\" >&2 ; exit 1" fi SCRIPT="${SCRIPT} ; fi" } env_v() { [ -n "${LANG_V_ENV}" ] && return LANG=1 LANG_V=1 LANG_V_ENV="VFLAGS HAVE_LANG_V" ACR_RMFILES="${ACR_RMFILES} .test.v .test" REPORT_LANGS="${REPORT_LANGS} v" add_lang_envwords "V" ENVHELP="${ENVHELP} V V compiler command VFLAGS V compiler flags" lang_v } ## }}} ## {{{ C lang_c() { SCRIPT=`cat <<_EOF_ ${SCRIPT} ochof "checking for c compiler... " HAVE_LANG_C=1 if [ "${S}{CROSSBUILD}" = 1 ]; then (command -v ${S}{HOST}-${S}{CC} >/dev/null 2>&1) if [ ${S}? = 0 ]; then CC="${S}{HOST}-${S}{CC}"; fi fi echo "int main(int argc, char **argv){return 0;}" > test.c (exec ${S}{CC} -o a.out ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{LDFLAGS} test.c >/dev/null 2>&1) if [ ${S}? = 0 ]; then echo ${S}{CC}; else echo no ; HAVE_LANG_C=0 _EOF_ ` if [ "${LANG_C_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} do_remove echo \"ERROR: ${S}{CC} cannot create executables\" >&2 ; exit 1" fi SCRIPT="${SCRIPT} ; fi" lang_cpp } env_cpp() { CURRENT_LANG="c" SCRIPT="${SCRIPT} COMPILER=CC" [ -n "${LANG_CPP_ENV}" ] && return LANG_CPP_ENV="CPPFLAGS CPP" ENVHELP="${ENVHELP} CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor" } env_c() { [ -n "${LANG_C_ENV}" ] && return LANG=1 LANG_C=1 LANG_C_ENV="CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C" ACR_RMFILES="${ACR_RMFILES} test.c a.out a.exe" REPORT_LANGS="${REPORT_LANGS} c" add_lang_envwords "C" ENVHELP="${ENVHELP} CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory " env_cpp lang_c } lang_cpp() { LANG=1 if [ "${LANG_CPP_ENV}" ]; then return ; fi add_envword "CPP" SCRIPT="`cat</dev/null 2>&1) [ ${S}? = 0 ] && CPP=\"${S}{HOST}-${S}{CPP}\" fi (echo \"int main(int ac, char **av){return 0;}\" | ${S}{CPP} ${CPPFLAGS} >/dev/null 2>&1) if [ \$? = 0 ]; then echo ${S}{CPP}; else echo \"ERROR: ${S}{CPP} cannot parse sources\"; fi EOF `" } ## }}} ## {{{ C++ lang_cxx() { add_envword "CXX" SCRIPT="${SCRIPT} HAVE_LANG_CXX=1 ochof \"checking for c++ compiler... \" if [ \"${S}{CROSSBUILD}\" = 1 ]; then (command -v ${S}{HOST}-${S}{CXX} 2>&1 >/dev/null) if [ \"${S}?\" = 0 ]; then CXX=\"${S}{HOST}-${S}{CXX}\"; fi fi echo \"#include \" > test.cxx echo \"int main(){ std::cout << 1; return 0;}\" >> test.cxx (exec ${S}{CXX} ${S}{CXXFLAGS} ${S}{LDFLAGS} test.cxx -lstdc++ >/dev/null 2>&1) if [ \$? = 0 ]; then echo ${S}{CXX}; else HAVE_LANG_CXX=0 echo no " if [ "${LANG_CXX_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} echo \"ERROR: ${S}{CXX} cannot create executables\" >&2 ; do_remove exit 1 " fi SCRIPT="${SCRIPT} fi" lang_cpp } env_cxx() { CURRENT_LANG="c++" CURRENT_LANG="c" SCRIPT="${SCRIPT} COMPILER=CXX" LANG=1 [ "${LANG_CXX_ENV}" ] && return LANG_CXX=1 REPORT_LANGS="${REPORT_LANGS} c++" ACR_RMFILES="${ACR_RMFILES} test.c test.cxx a.out a.exe" LANG_CXX_ENV="CXX CXXFLAGS LDFLAGS HAVE_LANG_CXX" add_lang_envwords "CXX" ENVHELP=`cat < test.c " for A in `echo ${S}{INC} | sed -e 's,+, ,g'`; do SCRIPT="${SCRIPT} echo \"#include <${A}>\" >>test.c" done SCRIPT="${SCRIPT} echo 'int main(int ac, char **av){return 0;}' >>test.c eval \\\\${S}${S}{COMPILER} ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{CXXFLAGS} test.c >/dev/null 2>&1 if [ ${S}? = 0 ]; then eval ${S}{VAR}=1 echo yes else eval ${S}{VAR}=0 echo no if [ 1 = \"${_REQUIRED}\" ]; then echo 'ERROR: required include not found.' >&2 do_remove exit 1 fi fi } " _CHECK_INC=included fi SCRIPT="${SCRIPT} check_include ${VAR} ${INC} ${_REQUIRED} " } ## }}} ## {{{ | Endian check_endian() { add_envword "LIL_ENDIAN" add_envword "BIG_ENDIAN" add_envword "BYTEORDER" SCRIPT="${SCRIPT} printf \"checking host endianness... \" LIL_ENDIAN=${S}(printf I|od|${S}{AWK}'{print substr(${S}2,6,1);exit}') if [ $? != 0 -o \"${S}{LIL_ENDIAN}\" = 1 ]; then BYTEORDER=1234 BIG_ENDIAN=0 echo little else BYTEORDER=4321 BIG_ENDIAN=1 LIL_ENDIAN=0 echo big fi " } ## }}} ## {{{ | PkgConfig Generator PCGEN_INIT=0 check_pcgen() { if [ "${PCGEN_INIT}" = 0 ]; then PCGEN_INIT=1 SCRIPT="${SCRIPT} pcgen() { PCFILE=\"${S}{1}\" ; shift PCNAME=\"${S}{1}\" ; shift REQUIRES=\"${S}@\" echo \"generating ${S}{PCFILE}\" >&2 echo \"prefix=${S}{PREFIX}\" > ${S}{PCFILE} echo \"exec_prefix=\\${S}{prefix}\" >> ${S}{PCFILE} echo \"libdir=${S}{PKGCFG_LIBDIR}\" >> ${S}{PCFILE} echo \"includedir=${S}{PKGCFG_INCDIR}\" >> ${S}{PCFILE} echo \"\" >> ${S}{PCFILE} echo \"Name: ${S}{PCNAME}\" >> ${S}{PCFILE} if [ -n \"${S}{DESCRIPTION}\" ]; then echo \"Description: ${S}{DESCRIPTION}\" >> ${S}{PCFILE} fi echo \"Version: ${S}{VERSION}\" >> ${S}{PCFILE} echo \"Requires: ${S}{REQUIRES}\" >> ${S}{PCFILE} echo \"Cflags: -I\\${S}{includedir}/libr\" >> ${S}{PCFILE} echo \"Libs: -L\\${S}{libdir} -l${S}{PCNAME} ${S}{DL_LIBS}\" >> ${S}{PCFILE} } " fi SCRIPT="${SCRIPT} pcgen $@" } ## }}} ## {{{ | Check Libraries check_lib() { _CHKLIB_NAME=$1 HAVE_LIBS=1 VAR=`echo "HAVE_LIB_$1" | sed -e 's,-,_,g' -e 's,+,_AND_,g' -e 's,\.,_,g' | awk '{ print toupper($0); }'` add_envword "${VAR}" get_current_compiler if [ -z "${_CHECK_LIB}" ]; then SCRIPT="${SCRIPT} check_library() { VAR=${S}1 S=\"$\" _REQUIRED=${S}3 _CHKLIB_NAME=${S}2 _CHKLIB_LIBS=${S}(echo \"-l${S}{_CHKLIB_NAME}\" | sed 's,+, -l,g') ochof \"checking for lib${S}{_CHKLIB_NAME} ... \" echo \"int main(int ac, char **av){return 0;}\" > test.c eval ${S}{S}${S}{COMPILER} ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{CXXFLAGS} ${S}{LDFLAGS} ${S}{_CHKLIB_LIBS} test.c >/dev/null 2>&1 if [ ${S}? = 0 ]; then eval ${S}{VAR}=1 echo yes else eval ${S}{VAR}=0 echo no if [ \"${S}{_REQUIRED}\" = 1 ]; then echo \"this library is required.\" do_remove exit 1 fi fi } " fi if [ "${_REQUIRED}" = 1 ]; then REPORT_REQUIRED="${REPORT_REQUIRED} lib${_CHKLIB_NAME}" else REPORT_OPTIONAL="${REPORT_OPTIONAL} lib${_CHKLIB_NAME}" fi _CHECK_LIB=included SCRIPT="${SCRIPT} check_library ${VAR} ${_CHKLIB_NAME} ${_REQUIRED}" } ## }}} ## {{{ | Check Declarations check_decl() { HAVE_DECL=1 VAR=`var_filter "HAVE_DECL_$2"` add_envword "${VAR}" get_current_compiler SCRIPT=`cat <" > test.c echo "int main(int ac, char **av){ void *a = (void *)${_CHKDECL_NAME}; return 0; }" >> test.c ${S}{${COMPILER}} ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{LDFLAGS} test.c >/dev/null 2>&1 if [ ${S}? = 0 ]; then echo yes ; ${VAR}=1 else ${VAR}=0 ; echo no EOF ` if [ 1 = "${_REQUIRED}" ]; then SCRIPT=`cat <&2 do_remove exit 1 EOF ` fi SCRIPT="${SCRIPT} ; fi" } ## }}} ## {{{ | Check CFLAGS check_cflags() { HAVE_LIBS=1 VAR=${_CHKFLG_VAR} add_envword "${VAR}" get_current_compiler SCRIPT=`cat < .test.c ${S}{${COMPILER}} ${_CHKFLG_NAME} ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{LDFLAGS} $* .test.c >/dev/null 2>&1 if [ ${S}? = 0 ]; then echo yes ; ${VAR}=1 else ${VAR}=0 ; echo no EOF ` if [ 1 = "${_REQUIRED}" ]; then SCRIPT=`cat <&2 do_remove exit 1 EOF ` fi SCRIPT="${SCRIPT} ; fi" } ## }}} ## {{{ | Check Symbol check_sym() { HAVE_LIBS=1 VAR=`var_filter "HAVE_$1"` add_envword "${VAR}" get_current_compiler SCRIPT=`cat < test.c ${S}{${COMPILER}} ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{LDFLAGS} -l${_CHKSYM_LIB} test.c >/dev/null 2>&1 if [ ${S}? = 0 ]; then echo yes ; ${VAR}=1 else ${VAR}=0 ; echo no EOF ` if [ 1 = "${_REQUIRED}" ]; then SCRIPT=`cat <&2 do_remove exit 1 EOF ` fi SCRIPT="${SCRIPT} ; fi" } ## }}} ## {{{ | Check Functions check_func() { HAVE_LIBS=1 VAR=`var_filter "HAVE_$1"` add_envword "${VAR}" get_current_compiler SCRIPT=`cat < test.c ${S}{${COMPILER}} ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{LDFLAGS} -l${_CHKFUNC_LIB} test.c >/dev/null 2>&1 if [ ${S}? = 0 ]; then echo yes ; ${VAR}=1 else ${VAR}=0 ; echo no EOF ` if [ 1 = "${_REQUIRED}" ]; then SCRIPT=`cat <&2 do_remove exit 1 EOF ` fi SCRIPT="${SCRIPT} ; fi" } ## }}} ## {{{ | Check sizeof check_sizeof() { THAT=$1 VAR=`echo "SIZEOF_$1" | sed -e 's,\*,_P,g' | awk '{ gsub(" ","_"); gsub("\\\.","_"); gsub("/","_"); print toupper($0); }'` add_envword "${VAR}" ## the $(./a.out) XXX this could be not portable SCRIPT="${SCRIPT} printf 'checking size of $1... ' echo '#include ' > test.c echo 'int main(int ac, char **av){printf(\"##d##\",sizeof($1));return 0;}' >>test.c eval \\\\${S}${S}{COMPILER} ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{CXXFLAGS} -o a.out test.c >/dev/null 2>&1 if [ 0 = ${S}? ]; then ${VAR}=${S}(./a.out) echo ${S}{${VAR}} HAVE_${VAR}=1 else ${VAR}=0 ; echo error " if [ 1 = "${_REQUIRE}" ]; then SCRIPT="${SCRIPT} do_remove exit 1 " else SCRIPT="${SCRIPT} HAVE_${VAR}=0 " fi SCRIPT="${SCRIPT} fi " } ## }}} ## {{{ | Pthreads use_pthread() { HAVE_LIBS=1 add_envword "PTHREAD_LIBS" add_envword "HAVE_PTHREAD" SCRIPT="${SCRIPT} ochof \"checking for POSIX threads... \" if [ \"${S}{HOST_OS}\" = \"freebsd\" ]; then PTHREAD_LIBS=-pthread ; else PTHREAD_LIBS=-lpthread ; fi echo '#include ' > test.c echo 'main(){pthread_testcancel();}' >> test.c eval \\\\${S}${S}{COMPILER} ${S}{PTHREAD_LIBS} test.c 2>&1 >/dev/null if [ ! \$? = 0 ]; then HAVE_PTHREAD=0 ; echo no ; else HAVE_PTHREAD=1; echo yes ; fi " if [ "${_REQUIRED}" = 1 ]; then REPORT_REQUIRED="${REPORT_REQUIRED} libpthread" SCRIPT="${SCRIPT} if [ \"${S}{HAVE_PTHREAD}\" = 0 ]; then echo 'ERROR: You need the pthreads libraries.' do_remove exit 1 fi" else REPORT_OPTIONAL="${REPORT_OPTIONAL} libpthread" fi } ## }}} ## {{{ TCL lang_tcl() { LANG=1 SCRIPT=`cat <<_EOF_ ochof "checking for tcl... " HAVE_LANG_TCL=0 for A in ${S}{TCL_LIBDIR} ${S}{SEARCHPATH}; do if [ -f \"${S}{A}/lib/tclConfig.sh\" ]; then . ${S}{A}/lib/tclConfig.sh HAVE_TCL=1 TCL_CFLAGS="${S}{TCL_INCLUDE_SPEC}" TCL_LDFLAGS="${S}{TCL_LIB_SPEC}" echo "${S}{TCL_VERSION}" break fi done if [ "${S}{HAVE_LANG_TCL}" = 0 ]; then echo no _EOF_ ` [ "${LANG_TCL_REQUIRED}" = 1 ] && \ SCRIPT="${SCRIPT} echo \"ERROR: You need TCL.\" ; exit 1" SCRIPT="${SCRIPT} ; fi" } env_tcl() { LANG=1 LANG_TCL=1 add_envword "TCL_VERSION" add_envword "HAVE_LANG_TCL" add_envword "TCL_LIBS" add_envword "TCL_CFLAGS" add_envword "TCL_LDFLAGS" REPORT_LANGS="${REPORT_LANGS} tcl" add_flag with TCL_BASEDIR tcl-basedir "=" "Sets the TCL basedir to find [/usr]/lib/tclConfig.sh" lang_tcl } ## }}} ## {{{ PkgConfig use_pkgconfig() { _USE_PKGCONFIG=1 add_envword "PKGCONFIG" SCRIPT=`cat <&2 exit 1 EOF ` fi SCRIPT="${SCRIPT} ocho no; fi" } ## }}} ## {{{ Libtool use_libtool() { _USE_LIBTOOL=1 check_prg "LIBTOOL" "libtool" ${_REQUIRED} case "${CURRENT_LANG}" in "c") add_envword "LIBTOOL_CC" ; ;; "c++") add_envword "LIBTOOL_CXX" ; ;; *) echo "Libtool depends on c or c++" >&2 ; exit 1 ; ;; esac add_envword "LIBTOOL_SHARED" add_envword "LIBTOOL_STATIC" add_envword "LIBTOOL_INSTALL" } ## }}} ## {{{ TK use_tk() { echo "ochof \"checking for tk... \"" echo "HAVE_TK=0" echo "for A in ${S}{TK_BASEDIR} ${S}{SEARCHPATH}; do" echo "if [ -f \"${S}{A}/lib/tkConfig.sh\" ]; then" echo ". ${S}{A}/lib/tkConfig.sh" echo " HAVE_TK=1" echo " TK_LDFLAGS=\"${S}{TK_LIB_SPEC}\"" echo " echo \"${S}{TK_VERSION}\"" echo " break; fi" echo "done" echo "if [ \"${S}{HAVE_TK}\" = 0 ]; then echo no; fi" } ## }}} ## {{{ X11 use_x11() { add_envword "HAVE_X11" SCRIPT=`cat <<_EOF_ ${SCRIPT} ochof "checking for X11... " CFLAGS="${S}CFLAGS ${S}CPPFLAGS -I${S}{X11BASE}/include" LDFLAGS="${S}LDFLAGS -L${S}{X11BASE}/lib" [ "${X_INCLUDES}" ] && CFLAGS="${CFLAGS} -I${X_INCLUDES}" [ "${X_LIBRARIES}" ] && CFLAGS="${CFLAGS} -L${X_LIBRARIES}" if [ "${S}{HAVE_X11}" = 1 ]; then echo "#include " > test.c echo "main(){XrmInitialize();}" >> test.c ${S}{CC} ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{LDFLAGS} test.c -lX11 2> /dev/null if [ 0 = ${S}? ]; then echo ok ; HAVE_X11=1 else HAVE_X11=0 ; echo "not found" >&2 fi else HAVE_X11=0 ; echo "disabled" >&2 fi _EOF_ ` } ## }}} ## {{{ GNU make env_gmake() { add_envword "MAKE" add_envword "GMAKE" REPORT_TOOLS="${REPORT_TOOLS} gmake" } use_gmake() { add_envword "MAKE" SCRIPT=`cat <<_EOF_ ${SCRIPT} ochof "checking for GNU make... " GMAKE=0 for MAKE in make gmake ; do if [ -n "\\\`${S}{MAKE} -version 2>&1 | grep GNU\\\`" ]; then echo yes ; GMAKE=1 ; break fi done if [ "${S}GMAKE" = 0 ]; then echo no echo "ERROR: No GNU make found." >&2 exit 1 fi _EOF_ ` } ## }}} ## {{{ Generate Output file report_h() { echo "for A in ${H_FILES}; do" echo " ocho \"creating h ${S}{VPATH}/${S}{A}\"" echo " ocho '' > ${S}{VPATH}/${S}{A}" echo "if [ ! \$? = 0 ]; then echo Cannot write target file ; control_c ; fi" echo " for B in ${S}{ENVWORDS} ; do" echo " eval \"VAR=\\${S}${S}{B}\"" if [ "${_REPORT_DEFINED}" = 1 ]; then # echo "if [ ! \"\`echo ${S}{B} | grep -e HAVE -e VER -e PKG -e PACK\`\" = \"\" ]; then" echo " if [ \"${S}{VAR}\" = 0 ]; then" echo " echo \"/* #undef ${S}{B} */\" >> ${S}{VPATH}/${S}{A}" echo " else" echo " if [ -z \"${S}{VAR}\" ]; then" echo " echo \"/* #undef ${S}{B} */\" >> ${S}{VPATH}/${S}{A}" echo " else" echo " echo \"#define ${S}{B} ${S}{VAR}\" >> ${S}{VPATH}/${S}{A}" echo " fi" echo " fi" # echo "fi" else echo " echo \"#define ${S}{B} ${S}{VAR}\" >> ${S}{VPATH}/${S}{A}" fi echo " done" echo "done" echo "" } report_sh() { echo "for A in ${SH_FILES}; do # SH_FILES" echo " ocho \"creating sh ${S}{VPATH}/${S}{A}\"" echo " echo '# automatically generated by acr' > ${S}{VPATH}/${S}{A}" echo "if [ ! \$? = 0 ]; then echo Cannot write target file >&2 ; control_c ; fi" echo " for B in ${S}{ENVWORDS} ; do" echo " eval \"VAR=\\${S}${S}{B}\"" echo " echo ${S}{B}=${S}{VAR} >> ${S}{VPATH}/${S}{A}" echo " done" echo "done" echo "" } subst_tags() { # if (crosspathbuild) # \ # - create target directories (mkdir -p ${XX}) # - target directori is localdir not VPATH # mkdirs echo "if [ \"${S}{WODIS}\" = \"crosspath\" ]; then" if [ "${S_MKDIR}" ]; then echo " mkdir -p ${S_MKDIR}" fi echo " for A in ${S_FILES} ; do" echo " echo \"filtering ${S}{A}\"" echo " cat ${S}{VPATH}/${S}{A} | eval sed ${S}{SEDFLAGS} > ${S}{A}" echo "if [ ! \$? = 0 ]; then echo Cannot write target file ; control_c ; fi" echo " done" echo "else #--" # move files echo "for A in ${S_FILES} ; do # SUBST_FILES" echo " echo \"filtering ${S}{A}\"" echo " if [ -f \"${S}{VPATH}/${S}{A}.orig\" ]; then" if [ "${USE_BACKUP}" = 1 ]; then echo " if [ -f \"${S}{VPATH}/${S}{A}.backup\" ]; then" echo " if [ -f \"${S}{VPATH}/${S}{A}\" ]; then" echo " if [ \"\`diff ${S}{VPATH}/${S}{A}.backup ${S}{VPATH}/${S}{A}\`\" ]; then" echo " echo \"It seems that ${S}{VPATH}/${S}{A} has changed. Check .backup first.\"" echo " exit 1 ; fi ; fi ; fi" echo " rm ${S}{VPATH}/${S}{A}.backup" fi echo " mv -f ${S}{VPATH}/${S}{A}.orig ${S}{VPATH}/${S}{A}" echo " fi" echo " if [ -f \"${S}{VPATH}/${S}{A}\" ]; then" echo " mv -f ${S}{VPATH}/${S}{A} ${S}{VPATH}/${S}{A}.orig" echo " else" echo " if [ ! -f \"${S}{VPATH}${S}{A}.orig\" ]; then" echo " echo \"ERROR: Cannot find ${S}{VPATH}/${S}{A}.orig\" >&2" echo " exit 1" echo " fi" echo " fi" echo " cat ${S}{VPATH}/${S}{A}.orig | eval sed ${S}{SEDFLAGS} > ${S}{VPATH}/${S}{A}" echo "if [ ! \$? = 0 ]; then echo Cannot write target file ; control_c ; fi" if [ "${USE_BACKUP}" = 1 ]; then echo " cp ${S}{VPATH}/${S}{A} ${S}{VPATH}/${S}{A}.backup" echo "if [ ! \$? = 0 ]; then echo Cannot write target file ; control_c ; fi" fi echo "done" echo "fi" echo "" } # TODO: too many echo's! subst_dirs() { if [ "${SD_FILES}" = "%" ]; then echo "for A in \`find * | grep Makefile.acr | cut -d . -f 1\` ; do # SUBDIRS" else echo "for A in ${SD_FILES} ; do # SUBDIRS" fi cat <&2 exit 1 fi fi ocho "creating ${S}{SD_TARGET}" [ "${S}{VPATH}" != '.' ] && \ mkdir -p \$(echo ${S}{A} | sed -e "s,/\`basename ${S}{A}\`\$,,g") cat ${S}{VPATH}/${S}{SD_TARGET}.acr | \\ eval sed -e "s,@VPATH@,${S}{VPATH}/${S}{A},g" ${S}{SEDFLAGS} > ${S}{SD_TARGET}.tmp EOF # Support for ##MARKS## echo " for A in ${S}{ENVWORDS}; do VALUE=\`eval echo \"$\"${S}{A}\` if [ \"${S}VALUE\" = 0 ]; then ## FALSE MARK=\"##${S}{A}##\" if [ -n \"\`grep \\\"${S}{MARK}\\\" ${S}{SD_TARGET}.tmp\`\" ]; then mv ${S}{SD_TARGET}.tmp ${S}{SD_TARGET}.tmp2 cat ${S}{SD_TARGET}.tmp2 | MARK=${S}MARK ${S}AWK 'BEGIN{a=0;}{if(${S}1==ENVIRON[\"MARK\"]){if(a)a=0;else a=1}else{if(!a)print;}}' > ${S}{SD_TARGET}.tmp fi fi done mv ${S}{SD_TARGET}.tmp ${S}{SD_TARGET} && rm -f ${S}{SD_TARGET}.tmp2 if [ ! \$? = 0 ]; then echo Cannot write target file ; control_c ; fi done " } ## }}} ## {{{ Body generation create_body() { [ "${STRIP}" = 1 ] && return cat </dev/null && OS="wsl" GNU="\`uname --help 2>&1 | grep gnu\`" [ "${S}{GNU}" ] && OS="${S}{OS}-gnu" [ "${S}{CPU}" = ppc ] && CPU="powerpc" echo "${S}{CPU}-unknown-${S}{OS}" } SEARCHPATH="/usr /usr/local /usr/pkg /sw" : ${S}{PREFIX:=/usr/local} CROSSBUILD=0 BUILD=\`guess_os\` HOST="${S}{BUILD}" TARGET="${S}{HOST}" ETCDIR="/etc" SYSCONFDIR="" DESCRIPTION="${DESCRIPTION}" create_environ() { : ${S}{EPREFIX:="${S}{PREFIX}"} : ${S}{SPREFIX:="${S}{PREFIX}"} : ${S}{BINDIR:="${S}{SPREFIX}/bin"} : ${S}{SBINDIR:="${S}{PREFIX}/sbin"} : ${S}{ETCDIR:="${S}{SPREFIX}/etc"} : ${S}{LIBDIR:="${S}{SPREFIX}/lib"} : ${S}{PKGCFG_LIBDIR:='${S}{exec_prefix}/lib'} : ${S}{PKGCFG_INCDIR:='${S}{prefix}/include'} : ${S}{LIBEXECDIR:="${S}{SPREFIX}/libexec"} : ${S}{INCLUDEDIR:="${S}{SPREFIX}/include"} : ${S}{DATADIR:="${S}{SPREFIX}/share"} : ${S}{INFODIR:="${S}{DATADIR}/info"} : ${S}{MANDIR:="${S}{DATADIR}/man"} : ${S}{DOCDIR:="${S}{DATADIR}/doc/${PKGNAME}"} : ${S}{LOCALSTATEDIR:="${S}{SPREFIX}/var"} for A in \`echo ${S}{PATH} | sed -e 's,:, ,g'\` ; do [ -e "${S}A"/ginstall ] && : ${S}{INSTALL:="${S}A"/ginstall} && break [ -e "${S}A"/install ] && : ${S}{INSTALL:="${S}A"/install} && break done : ${S}{INSTALL_DIR:=${S}{INSTALL} -d} : ${S}{INSTALL_DATA:=${S}{INSTALL} -m 644} : ${S}{INSTALL_SCRIPT:=${S}{INSTALL} -m 755} : ${S}{INSTALL_PROGRAM:=${S}{INSTALL} -m 755} : ${S}{INSTALL_PROGRAM_STRIP:=${S}{INSTALL} -m 755 -s} : ${S}{INSTALL_MAN:=${S}{INSTALL} -m 444} : ${S}{INSTALL_LIB:=${S}{INSTALL} -m 755 -c} ${INIVARS} } show_usage() { `cat <\"" [ "${CONTACT_MAIL}" ] && \ echo "printf \"\nReport bugs to: ${CONTACT_NAME} <${CONTACT_MAIL}>\"" cat <." exit 0 } parse_options() { flag=\`echo \$1| cut -d = -f 1\` value=\`echo \$1| ${S}AWK 'BEGIN{FS="=";}{print \$2}'\` flag2=\`echo \$flag|cut -f2- -d -| sed -e 's,-,_,g' -e 's,^_,,g'|tr '[a-z]' '[A-Z]'\` if [ "\${TARGET_OS}" = "darwin" ]; then LIBPATH=-Wl,-install_name, else LIBPATH=-Wl,-R fi case \$flag in -h|--help|--hel|--h|--he|-help) show_usage ; ;; -qV|-quiet-version|--quiet-version) be_quiet show_version ; ;; -q|-quiet|--quiet) be_quiet ; ;; -V|-version|--version) show_version ; ;; -r|--r|--report) EOF if [ ! "${PKGNAME}" = "this package" ]; then echo "echo \"PKGNAME: ${PKGNAME}\"" ; fi if [ "${VERSION}" ]; then echo "echo \"VERSION: ${VERSION}\"" ; fi if [ "${CONTACT_NAME}" ]; then echo "echo \"AUTHOR: ${CONTACT_NAME}\"" ; fi if [ "${CONTACT_MAIL}" ]; then echo "echo \"EMAIL: ${CONTACT_MAIL}\"" ; fi if [ "${DESCRIPTION}" ]; then echo "echo \"DESCRIPTION: ${DESCRIPTION}\"" ; fi if [ "${REPORT_LANGS}" ]; then echo "echo \"LANGS: ${REPORT_LANGS}\"" ; fi if [ "${REPORT_REQUIRED}" ]; then echo "echo \"REQUIRED: ${REPORT_REQUIRED}\"" ; fi if [ "${REPORT_OPTIONAL}" ]; then echo "echo \"OPTIONAL: ${REPORT_OPTIONAL}\"" ; fi if [ "${REPORT_PKGCFG}" ]; then echo "echo \"PKGCONFIG: ${REPORT_PKGCFG}\"" ; fi if [ "${REPORT_FLAGS}" ]; then echo "echo \"FLAGS: ${REPORT_FLAGS}\"" ; fi if [ "${REPORT_TOOLS}" ]; then echo "echo \"TOOLS: ${REPORT_TOOLS}\"" ; fi # TODO # We could probably reduce this case/switch because : # $ ./configure --prefix=/usr # flag=value # $ ./configure PREFIX=/usr # flag2=value cat <&2 ; echo ; fi ;; esac } # MAIN # take_environ split_host BUILD HOST TARGET [ -z "${S}ACRHOOK" ] && ACRHOOK=./configure.hook [ -e "${S}ACRHOOK" ] && . ${S}{ACRHOOK} while : ; do [ -z "\$1" ] && break parse_options "\$1" shift done ENVWORDS="${ENVWORDS}" create_environ ${EQUALSCR} EOF } check_path() { [ "${SPLIT}" = 1 ] && return cat < running ./configure in ${S}{A}" cd ${S}{A} ./configure ${S}@ cd - > /dev/null else echo "Cannot find ./configure on directory ${S}{A}." >&2 exit 1 fi done EOF } ## }}} ## {{{ Show report show_report() { [ "${REPORT}" ] &&\ cat <&2 } LAST_DOT=0 DOTS=0 show_progress_bar() { DOTS=`echo $WORDS_N $WORDS_T | awk '{printf ("%.d",$1*70/$2);}'` if [ "${LAST_DOT}" = "${DOTS}" ]; then return ; fi PCENT=`echo $WORDS_N $WORDS_T | awk '{printf ("%.d",$1*100/$2);}'` LAST_DOT=$DOTS [ -z "$PCENT" ] && PCENT=0 dots=`printf "%.2d" $PCENT` N=0 BAR=`echo $DOTS | awk '{ str=""; for(i=0;i<$1;i++) { str=str"#"; } print str; }'` printf " [------------------------------------------------------------------------]\r" >&2 printf " $dots%% [${BAR}\r" >&2 } is_envword() { found="" for A in $ENVWORDS ; do [ $A = $1 ] && found=1 && break; done [ -z "$found" ] && \ echo "`word` | Warning: Variable '$1' not defined." >&2 } ## string mode ## enter_string_mode() { [ -n "${STRING}" ] && return 0 MODE_OLD="${MODE}" MODE="string" STRING="${1}" return 1 } alias wait_string_mode='[ "${MODE}" = "string" ] && continue' alias leave_string_mode='STRING=""' enter_mode() { MODE=$1 STR=$2 _REQUIRED=0 case "${STR}" in *!) _REQUIRED=1 ; ;; esac } cat_file() { cat "$1" \ | sed -e 's,/\*,((,g' \ | sed -e 's,\*/,)),g' \ | awk '{ print $0" _n_";}' } # MAIN LOOP # print_header # show /bin/sh stuff COMMENT=0 WORDS=`cat_file "${ACRFILE}"` WORDS_N=0 # number of current word (counter) WORDS_K=0 # keyword word WORDS_T=`echo ${WORDS} | wc -w ` # total number of words [ "${DEBUG}" = 1 ] && echo "acr: parsing '${ACRFILE}'" >&2 for STR2 in ${WORDS} NOP ; do INSIDE_INCLUDE=0 if [ "$MODE" = "include" ]; then [ "${DEBUG}" = 1 ] && echo "`word` < include $STR2" >&2 if [ -e "@DATADIR@/acr/modules/${STR2}.acr" ]; then FILE="@DATADIR@/acr/modules/${STR2}.acr"; else FILE="$STR2.acr"; fi if [ -e "$FILE" ]; then MODE="" INSIDE_INCLUDE=1 #WORDS_N=$(($WORDS_N+1)) WORDS2=`cat_file ${FILE}` else echo "`word` | ERROR: Cannot include file '$FILE'. File not found." >&2 exit 1 fi else WORDS2="${STR2}" fi for STR in $WORDS2 ; do # inner loop for include workaround. # Progress bar if [ "${INSIDE_INCLUDE}" = 0 ]; then [ "${PBAR}" = 1 ] && show_progress_bar fi WORDS_N=$(($WORDS_N+1)) IS_KEYWORD=1 is_buggy ${STR} # XXX <- is deprecated! remove in 0.6 if [ "${STR}" != "<-" ]; then if [ "`echo ${STR}| cut -c -2`" = "<-" ]; then VAR="`echo ${STR} | cut -c 3-`" TMP="${S}${VAR}" if [ "${DEBUG}" = 1 ]; then echo "`word` > get value" >&2 fi STR=${TMP} fi fi # COMMENTS # [ -z "${STR}" ] && continue ## ??? case ${COMMENT} in "1") case "${STR}" in "##"|"\\\\"|"))"|"*/") COMMENT=0 ;; esac continue ;; "//") if [ "${STR}" = "_n_" ]; then COMMENT=0 else continue fi ;; *) case "${STR}" in "##"|"(("|"/*") COMMENT=1 continue ;; "//") COMMENT="//" continue ;; esac ;; esac [ "${STR}" = "_n_" ] && continue # one word comment [ "`echo $STR | cut -c 1`" = "#" ] && \ echo "`word` | One word comment is deprecated." >&2 && \ continue # CONDITION FLAGS # if [ -n "${MODE}" ]; then if [ "${MODE}" = "string" ]; then [ "${STR}" = "NOP" ] && STR=";" if [ "${STR}" = ";" ] ; then [ "${DEBUG}" = 1 ] && \ echo " | $spaces\"${STRING}\"" >&2 MODE="${MODE_OLD}" else STRING="`concat "${STRING}" ${STR}`" continue fi fi case "${MODE}" in "pkgconfig-do") enter_string_mode ${STR} wait_string_mode FILE_NAME="${STRING}" check_pcgen ${STRING} IS_KEYWORD=0 MODE="" leave_string_mode ;; "description") enter_string_mode ${STR} wait_string_mode DESCRIPTION="${STRING}" IS_KEYWORD=0 MODE="" leave_string_mode ;; "chkdecl") IS_KEYWORD=0 if [ -z "${_CHKDECL_INC}" ]; then _CHKDECL_INC="${STR}" else MODE="" _CHKDECL_NAME=${STR} check_decl $_CHKDECL_INC ${_CHKDECL_NAME} _CHKDECL=0 _CHKDECL_INC="" _CHKDECL_NAME="" fi ;; "chkflg") IS_KEYWORD=0 if [ -z "${_CHKFLG_VAR}" ]; then _CHKFLG_VAR="${STR}" else if [ "${STR}" = ";" ]; then check_cflags "${_CHKFLG_NAME}" _CHKFLG_NAME="" _CHKFLG_VAR="" _CHKFLG=0 MODE="" else _CHKFLG_NAME="${_CHKFLG_NAME} ${STR}" fi fi ;; "chksym") IS_KEYWORD=0 if [ -z "${_CHKSYM_LIB}" ]; then _CHKSYM_LIB="${STR}" else MODE="" _CHKSYM_NAME=${STR} check_sym $_CHKLIB_LIB ${_CHKSYM_NAME} _CHKSYM=0 _CHKSYM_LIB="" _CHKSYM_NAME="" fi ;; "chkfunc") IS_KEYWORD=0 if [ -z "${_CHKFUNC_LIB}" ]; then _CHKFUNC_LIB="${STR}" else MODE="" _CHKFUNC_NAME=${STR} check_func $_CHKLIB_LIB ${_CHKFUNC_NAME} _CHKFUNC=0 _CHKFUNC_LIB="" _CHKFUNC_NAME="" fi ;; "chkcp") MODE="" IS_KEYWORD=0 REPORT_REQUIRED="${REPORT_REQUIRED} ${STR}" VAR=`var_filter "HAVE_CLASSPATH_${STR}"` SCRIPT="${SCRIPT} ochof \"checking for classpath ${STR}... \" echo \"import ${STR}.*;\" > test.java ${S}{JAVAC} test.java 2>&1 > /dev/null if [ \"${S}?\" = 0 ]; then echo yes ${VAR}=1 else echo no ${VAR}=0 " if [ "${_REQUIRED}" = 1 ]; then SCRIPT="${SCRIPT} echo 'This classpath is required.' exit 1 " fi SCRIPT="${SCRIPT}fi" ;; "chklib") IS_KEYWORD=0 check_lib ${STR} MODE="" _CHKLIB_NAME="" ;; "chkpy") IS_KEYWORD=0 check_py ${STR} MODE="" ;; "chkru") IS_KEYWORD=0 check_ru ${STR} MODE="" ;; "chkpm") IS_KEYWORD=0 check_pm ${STR} MODE="" ;; "check_exec") IS_KEYWORD=0 if [ -z "${_IF_VAR}" ]; then _IF_VAR=${STR}; elif [ "${STR}" = ";" ]; then SCRIPT=`cat </dev/null if [ \\$? = 0 ]; then echo "ok" ; $CHKUSR_VAR=1; else echo "no" EOF ` if [ 1 = "${_REQUIRED}" ]; then SCRIPT="${SCRIPT} ; echo \"*** This ${CHKUSR_TARGET} is required!.\" ; do_remove ; exit 1" fi SCRIPT="${SCRIPT} ; fi" MODE="" CHKUSR_NAME="" CHKUSR_TARGET="" IS_KEYWORD=1 fi ;; "chkver") IS_KEYWORD=0 if [ -z "${_CHKVER_LIB}" ]; then _CHKVER_LIB="${STR}" else if [ "${_REQUIRED}" = 1 ]; then REPORT_REQUIRED="${REPORT_REQUIRED} lib${_CHKVER_LIB}>=${STR}" else REPORT_OPTIONAL="${REPORT_OPTIONAL} lib${_CHKVER_LIB}>=${STR}" fi # HAVE_GLIB_2_0_VERSION_2_18 VAR=`var_filter HAVE_${_CHKVER_LIB}_VERSION_${STR}` add_envword ${VAR} SCRIPT=`cat <= ${STR}... " ${S}{PKGCONFIG} --atleast-version=${STR} ${_CHKVER_LIB} >/dev/null 2>&1 if [ ${S}? = 0 ]; then ${VAR}=1 ; echo ok; else echo "no" EOF ` if [ 1 = ${_REQUIRED} ]; then SCRIPT=`cat <= ${STR}." >&2 exit 1; fi EOF ` else SCRIPT="${SCRIPT} ; fi" fi _CHKVER=0 _CHKVER_LIB="" MODE="" fi ;; "useiconv") MODE="" add_envword "HAVE_LIB_ICONV" add_envword "ICONV_LIBS" REPORT_REQUIRED="${REPORT_REQUIRED} libiconv" SCRIPT=`cat < test.c ${S}{CC} ${S}{CFLAGS} ${S}{CPPFLAGS} ${S}{LDFLAGS} test.c 2> /dev/null if [ ${S}? = 0 ]; then echo yes HAVE_LIB_ICONV=1 else echo no fi fi EOF ` ;; "exec"|"exec!") IS_KEYWORD=0 if [ -z "${_EXEC_VAR}" ]; then _EXEC_VAR="${STR}" else enter_string_mode ${STR} wait_string_mode add_envword "${_EXEC_VAR}" append "`cat<&2 " MODE="" leave_string_mode ;; "die") IS_KEYWORD=0; if [ -z "${_DIE_VAR}" ]; then _DIE_VAR=${STR} else enter_string_mode ${STR} wait_string_mode if [ "${_DIE_BOOL}" = 0 ]; then SCRIPT="${SCRIPT} case \"${S}${_DIE_VAR}\" in 0|\"\") echo ; echo \"ERROR: ${STRING}\" >&2 ; echo ; exit 1 ;; esac" else SCRIPT="${SCRIPT} case \"${S}${_DIE_VAR}\" in 0|\"\") ;; *) echo ; echo \"ERROR: ${STRING}\" >&2 ; echo ; exit 1 ; ;; esac" fi MODE="" _DIE_VAR=""; leave_string_mode fi ;; "if") IS_KEYWORD=0 if [ -z "${_IF_VAR}" ]; then _IF_VAR=${STR} is_envword "${STR}" elif [ -z "${_IF_SETVAR}" ]; then if [ "${STR}" = "{" ]; then NKEYS=$(($NKEYS+1)) SCRIPT="${SCRIPT} if [ \"${S}${_IF_VAR}\" = \"${_IF_BOOL}\" ]; then" MODE="" _IF_VAR="" _IF_SETVAR="" _IF_OP="" else _IF_SETVAR=${STR} is_envword ${STR} _IF_SETVAL="" fi elif [ -z "${_IF_OP}" ]; then _IF_OP=${STR} check_ifop ${_IF_OP} else enter_string_mode ${STR} wait_string_mode add_envword ${_IF_SETVAR} SCRIPT="${SCRIPT} if [ \"${S}${_IF_VAR}\" = \"${_IF_BOOL}\" ]; then" # check_ifop TODO -> use ifop instead of that. case ${_IF_OP} in "=") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"${_IF_SETVAL}\" ; fi" ;; "+=") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"${S}{${_IF_SETVAR}} ${_IF_SETVAL}\" ; fi" ;; "?=") SCRIPT="${SCRIPT} if [ -z \"${S}${_IF_SETVAR}\" ]; then ${_IF_SETVAR}=\"${_IF_SETVAL}\"; fi" ;; "<-") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"\`eval 'echo \$${_IF_SETVAL}'\`\"; fi" # XXX deprecated in 0.6 echo "`word` | The '<-' keyword is deprecated. Use $VAR instead" >&2 ;; esac reset_vars leave_string_mode fi ;; "ifeqval") echo "IFEQVAL: deprecated keyword. Please use IFEQ VAR \$VAR2 ;" >&2 IS_KEYWORD=0 if [ -z "${_IF_VAR}" ]; then _IF_VAR=$STR is_envword "${STR}" elif [ -z "${_IF_VAR2}" ]; then _IF_VAR2=$STR elif [ -z "${_IF_SETVAR}" ]; then if [ "${STR}" = "{" ]; then NKEYS=$(($NKEYS+1)) if [ "${_IF_BOOL}" = 1 ]; then SCRIPT="${SCRIPT} if [" else SCRIPT="${SCRIPT} if [ !" fi SCRIPT="${SCRIPT} \\\"${S}${_IF_VAR}\\\" = \\\"${S}${_IF_VAR2}\\\" ]; then" _IFEQVAL=0 reset_vars else _IF_SETVAR=${STR} fi elif [ -z "${_IF_OP}" ]; then _IF_OP=${STR} check_ifop ${_IF_OP} elif [ "${STR}" = ";" ]; then if [ "${_IF_BOOL}" = 1 ]; then SCRIPT="${SCRIPT} if [" else SCRIPT="${SCRIPT} if [ !" fi SCRIPT="${SCRIPT} \"${S}${_IF_VAR}\" = \"${S}${_IF_VAR2}\" ]; then" # TODO this must be in a external function case ${_IF_OP} in "=") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"${_IF_SETVAL}\" ; fi" ;; "+=") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"${S}{${_IF_SETVAR}} ${_IF_SETVAL}\" ; fi" ;; "?=") SCRIPT="${SCRIPT} if [ -z \"${S}${_IF_SETVAR}\" ]; then ${_IF_SETVAR}=\"${_IF_SETVAL}\"; fi" ;; "<-") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"\`eval 'echo \$${_IF_SETVAL}'\`\"; fi" # XXX this is deprecated echo "`word` | The '<-' keyword is deprecated. Use $VAR instead" >&2 ;; esac MODE="" _IFEQVAL=0 _IF_BOOL=0 reset_vars else _IF_SETVAL="`concat "${_IF_SETVAL}" "${STR}"`" fi ;; "ifeq") IS_KEYWORD=0 if [ -z "${_IF_VAR}" ]; then _IF_VAR=${STR} is_envword "${STR}" elif [ "${_IF_VALUE_EOF}" = 0 ]; then if [ "${STR}" = ";" ]; then _IF_VALUE_EOF=1 elif [ "${STR}" = "{" ]; then echo "`word` | Missing ; in ifeq expression" >&2 exit 1 else _IF_VALUE="`concat "${_IF_VALUE}" "${STR}"`" fi elif [ -z "${_IF_SETVAR}" ]; then if [ "${STR}" = "{" ]; then if [ "${_IF_BOOL}" = 1 ]; then SCRIPT="`printf \"${SCRIPT}\nif [\"`" else SCRIPT="`printf \"${SCRIPT}\nif [ !\"`" fi SCRIPT="`printf \"${SCRIPT} \\\"${S}${_IF_VAR}\\\" = \\\"${_IF_VALUE}\\\" ]; then\"`" NKEYS=$(($NKEYS+1)) MODE="" _IF_VALUE_EOF=0 reset_vars else _IF_SETVAR=${STR} fi elif [ -z "${_IF_OP}" ]; then _IF_OP="${STR}" check_ifop ${_IF_OP} elif [ "${STR}" = ";" ]; then # bool if [ "${_IF_BOOL}" = 1 ]; then SCRIPT="`echo -n \"${SCRIPT} if [ \"`" else SCRIPT="`echo -n \"${SCRIPT} if [ ! \"`" fi SCRIPT="`echo \"${SCRIPT} \\\"${S}${_IF_VAR}\\\" = \\\"${_IF_VALUE}\\\" ]; then\"`" # set # TODO create a new function that concats SCRIPT checking IF_OP case ${_IF_OP} in "=") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"${_IF_SETVAL}\" ; fi ;" ;; "+=") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"${S}{${_IF_SETVAR}} ${_IF_SETVAL}\" ; fi ;" ;; "?=") SCRIPT="${SCRIPT} if [ -z \"${S}${_IF_SETVAR}\" ]; then ${_IF_SETVAR}=\"${_IF_SETVAL}\"; fi ; fi ;" ;; "<-") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"\`eval 'echo \$${_IF_SETVAL}'\`\"; fi" echo "`word` | The '<-' keyword is deprecated. Use $VAR instead" >&2 ;; esac reset_vars _IFEQ=0 _IF_VALUE_EOF=0 elif [ -z "${_IF_SETVAL}" ]; then _IF_SETVAL="${STR}" else _IF_SETVAL="${_IF_SETVAL} ${STR}" fi ;; "ifand") IS_KEYWORD=0 if [ -z "${_IF_VAR}" ]; then _IF_VAR=${STR} is_envword "${STR}" elif [ -z "${_IF_VAR2}" ]; then _IF_VAR2="${STR}" is_envword "${STR}" elif [ -z "${_IF_SETVAR}" ]; then if [ "${STR}" = "{" ]; then NKEYS=$(($NKEYS+1)) [ "${_IF_BOOL}" = 1 ] && OGLE=11 || OGLE=00 SCRIPT="${SCRIPT} if [ ${OGLE} = \"${S}${_IF_VAR}${S}${_IF_VAR2}\" ]; then " _IF_VALUE_EOF=0 reset_vars else _IF_SETVAR=${STR} is_envword ${STR} fi elif [ -z "${_IF_OP}" ]; then _IF_OP="${STR}" check_ifop ${_IF_OP} elif [ ! "${STR}" = ";" ]; then if [ -z "${_IF_SETVAL}" ]; then _IF_SETVAL="${STR}" else _IF_SETVAL="${_IF_SETVAL} ${STR}" fi else [ "${_IF_BOOL}" = 1 ] && OGLE=1 || OGLE=0 case ${_IF_OP} in "=") STR="${_IF_SETVAR}=\"${_IF_SETVAL}\"" ;; "+=") STR="${_IF_SETVAR}=\"${S}{${_IF_SETVAR}} ${_IF_SETVAL}\"" ;; "?=") STR="if [ -z \"${S}${_IF_SETVAR}\" ]; then ${_IF_SETVAR}=\"${_IF_SETVAL}\"; fi" ;; "<-") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"\`eval 'echo \$${_IF_SETVAL}'\`\"; fi" echo "`word` | The '<-' keyword is deprecated. Use $VAR instead" >&2 ;; esac SCRIPT="${SCRIPT} if [ ${OGLE} = \"${S}${_IF_VAR}\" ]; then if [ ${OGLE} = \"${S}${_IF_VALUE}\" ]; then ${STR} ; fi ; fi" ## TODO XXX this must be other command (IFEQVAR..or something similar #if [ ${OGLE}"${S}${_IF_VAR}" = "${S}${_IF_VALUE}" ]; then ${_IF_SETVAR}="${STR}" ; fi ; reset_vars fi ;; "ifor") IS_KEYWORD=0 if [ -z "${_IF_VAR}" ]; then _IF_VAR=${STR} is_envword "${STR}" elif [ -z "${_IF_VAR2}" ]; then _IF_VAR2="${STR}" is_envword "${STR}" elif [ -z "${_IF_SETVAR}" ]; then if [ "${STR}" = "{" ]; then NKEYS=$(($NKEYS+1)) SCRIPT="${SCRIPT} if [ ${_IF_BOOL} = \"${S}${_IF_VAR}\" ] || [ ${_IF_BOOL} = \"${S}${_IF_VAR2}\" ]; then " _IF_VALUE_EOF=0 reset_vars else _IF_SETVAR=${STR} is_envword ${STR} fi elif [ -z "${_IF_OP}" ]; then _IF_OP="${STR}" check_ifop ${_IF_OP} elif [ ! "${STR}" = ";" ]; then if [ -z "${_IF_SETVAL}" ]; then _IF_SETVAL="${STR}" else _IF_SETVAL="${_IF_SETVAL} ${STR}" fi else [ "${_IF_BOOL}" = 1 ] && OGLE=1 || OGLE=0 case ${_IF_OP} in "=") STR="${_IF_SETVAR}=\"${_IF_SETVAL}\"" ;; "+=") STR="${_IF_SETVAR}=\"${S}{${_IF_SETVAR}} ${_IF_SETVAL}\"" ;; "?=") STR="if [ -z \"${S}${_IF_SETVAR}\" ]; then ${_IF_SETVAR}=\"${_IF_SETVAL}\"; fi" ;; "<-") SCRIPT="${SCRIPT} ${_IF_SETVAR}=\"\`eval 'echo \$${_IF_SETVAL}'\`\"; fi" echo "`word` | The '<-' keyword is deprecated. Use $VAR instead" >&2 ;; esac SCRIPT="${SCRIPT} if [ ${_IF_BOOL} = \"${S}${_IF_VAR}$\" ] || [ ${_IF_BOOL} = \"${S}${_IF_VAR2}\" ]; then ${STR} ; fi" reset_vars fi ;; "valapkg") IS_KEYWORD=0 TMP_VAR=`var_filter "HAVE_VALAPKG_${STR}"` add_envword ${TMP_VAR} # TODO: Use EOF or F="$F B" REPORT_PKGCFG="${REPORT_PKGCFG} ${STR}" SCRIPT="`printf \"${SCRIPT}\nprintf 'checking valac --pkg ${STR}... '\"`" ## - flags - ## SCRIPT="`printf \"${SCRIPT}\ntmp=\\\`echo 'void main(){}'>.test.vala ; ${S}{VALAC} --pkg ${STR} .test.vala 2>/dev/null\\\`\"`" SCRIPT="`printf \"${SCRIPT}\nif [ ${S}? != 0 ]; then echo no ; ${TMP_VAR}=0; \"`" if [ "${_REQUIRED}" = 1 ]; then SCRIPT="`printf \"${SCRIPT}\necho 'This vala package is required'\nexit 1\"`" fi SCRIPT="`printf \"${SCRIPT}\nelse \"`" SCRIPT="`printf \"${SCRIPT}\necho yes; ${TMP_VAR}=1; \";`" SCRIPT="`printf \"${SCRIPT}\nfi;rm -f .test.vala\"`" ## -eof- ## _REQUIRED=0 MODE="" ;; "pkgconfig") if [ "${_USE_PKGCONFIG}" = 0 ]; then echo "PKGCFG directive requires USE_PKGCONFIG" >&2 exit 1 fi IS_KEYWORD=0 if [ -z "${_PC_CFLAGS}" ]; then _PC_CFLAGS="${STR}" elif [ -z "${_PC_LDFLAGS}" ]; then _PC_LDFLAGS="${STR}" else add_envword ${_PC_CFLAGS} add_envword ${_PC_LDFLAGS} TMP_VAR=`var_filter "HAVE_PKGCFG_${STR}"` add_envword ${TMP_VAR} # TODO: Use EOF or F="$F B" REPORT_PKGCFG="${REPORT_PKGCFG} ${STR}" SCRIPT="`printf \"${SCRIPT}\nif [ -z \\\"${S}{PKGCONFIG}\\\" ]; then pkg-config --version >/dev/null 2>&1 ; if [ $? = 0 ]; then PKGCONFIG=pkg-config ; else PKGCONFIG=pkgconf ; fi; fi\"`" if [ -z "${ONCE_PKGCONFIG}" ]; then SCRIPT="`printf \"${SCRIPT}\ntype ${S}{PKGCONFIG} > /dev/null 2>&1 || echo \\\"ERROR: Cannot find valid PKGCONFIG, pkg-config or pkgconf in PATH\\\"\"`" SCRIPT="`printf \"${SCRIPT}\necho 'Using PKGCONFIG: '${S}{PKGCONFIG}\"`" ONCE_PKGCONFIG=1 fi SCRIPT="`printf \"${SCRIPT}\nprintf 'checking pkg-config flags for ${STR}... '\"`" ## - flags - ## SCRIPT="`printf \"${SCRIPT}\ntmp=\\\`${S}{PKGCONFIG} --cflags ${STR} 2>/dev/null\\\`\"`" SCRIPT="`printf \"${SCRIPT}\nif [ ${S}? != 0 ]; then echo no ; ${TMP_VAR}=0;\"`" SCRIPT="`printf \"${SCRIPT}\n${_PC_CFLAGS}='';${_PC_LDFLAGS}='';\"`" if [ "${_REQUIRED}" = 1 ]; then SCRIPT="`printf \"${SCRIPT}\necho 'This package is required'\nexit 1\"`" fi SCRIPT="`printf \"${SCRIPT}\nelse\"`" if [ "${_PKGCONFIG_PLUS}" = 1 ]; then SCRIPT="`printf \"${SCRIPT}\n${_PC_CFLAGS}=\\\"${S}${_PC_CFLAGS} ${S}tmp\\\";\"`" else SCRIPT="`printf \"${SCRIPT}\n${_PC_CFLAGS}=${S}tmp;\"`" fi ## - libs - ## SCRIPT="`printf \"${SCRIPT}\ntmp=\\\`${S}{PKGCONFIG} --libs ${STR} 2>/dev/null\\\`\"`" SCRIPT="`printf \"${SCRIPT}\nif [ ${S}? = 0 ]; then\"`" SCRIPT="`printf \"${SCRIPT}\necho yes; ${TMP_VAR}=1;\";`" if [ "${_PKGCONFIG_PLUS}" = 1 ]; then SCRIPT="`printf \"${SCRIPT}\n${_PC_LDFLAGS}=\\\"${S}${_PC_LDFLAGS} ${S}tmp\\\"; fi; fi\"`" else SCRIPT="`printf \"${SCRIPT}\n${_PC_LDFLAGS}=${S}tmp; fi; fi\"`" fi ## -eof- ## _PC_CFLAGS="" _PC_LDFLAGS="" _REQUIRED=0 MODE="" fi ;; "report") IS_KEYWORD=0 if [ "${STR}" = ";" ]; then MODE="" else REPORT="${REPORT} ${STR}" fi ;; "chkinc") check_inc ${STR} IS_KEYWORD=0 MODE="" ;; "subconf") IS_KEYWORD=0 if [ "${STR}" = ";" ]; then MODE="" else SCRIPT="`printf \"${SCRIPT}\n(cd ${STR} && sh configure )\"`" # SUBCONF_DIRS="${SUBCONF_DIRS} ${STR}" fi ;; "subdirs") IS_KEYWORD=0 case "${STR}" in ";") MODE="" ; ;; #"%") SD_FILES="%" ; ;; ## WTF *) SD_FILES="${SD_FILES}${STR} " ; ;; esac ;; "chkprg") IS_KEYWORD=0 if [ "${STR}" = "NOP" ]; then echo "ERROR: Expected argument after CHKPRG keyword" >&2 exit 1 fi if [ -z "${_CHKPRG_VAR}" ]; then _CHKPRG_VAR=${STR} else _CHKPRG_NAME=${STR} check_prg ${_CHKPRG_VAR} ${_CHKPRG_NAME} ${_REQUIRED} MODE="" _CHKPRG_VAR="" _CHKPRG_NAME="" fi ;; "outputh") if [ "${STR}" = ";" ]; then MODE="" else H_FILES="${H_FILES} ${STR}" fi IS_KEYWORD=0 ;; "outputsh") if [ "${STR}" = ";" ]; then MODE="" else SH_FILES="${SH_FILES} ${STR}" fi IS_KEYWORD=0 ;; "argument") if [ "${STR}" = ";" ]; then # enable DEBUG debug "=" add_flag ${ARGUMENT} ${ARG_NAME} \ ${ARG_FLAG} "${ARG_VALUE}" "${ARG_DESC}" MODE="" ARGUMENT="" ARG_NAME="" ARG_FLAG="" ARG_VALUE="" ARG_DESC="" else if [ -z "${ARG_NAME}" ]; then ARG_NAME=`echo ${STR} | cut -d = -f 1` ARG_VALUE=`echo ${STR} | awk -F = '{ print $2 }'` elif [ -z "${ARG_FLAG}" ]; then ARG_FLAG=${STR} else ARG_DESC="${ARG_DESC} ${STR}" fi fi IS_KEYWORD=0 ;; "equal") # TODO: use string mode if [ "${STR}" = ";" ]; then for A in 1 2 3 4 ; do if [ "${A}" = "${EQUAL}" ]; then echo "`word` | There's a null body assignation to variable ${SET_VAR}. Please type \"\" or ''" >&2 exit 1 IS_KEYWORD=0 fi done [ "${DEBUG}" = 1 ] && \ echo " | $spaces\"${STRING}\"" >&2 STRING="" SCRIPT="${SCRIPT} ${EQUAL}\"" MODE="" # eval ${EQUAL}\" # XXX ? EQUAL="" _EQUAL_3=0 else if [ -n "${SET_VAR}" ]; then STRING=${STR} STR=${SET_VAR} SET_VAR="" fi case "${STRING}" in "''"|"\"\"") STRING="" ;; esac case "${EQUAL}" in 1) EQUAL="${STR}=\"${STRING}" ;; # = 2) EQUAL="${STR}=\"${S}{${STR}} ${STRING}" ;; # += 3) EQUAL="[ -z \"${S}{${STR}}\" ] && ${STR}=\"${STRING}" ;; # ?= 4) EQUAL="${STR}=\"${S}${STRING}" ; ;; # <- XXX deprecated!! *) #STRING=`concat "${STRING}" "${STR}"` EQUAL=`concat "${EQUAL}" "${STR}"` ; ;; # .concat() esac #STRING="" continue fi IS_KEYWORD=0 ;; "pkgname") add_envword "PKGNAME" add_envword "VPATH" INIVARS="${INIVARS} PKGNAME='${STR}' ;" PKGNAME=${STR} MODE="" IS_KEYWORD=0 ;; "version") if [ "${PKGNAME}" = "this package" ]; then echo "`word` | PKGNAME must be defined before VERSION" >&2 exit 1 fi if [ x != "x`echo \"$STR\" | grep ^@`" ]; then F="`echo \"$STR\" | cut -c 2-`" STR=$(cat $F) fi add_envword "VERSION" INIVARS="${INIVARS} VERSION='${STR}' ;" VERSION="${STR}" VERSION_MAJOR="`semver ${STR} 1`" VERSION_MINOR="`semver ${STR} 2`" VERSION_PATCH="`semver ${STR} 3`" VERSION_NUMBER="`printf "%d%02d%02d\n" ${VERSION_MAJOR} ${VERSION_MINOR} ${VERSION_PATCH}`" INIVARS="${INIVARS} VERSION_MAJOR=${VERSION_MAJOR};" INIVARS="${INIVARS} VERSION_MINOR=${VERSION_MINOR};" INIVARS="${INIVARS} VERSION_PATCH=${VERSION_PATCH};" INIVARS="${INIVARS} VERSION_NUMBER=${VERSION_NUMBER};" MODE="" IS_KEYWORD=0 ;; "contact") IS_KEYWORD=0 if [ "${_CONTACT}" = 1 ]; then if [ "${STR}" = ";" ]; then _CONTACT=2 else if [ -z "${CONTACT_NAME}" ]; then CONTACT_NAME="${STR}" else CONTACT_NAME="${CONTACT_NAME} ${STR}" fi fi else CONTACT_MAIL=${STR}; MODE="" _CONTACT=0 ## XXX ugly hack add_envword "CONTACT" add_envword "CONTACT_NAME" add_envword "CONTACT_MAIL" INIVARS="${INIVARS} CONTACT_MAIL=\"${CONTACT_MAIL}\" ;" INIVARS="${INIVARS} CONTACT_NAME=\"${CONTACT_NAME}\" ;" INIVARS="${INIVARS} CONTACT=\"${CONTACT_NAME} <${CONTACT_MAIL}>\" ;" fi ;; "arg_ignore") FLAGSCRIPT=`printf "${FLAGSCRIPT}\n\"${STR}\") : ; ;;"` IS_KEYWORD=0 MODE="" ;; "author") IS_KEYWORD=0 if [ "${_AUTHOR}" = 1 ]; then if [ "${STR}" = ";" ]; then _AUTHOR=2 else if [ -z "${AUTHOR_NAME}" ]; then AUTHOR_NAME="${STR}" else AUTHOR_NAME="${AUTHOR_NAME} ${STR}" fi fi else AUTHOR_MAIL=${STR}; MODE="" _AUTHOR=0 ## XXX ugly hack add_envword "AUTHOR" add_envword "AUTHOR_NAME" add_envword "AUTHOR_MAIL" INIVARS="${INIVARS} AUTHOR_MAIL=\"${AUTHOR_MAIL}\" ;" INIVARS="${INIVARS} AUTHOR_NAME=\"${AUTHOR_NAME}\" ;" INIVARS="${INIVARS} AUTHOR=\"${AUTHOR_NAME} <${AUTHOR_MAIL}>\" ;" fi ;; "requireacrversion") IS_KEYWORD=0 MODE="" _OK="`echo ${STR} ${ACR_VERSION} | awk '{ if ($1 <= $2) {print "ok";} }'`" if [ -z "${_OK}" ]; then echo "`word` | Invalid ACR version. You need at least v${STR}" >&2 exit 1 fi ;; "sizeof") enter_string_mode ${STR} wait_string_mode check_sizeof "${STRING}" MODE="" IS_KEYWORD=0 leave_string_mode ;; "substfiles") IS_KEYWORD=0 if [ "${STR}" = ";" ]; then MODE="" else S_FILES="${S_FILES} ${STR}" # XXX may be buggy on >1 dir. must be checked DIR="`echo ${STR} | awk -F / '{ print substr($0,0,length($0)-length($NF)) }'`" S_MKDIR="${S_MKDIR} ${DIR}" fi ;; *) echo "Invalid mode '${MODE}'" >&2 exit 1 ;; esac fi ##KEYWORDS## ## debug output {{{ if [ "${DEBUG}" = 1 ]; then spaces="`echo $NKEYS | awk '{ str=""; for(i=0;i<$1;i++) { str=str" "; } print str; }'`" [ -n "${MODE}" ] && spaces=", ${spaces}" fi if [ "${IS_KEYWORD}" = 0 ]; then if [ "${DEBUG}" = 1 ]; then if [ ! "${STR}" = ";" ]; then printf "%04d |$spaces " $WORDS_N >&2 echo "${STR}" >&2 fi fi continue fi WORDS_K=$WORDS_N if [ "${DEBUG}" = 1 ]; then if [ ! "${WORDS_N}" = "${WORDS_T}" ]; then printf "%04d |$spaces " $WORDS_N >&2 echo "${STR}" >&2 fi fi ## }}} if [ -n "${SET_VAR}" ]; then MODE="equal" case $STR in "=") EQUAL=1 ;; "+=") EQUAL=2 ;; "?=") EQUAL=3 _EQUAL_3=1 ;; "<-") EQUAL=4 echo "`word` | The '<-' keyword is deprecated. Use $VAR instead" >&2 ;; ### XXX deprecated!! *) check_ifop $STR EQUAL=1 ;; ## will crash in check_ifop :) esac continue fi # clear required flag _REQUIRED=0 case $STR in #------------ keyword tokens ";") echo "`word` < found ';' character out of context." >&2 exit 1 ;; "}{"|"}ELSE{") if [ $NKEYS -le 0 ]; then echo "`word` < '}{' unmatching ELSE key." >&2 exit 1 fi SCRIPT="${SCRIPT} else" ;; "}") if [ $NKEYS -lt 0 ]; then echo "`word` < unmatching '}' key." >&2 exit 1 fi NKEYS=$(($NKEYS-1)) SCRIPT="${SCRIPT}; fi" ;; #------------- segmentation keywords "LOCAL:") echo "LOCAL: deprecated keyword." >&2 ;; "GLOBAL:") echo "GLOBAL: deprecated keyword." >&2 ;; #------------- command keywords "NOP") IS_KEYWORD=0 # Do Nothing Keyword ;; ##LANGS## "LANG_C") env_c ; ;; "LANG_C!") LANG_C_REQUIRED=1; env_c ; ;; "LANG_V") env_v ; ;; "LANG_V!") LANG_V_REQUIRED=1; env_v ; ;; "LANG_OBJC") env_objc ; ;; "LANG_OBJC!") LANG_OBJC_REQUIRED=1 ; env_objc ; ;; "LANG_CC"|"LANG_CXX") env_cxx ; ;; "LANG_CC!"|"LANG_CXX!") LANG_CXX_REQUIRED=1; env_cxx ; ;; "LANG_BASH") LANG_BASH=1; lang_bash ; ;; "LANG_TCL") env_tcl ; ;; "LANG_TCL!") LANG_TCL_REQUIRED=1 ; env_tcl ; ;; "LANG_PYTHON") env_python ; ;; "LANG_PYTHON!") LANG_PYTHON_REQUIRED=1 ; env_python ; ;; "LANG_JAVA") env_java ; ;; "LANG_JAVA!") LANG_JAVA_REQUIRED=1 ; env_java ; ;; "LANG_VALA") env_vala ; ;; "LANG_VALA!") LANG_VALA_REQUIRED=1 ; env_vala ; ;; "LANG_LUA") env_lua ; ;; "LANG_LUA!") LANG_LUA_REQUIRED=1 ; env_lua ; ;; "LANG_PERL") env_perl ; ;; "LANG_PERL!") LANG_PERL_REQUIRED=1 ; env_perl ; ;; "USE_PERL_THREADS") env_perl_threads ; ;; "USE_PERL_THREADS!") _REQUIRED=1 env_perl_threads ; ;; "LANG_RUBY") env_ruby ; ;; "LANG_RUBY!") LANG_RUBY_REQUIRED=1 ; env_ruby ; ;; "USE_TK") add_envword "TK_VERSION" add_envword "HAVE_TK" add_envword "TK_LIBS" add_envword "TK_LDFLAGS" add_flag with TK_BASEDIR tk-basedir "/usr/" "Sets the TK basedir to find [/usr]/lib/tkConfig.sh" USE_TK=1 ; ;; "USE_X11") REPORT_OPTIONAL="${REPORT_OPTIONAL} X11" add_envword "HAVE_X11" add_envword "X11BASE" SCRIPT="${SCRIPT} ; X11BASE=/usr/X11R6/" add_flag without HAVE_X11 x "" "Disable the X11 window system" add_flag with X11BASE x11base "=" "Sets the X11BASE directory [/usr/X11R6]" add_flag x X_INCLUDES includes "=" "X include files are in DIR" "=DIR" add_flag x X_LIBRARIES libraries "=" "Points to the X11 library directory" "=DIR" USE_X11=1 ; ;; "USE_GMAKE") USE_GMAKE=1 ; env_gmake ; ;; "PKGNAME") MODE="pkgname" ; ;; "VERSION") MODE="version" ; ;; "CONTACT") MODE="contact" _CONTACT=1 ; ;; "AUTHOR") MODE="author" _AUTHOR=1 ; ;; "DESC"|"DESCRIPTION") MODE="description" ; ;; "PKGCFG_DO"|"PKGCONFIG_DO") MODE="pkgconfig-do" ; ;; "ARG_IGNORE") MODE="arg_ignore" ; ;; "INCLUDE") if [ "${INSIDE_INCLUDE}" = 1 ]; then echo "ERROR: Cannot nest includes." >&2 exit 1 fi MODE="include" ;; "REQUIRE_ACR_VERSION") MODE="requireacrversion" ; ;; "CHECK_INCLUDE"|"CHECK_INCLUDE!"|"CHKINC"|"CHKINC!") if [ -z "${LANG_C}${LANG_CXX}" ]; then echo "`word` | Define LANG_C or LANG_CXX before use CHECK_INC" >&2 exit 1 fi enter_mode "chkinc" ${STR} ;; "CHK_CP"|"CHK_CP!"|"CHECK_CLASSPATH"|"CHECK_CLASSPATH!") if [ -z "${LANG_JAVA}" ]; then echo "`word` | Define LANG_JAVA before use CHECK_CLASSPATH" >&2 exit 1 fi enter_mode "chkcp" ${STR} ;; "CHKDECL"|"CHKDECL!"|"CHKDEC"|"CHKDEC!"|"CHECK_DECLARATION"|"CHECK_DECLARATION!") if [ -z "${LANG_C}" ]; then echo "`word` | Define LANG_C before use CHECK_FUNC" >&2 exit 1 fi enter_mode "chkdecl" ${STR} ;; "CHKFLG"|"CHKFLG!"|"CHECK_CFLAGS"|"CHECK_CFLAGS!") if [ -z "${LANG_C}" ]; then echo "`word` | Define LANG_C before use CHKFLG" >&2 exit 1 fi enter_mode "chkflg" ${STR} ;; "CHKSYM"|"CHKSYM!"|"CHECK_SYMBOL"|"CHECK_SYMBOL!") if [ -z "${LANG_C}" ]; then echo "`word` | Define LANG_C before use CHKSYM" >&2 exit 1 fi enter_mode "chksym" ${STR} ;; "CHKFNC"|"CHKFNC!"|"CHECK_FUNCTION"|"CHECK_FUNCTION!") if [ -z "${LANG_C}" ]; then echo "`word` | Define LANG_C before use CHECK_FUNC" >&2 exit 1 fi enter_mode "chkfunc" ${STR} ;; "CHK_PY"|"CHK_PY!"|"CHECK_PYTHON_MODULE"|"CHECK_PYTHON_MODULE!") if [ -z "${LANG_PYTHON}" ]; then echo "`word` | Define LANG_PYTHON before CHECK_PYTHON_MODULE." >&2 exit 1 fi enter_mode "chkpy" ${STR} ;; "CHK_RU"|"CHK_RU!"|"CHECK_RUBY_EXTENSION"|"CHECK_RUBY_EXTENSION") if [ -z "${LANG_RUBY}" ]; then echo "`word` | Define LANG_RUBY before CHECK_RUBY_EXTENSION." >&2 exit 1 fi enter_mode "chkru" ${STR} ;; "CHK_PM"|"CHK_PM!"|"CHECK_PERL_MODULE"|"CHECK_PERL_MODULE!") if [ -z "${LANG_PERL}" ]; then echo "`word` | Define LANG_PERL before using CHK_PM directive" >&2 exit 1 fi enter_mode "chkpm" ${STR} ;; "CHKLIB"|"CHKLIB!"|"CHECK_LIBRARY"|"CHECK_LIBRARY!") if [ -z "${LANG_C}${LANG_CXX}" ]; then echo "`word` | Define LANG_C or LANG_CXX before use CHECK_LIB" >&2 exit 1 fi enter_mode "chklib" ${STR} ;; "CHKPRG"|"CHKPRG!"|"CHECK_PROGRAM"|"CHECK_PROGRAM!") enter_mode "chkprg" ${STR} ;; "CHKUSR"|"CHKUSR!") enter_mode "chkusr" ${STR} ;; "CHKGRP"|"CHKGRP!") enter_mode "chkgrp" ${STR} ;; "ENDIAN"|"CHECK_ENDIAN") if [ -z "${LANG_C}${LANG_CXX}" ]; then echo "`word` | Define LANG_C or LANG_CXX before use CHECK_ENDIAN" >&2 exit 1 fi check_endian ;; "SIZEOF") if [ -z "${LANG_C}${LANG_CXX}" ]; then echo "`word` | Define LANG_C or LANG_CXX before use SIZEOF" >&2 exit 1 fi enter_mode "sizeof" ${STR} ;; "PKGCONFIG!"|"PKGCFG!") MODE="pkgconfig" _PKGCONFIG_PLUS=0 _REQUIRED=1 ;; "PKGCONFIG"|"PKGCFG") MODE="pkgconfig" _PKGCONFIG_PLUS=0 ;; "VALAPKG") MODE="valapkg" _REQUIRED=0 ;; "VALAPKG!") MODE="valapkg" _REQUIRED=1 ;; "PKGCONFIG+"|"PKGCFG+") MODE="pkgconfig" _PKGCONFIG_PLUS=1 ;; "USE_LIBTOOL"|"USE_LIBTOOL!") if [ -z "${LANG_C}${LANG_CXX}" ]; then echo "`word` | USE_LIBTOOL requires LANG_C or LANG_CXX." >&2 exit 1 fi # TODO: Use mode for libtool if [ "`echo ${STR}| grep '!'`" ]; then _REQUIRED=1 else _REQUIRED=0 fi use_libtool ;; "USE_PKGCONFIG"|"USE_PKGCONFIG!") if [ "`echo ${STR}| grep '!'`" ]; then _REQUIRED=1 else _REQUIRED=0 fi use_pkgconfig ;; "USE_PTHREAD"|"USE_PTHREAD!") if [ -z "${LANG_C}${LANG_CXX}" ]; then echo "`word` | USE_PTHREAD requires LANG_C or LANG_CXX." >&2 exit 1 fi if [ "`echo ${STR}| grep '!'`" ]; then _REQUIRED=1 else _REQUIRED=0 fi use_pthread ;; "USE_BACKUP") echo "`word` | USE_BACKUP is deprecated. It may not work on further version." >&2 USE_BACKUP=1 ;; "REPORT_DEFINED"|"RD") _REPORT_DEFINED=1 ;; "USE_JNI") if [ -z "${LANG_C}${LANG_CXX}${LANG_JAVA}" ]; then echo "`word` | USE_JNI requires LANG_C or LANG_CXX and LANG_JAVA" >&2 exit 1 fi use_jni ;; "REPORT") MODE="report" ;; "OUTPUT_H") MODE="outputh" ;; "OUTPUT_SH") MODE="outputsh" ;; "SUBCONF") MODE="subconf" ;; "SUBDIRS") MODE="subdirs" ;; "EXPORT") echo "`word` | EXPORT keyword is deprecated. No need to use." >&2 MODE="export" ;; "SUBST"|"SUBST_FILES") MODE="substfiles" ;; "IF") MODE="if" _IF_BOOL=1 ;; "IFNOT") MODE="if" _IF_BOOL=0 ;; "IFNULL") MODE="if" _IF_BOOL="" ;; "ECHO") MODE="echo" ;; "IFNOTNULL") MODE="ifeq" _IF_BOOL=0 _IF_VALUE="" _IF_VALUE_EOF=1 ;; "IFEQ") MODE="ifeq" _IF_BOOL=1 ;; "IFNOTEQ") MODE="ifeq" _IF_BOOL=0 ;; "IFEQVAL") MODE="ifeqval" _IF_BOOL=1 ;; "IFNOTEQVAL") MODE="ifeqval" _IF_BOOL=0 ;; "IFAND") MODE="ifand" _IF_BOOL=1 ;; "IFNOTAND") MODE="ifand" _IF_BOOL=0 ;; "IFOR") MODE="ifor" _IF_BOOL=1 ;; "IFNOTOR") MODE="ifor" _IF_BOOL=0 ;; "NOT") MODE="not" _NOT=1 ;; "DIE"|"DIEIF") MODE="die" _DIE_BOOL=1 ;; "DIENOT"|"DIEIFNOT") MODE="die" _DIE_BOOL=0 ;; "DIENOW") MODE="die" _DIE_VAR=undefined_variable _DIE_BOOL=0 ;; "CHKVER!"|"CHECK_VERSION!"|"CHKVER"|"CHECK_VERSION") enter_mode "chkver" ${STR} ;; "USE_DL") if [ "${_USE_DL_USED}" = 0 ]; then MODE="usedl" _USE_DL_USED=`word` else echo "`word` | ignored twice USE_DL found at ${_USE_DL_USED}." >&2 fi ;; "EXEC") MODE="exec" ;; "EXEC!") MODE="exec!" ;; "USE_ICONV") MODE="useiconv" ;; "ARG_WITH") if [ $NKEYS -gt 0 ]; then echo "cant use ARG_WITH inside bracket blocks" >&2 exit 1 fi MODE="argument" ARGUMENT=with ;; "ARG_WITHOUT") if [ $NKEYS -gt 0 ]; then echo "cant use ARG_WITHOUT inside bracket blocks" >&2 exit 1 fi MODE="argument" ARGUMENT=without ;; "ARG_ENABLE") if [ $NKEYS -gt 0 ]; then echo "cant use ARG_ENABLE inside bracket blocks" >&2 exit 1 fi MODE="argument" ARGUMENT=enable ;; "ARG_DISABLE") if [ $NKEYS -gt 0 ]; then echo "cant use ARG_DISABLE inside bracket blocks" >&2 exit 1 fi MODE="argument" ARGUMENT=disable ;; "CHKEXE" | "CHECK_EXEC") MODE="check_exec" ;; "CHECK") MODE="check" ;; "="|"+="|"?="|"<-") echo "The *old* format is deprecated." >&2 echo "Please use the standard format ." >&2 exit 1 ;; *) add_envword "$STR" SET_VAR=$STR ;; esac done # inner loop done if [ "${IS_KEYWORD}" = 1 ]; then echo "`word` | Unexpected end of file." >&2 exit 1 fi if [ -n "$MODE" ]; then echo "`word` | Unexpected end of file." >&2 exit 1 fi if [ "${COMMENT}" = 1 ]; then echo "`word` | Comment tag not closed." >&2 exit 1 fi # Final stage if [ "${MAKEFILE}" = 1 ]; then if [ -f Makefile.acr ]; then echo "ERROR: Makefile.acr already exists. Remove't manually." >&2 exit 1 fi if [ -z "${VERSION}" ]; then echo "ERROR: no VERSION defined." >&2 exit 1 fi if [ "${PKGNAME}" = "this package" ]; then echo "ERROR: no PKGNAME defined." >&2 exit 1 fi if [ $NKEYS -lt 0 ]; then echo "`word` < unexpected eof: unmatching final '}' key." >&2 exit 1 fi cat > Makefile.acr <> Makefile.acr echo "VERSION=@""VERSION@" >> Makefile.acr echo "INSTALL_DATA=@""INSTALL_DATA@" >> Makefile.acr echo "INSTALL_PROGRAM=@""INSTALL_PROGRAM@" >> Makefile.acr echo "INSTALL_PROGRAM_STRIP=@""INSTALL_PROGRAM_STRIP@" >> Makefile.acr if [ "${LANG_JAVA}" = 1 ]; then cat >> Makefile.acr <> Makefile.acr <> Makefile.acr <> Makefile.acr <> Makefile.acr <> Makefile.acr echo "all:" >> Makefile.acr for A in ${SD_FILES} ; do if [ ! "${A}" = "." ]; then printf "\tcd ${A} && ${S}{MAKE}\n" >> Makefile.acr fi done echo "" >> Makefile.acr echo "install:" >> Makefile.acr for A in ${SD_FILES} ; do if [ ! "${A}" = "." ]; then printf "\tcd ${A} && ${S}{MAKE} install\n" >> Makefile.acr fi done cat >> Makefile.acr << EOF clean: EOF for A in ${SD_FILES} ; do if [ ! "${A}" = "." ]; then printf "\tcd ${A} && ${S}{MAKE} clean\n" >> Makefile.acr fi done if [ "${USE_BACKUP}" = 1 ]; then for A in ${S_FILES}; do printf "\t${S}(call unsubst,${A})\n" >> Makefile.acr done else for A in ${S_FILES}; do printf "\tmv -f ${A}.orig ${A}\n" >> Makefile.acr done fi if [ "${H_FILES}" ]; then printf "\trm -f ${H_FILES}\n" >> Makefile.acr fi if [ "${SH_FILES}" ]; then printf "\trm -f ${SH_FILES}\n" >> Makefile.acr fi cat >> Makefile.acr <&2 else if [ "${PBAR}" = 1 ]; then echo >&2 ; fi create_script if [ $NKEYS -lt 0 ]; then echo "`word` < unexpected eof: unmatching '}' key." >&2 exit 1 fi show_report if [ "${NOPE}" = 0 ]; then echo "acr: ${CONFIGURE} script created successfully." >&2 fi fi makedist_failed() { echo "ERROR: $1" >&2 exit 1 } if [ "${MAKEDIST}" = 1 ]; then if [ -z "$PKGNAME" ]; then makedist_failed "PKGNAME not defined" fi if [ -z "$VERSION" ]; then VERSION=`date +%Y%m%d` echo "VERSION not defined. Using current date" >&2 fi # if ( basename `pwd` != $PKGNAME ) { failed!! } DIRNAME="`expr $PWD : '.*\/\(.*\)$'`" if [ ! "$DIRNAME" = "$PKGNAME" ]; then makedist_failed "Invalid directory name '$DIRNAME' must be '$PKGNAME'." >&2 fi ## echo "[2/4] Running configure." >&2 ./configure 2>&1 | ${AWK} '{ printf "."; }' >&2 echo >&2 if [ ! -e "Makefile.acr" ]; then makedist_failed "No Makefile.acr found in current directory. Cannot clean" fi echo "[3/4] Cleaning (make clean)" >&2 make clean 2>&1 | ${AWK} '{ printf "."; }' >&2 echo >&2 echo "[4/4] Disting project into a tarball." >&2 P=${PKGNAME}-${VERSION} if [ -d .hg ]; then rm -rf .tmp >&2 mkdir -p .tmp >&2 hg clone . .tmp/${P} >&2 rm -rf .tmp/${P}/.hg cd .tmp/ tar czvf ../${P}.tar.gz $P 2>&1 | ${AWK} '{ printf "."; }' >&2 rm -rf .tmp elif [ -d .git ]; then rm -rf .tmp >&2 mkdir -p .tmp >&2 git clone . .tmp/${P} >&2 rm -rf .tmp/${P}/.git cd .tmp/ tar czvf ../${P}.tar.gz $P 2>&1 | ${AWK} '{ printf "."; }' >&2 rm -rf .tmp elif [ -d .svn ]; then URL=$(svn info| grep URL|cut -d : -f 2-) rm -rf .tmp >&2 mkdir -p .tmp >&2 cd .tmp svn co ${URL} ${P} rm -rf ${P}/.svn tar czvf ../${P}.tar.gz $P 2>&1 | ${AWK} '{ printf "."; }' >&2 rm -rf .tmp else cd .. mv $PKGNAME $PKGNAME-$VERSION tar czvf $PKGNAME-$VERSION.tar.gz $PKGNAME-$VERSION 2>&1 | ${AWK} '{ printf "."; }' >&2 if [ ! $? = 0 ]; then mv $PKGNAME-$VERSION $PKGNAME makedist_failed "Cannot create ../$PKGNAME-$VERSION" fi mv $PKGNAME-$VERSION $PKGNAME cd - mv ../$PKGNAME-$VERSION.tar.gz . fi echo >&2 echo "Tarball created successfully at $PKGNAME-$VERSION.tar.gz" >&2 fi # vim:set foldmethod=marker acr-2.2.0/src/acr-wrap000077500000000000000000000027371475143313200145250ustar00rootroot00000000000000#!/bin/sh # convert meson wrap files into makefiles for compatibility reasons F="$1" if [ -z "$F" ]; then echo "Usage: acr-wrap foo.wrap > foo.mk" exit 1 fi ( echo "# This file is autogenerated by acr-wrap" echo NAME="" while : ; do read LINE [ $? != 0 ] && break echo "$LINE" | grep -q = if [ $? = 0 ]; then if [ -z "${NAME}" ]; then echo "malformed" break fi echo ${LINE} |grep '^#' && continue LINE=`echo "$LINE"|sed -e 's, ,,g'` echo "WRAP_${NAME}_${LINE}" | sed -e 's/=/:=/g' eval "export WRAP_${LINE}" else echo "$LINE" | grep -q '^\[' if [ $? = 0 ]; then NAME=$(echo "$LINE" |sed -e 's,-,_,g' -e 's,\[,,g' -e 's,\],,g') fi fi done WRAP_name=`echo ${WRAP_directory}|sed -e 's/-/-/g'` cat < # # acr is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # acr is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with acr; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # #=========================================================================== # # AMR : Auto Make Replacement # @author: pancake@nopcode.org VERSION="0.2" NESTED=0 S=\$ show_usage() { cat < configure.amr DIRS=\`amr -d\` echo "Source directories: ${S}{DIRS}" for A in ${S}{DIRS}; do echo " - ${S}{A}" (cd ${S}{A} && amr -a > configure.amr) done echo "Generating configure.acr..." amr -c > configure.acr echo "Generating final configure script..." acr -p EOF exit 0 } case "$1" in "-g") autogen_sh ;; "-a") AMR="gen-configure" ;; "-m") AMR="gen-makefile" ;; "-c") AMR="gen-acr" ;; "-r") AMR="show-report" ;; "-s") AMR="gen-shellscript" ;; "-d") AMR="print-dirs" ;; "-w") echo "Write output to the proper file" ;; "-v") echo "amr: version ${VERSION}" exit 0 ;; ""|"-h") show_usage 0 ;; *) show_usage 1 ;; esac CSOURCES="" CDEPS_VARS="" CDIRS="" CDIR="" COLDIR="" CDEPS_VAR_IS_DEFINED=0 CINCLUDES="" _MODE=0 _COMMENT=0 check_cidep() { FILE=$1 for A in $CINCLUDES ; do [ "$A" = "$FILE" ] && return done echo "CInclude ${FILE} not found" >&2 exit 1 } check_cdep() { FILE=$1 for A in $CSOURCES ; do [ "$A" = "$FILE" ] && return done echo "CSource ${FILE} not found" >&2 exit 1 } # Check if we're in the root. MYDIR=${PWD} RTDIR=${PWD} NESTED=0 while : ; do cd .. if [ -e "configure.amr" ]; then RTDIR=${PWD} NESTED=1 break fi [ "${PWD}" = "/" ] && break done cd ${RTDIR} PKGNAME=`basename ${PWD}` cd ${MYDIR} if [ "gen-configure" = "$AMR" ]; then FILES=`find . -type f -name "*.c"` for A in $FILES ; do case "$A" in *c$) CDIR="`echo $A| awk -F / '{ for(i=1;i,,' | cut -d \ -f 2` for INC in ${_INCLUDES}; do if [ -z "`echo ${CINCLUDES} | grep ${INC}`" ]; then CINCLUDES="${CINCLUDES} ${INC}" fi done ;; *) esac done COLDIR=$CDIRS echo "## sample configure.amr ##" for A in $CDIRS ; do CDIR=$A echo "CDIR $CDIR" [ ! "${CDIR}" = "./" ] && continue echo CFILES="" for B in $CSOURCES; do FILE="`echo $CDIR $B | awk '{print substr($2,length($1)+1); }'`" CFILES="${CFILES} ${FILE}" done [ "${CFILES}" ] && echo "CSOURCES ${CFILES} ;" HFILES="" HFILES=`find . | grep \.h | sed -e 's,\./,,'` #for B in ${CINCLUDES}; do # FILE="`echo $CDIR $B | awk '{print substr($2,length($1)+1); }'`" # FILE="`echo $CDIR $B | awk '{print substr($2,length($1)+1); }'`" # HFILES="${HFILES} ${FILE}" #done echo "CINCLUDES ${CINCLUDES} ;" echo for B in $HFILES ; do STR="" for C in $CFILES ; do if [ -n "`cat ${CDIR}/$C | grep '#include "' | grep $B`" ]; then STR="${STR} ${C}" fi done [ -n "${STR}" ] && echo "CDEPS ${B}${STR} ;" done done exit 0 fi if [ ! -e "configure.amr" ]; then echo "amr: 'configure.amr' file not found. Use 'amr -a > configure.amr' first." exit 1 fi parse_configure_amr() { FILE=$1 echo "Parsing ${FILE}..." >&2 CONFIGURE_AMR="`cat ${FILE} 2>/dev/null`" for A in $CONFIGURE_AMR ; do # TODO: Support for oneline commands and /* */ # COMMENT if [ "$A" = "##" ]; then if [ "$_COMMENT" = 0 ]; then _COMMENT=1 ; else _COMMENT=0; fi fi [ "${_COMMENT}" = 1 ] && continue case "$A" in "##") ;; "CSOURCES") _MODE=csources ;; "CINCLUDES") _MODE=cincludes ;; "CDEPS") _MODE=cdeps ;; "CDIR") _MODE=cdir ;; *) case "${_MODE}" in "csources") if [ ";" = "$A" ]; then _MODE=0 ; continue ; fi CSOURCES="${CSOURCES} ${CDIR}/${A}" COBJECTS="${COBJECTS} `echo ${CDIR}/${A} | sed -e 's,\.c,\.o,g'`" ;; "cdir") CDIR=$A _MODE=0 ;; "cincludes") if [ ";" = "$A" ]; then _MODE=0 ; continue ; fi CINCLUDES="${CINCLUDES} ${A}" ;; "cdeps") if [ ";" = "$A" ]; then _MODE=0 ; CDEPS_VAR_IS_DEFINED=0 ; continue ; fi if [ "${CDEPS_VAR_IS_DEFINED}" = 0 ]; then CDEPS_VAR="`echo ${CDIR}/${A} | sed -e 's,^\.,,' -e 's,//,/,g' -e 's,\.,_,g' -e 's,/,_,g'`" CDEPS_VARS="${CDEPS_VARS} ${CDEPS_VAR}" CDEPS_VAR_IS_DEFINED=1 continue fi check_cdep "${CDIR}/$A" eval "${CDEPS_VAR}=\"\$${CDEPS_VAR} ${A}\"" ;; *|0) echo "Invalid keyword '$A'" >&2 exit 1 ;; esac ;; esac done } parse_configure_amr "configure.amr" COBJECTS=`echo ${COBJECTS} | sed -e 's,\.//,,g'` case "$AMR" in "gen-makefile") echo "## Sample Makefile.acr ##" echo "VPATH=@VPATH@" if [ -n "${CSOURCES}" ]; then echo "CC=@CC@" echo "CFLAGS=@CFLAGS@" echo "LDFLAGS=@LDFLAGS@" fi # TODO: handle multiple subdirectories if [ "${CDIR}" = "./" ]; then echo "OBJ=${COBJECTS}" echo "BIN=@PKGNAME@" echo "VERSION=@VERSION@" echo echo "all: \${OBJ}" echo " \${CC} \${LDFLAGS} \${OBJ} -o \${BIN}" echo for A in ${COBJECTS}; do CFILE="`echo ${A} | sed -e 's,\.o,\.c,g'`" DEPS=`cat ${CFILE} | grep '#include "' | sed -e 's,",,g' | cut -d \ -f 2` DEPS="${CFILE} $(echo $DEPS)" echo "${A}: ${DEPS}" | sed -e 's,//,/,g' printf "\t \${CC} \${CFLAGS} -c -o ${A} $<" echo echo done echo "clean:" echo " -rm -f \${OBJ} \${BIN}" echo echo "mrproper:" echo " -rm -f Makefile" else echo echo "all:" echo " cd ${CDIR} && ${S}{MAKE} all" echo echo "install:" echo " cd ${CDIR} && ${S}{MAKE} install" echo echo "clean:" echo " cd ${CDIR} && ${S}{MAKE} clean" echo echo "mrproper:" echo " cd ${CDIR} && ${S}{MAKE} mrproper" echo echo "dist: mrproper" echo " cd .. && mv ${S}{PKGNAME}-${S}{VERSION}" echo " -cd .. && tar czvf ${S}{PKGNAME}-${S}{VERSION}.tar.gz \\" echo " \`find ${S}{PKGNAME}-${S}{VERSION} -type f|grep -v git\`" echo " cd .. && mv ${S}{PKGNAME}-${S}{VERSION} ${S}{PKGNAME}" echo fi ;; "print-dirs") echo $CDIR ;; "gen-acr") # Recursive parse configure.acr CDIR_ORIG=${CDIR} for A in ${CDIR}; do parse_configure_amr "${A}/configure.amr" done CDIR=${CDIR_ORIG} echo "## sample configure.acr ##" if [ "${NESTED}" = 0 ]; then echo "PKGNAME ${PKGNAME}" echo "VERSION 0.1" # TODO echo "CONTACT your name ; your@email" # TODO echo fi [ -n "${CSOURCES}" ] && echo "LANG_C!" echo for A in ${CINCLUDES} ; do echo "CHKINC! ${A}" done echo SFILES=`find .| grep acr| grep -v Makefile| grep -v configure | sed -e 's,\.acr,,g'` echo "SUBDIRS . ${CDIR} ${SFILES} ;" ;; "gen-shellscript") ;; "show-report") echo "CSOURCES = ${CSOURCES}" echo "CINCLUDES = ${CINCLUDES}" echo "CDEPS_VARS = ${CDEPS_VARS}" S="\$" for A in ${CDEPS_VARS} ; do echo "-. $A" for B in `eval echo ${S}${A}`;do echo " |- $B" done done ;; esac # if [ main.h > main.o ]; then # rm -f main.o usage.o engine.o # fi acr-2.2.0/src/vim/000077500000000000000000000000001475143313200136455ustar00rootroot00000000000000acr-2.2.0/src/vim/ftplugin/000077500000000000000000000000001475143313200154755ustar00rootroot00000000000000acr-2.2.0/src/vim/ftplugin/acr.vim000066400000000000000000000001451475143313200167570ustar00rootroot00000000000000" acr syntax plugin for vim " " @author: pancake source ~/.vim/syntax/acr.vim acr-2.2.0/src/vim/install.sh.acr000066400000000000000000000020751475143313200164170ustar00rootroot00000000000000#!/bin/sh # # syntax highlighting for acr files in vim. # # author: pancake # DATADIR=@DATADIR@ mkdir -p ~/.vim/syntax ~/.vim/ftplugin if [ $? = 1 ]; then echo "Cannot create vim directoryes at \$HOME" exit 1 fi cp -f ${DATADIR}/acr/vim/ftplugin/acr.vim ~/.vim/ftplugin/acr.vim cp -f ${DATADIR}/acr/vim/syntax/acr.vim ~/.vim/syntax/acr.vim if [ "$1" = "-f" ]; then if [ -e ~/.vimrc ]; then mv ~/.vimrc ~/.vimrc.orig cat ~/.vimrc.orig | grep -v "source ~/.vim/acr" > ~/.vimrc echo "Original .vimrc stored in ~/.vimrc.orig" fi else if [ -e ~/.vimrc ]; then if [ -n "`cat ~/.vimrc | grep acr | grep source`" ]; then echo "Failed: It looks that your have already acr syntax highlighting." echo "If you want to force installation remove the acr related line in ~/.vimrc" echo "This operation can be forced (-f), but may modify your ~/.vimrc (DANGEROUS)" exit 1 fi fi ; fi mkdir -p ~/.vim/ cp -f ${DATADIR}/acr/vim/vimrc ~/.vim/acr echo "source ~/.vim/acr" >> ~/.vimrc echo "Success: acr syntax highlighting for vim installed at \${HOME}." exit 0 acr-2.2.0/src/vim/syntax/000077500000000000000000000000001475143313200151735ustar00rootroot00000000000000acr-2.2.0/src/vim/syntax/acr.vim000066400000000000000000000054331475143313200164620ustar00rootroot00000000000000" acr syntax plugin for vim " " @author: pancake if exists("b:current_syntax") finish endif syn case ignore syn keyword acrContact PKGNAME VERSION CONTACT AUTHOR DESC DESCRIPTION syn keyword acrDirective EXPORT_DEFINED NOP syn keyword acrDirective REQUIRE_ACR_VERSION syn keyword acrLanguage LANG_LUA LANG_C LANG_CC LANG_OBJC LANG_CXX LANG_BASH LANG_TCL LANG_PERL syn keyword acrLanguage LANG_JAVA LANG_PYTHON LANG_RUBY LANG_VALA syn keyword acrKeyword CHKPRG CHECK_PROGRAM syn keyword acrKeyword CHKINC CHECK_INCLUDE syn keyword acrKeyword CHKFNC CHECK_FUNCTION syn keyword acrKeyword ENDIAN CHECK_ENDIAN SIZEOF syn keyword acrKeyword INCLUDE syn keyword acrKeyword CHECK CHECK_EXEC syn keyword acrKeyword CHK_PM CHECK_PERL_MODULE syn keyword acrKeyword CHK_PY CHECK_PYTHON_MODULE syn keyword acrKeyword CHK_RU CHECK_RUBY_MODULE syn keyword acrKeyword CHK_CP CHECK_CLASSPATH syn keyword acrKeyword CHKVER CHECK_VERSION syn keyword acrKeyword CHKLIB CHECK_LIB syn keyword acrKeyword USE_DL USE_ICONV USE_PTHREAD USE_LIBTOOL syn keyword acrKeyword USE_PERL_THREADS USE_X11 USE_TK USE_GMAKE USE_JNI syn keyword acrKeyword PKGCONFIG PKGCFG VALAPKG EXEC PKGCFG_DO syn keyword acrKeyword SUBDIRS SUBST_FILES syn keyword acrKeyword IF IFNOT IFAND IFNOTAND IFEQ IFNOTEQ IFEQVAL IFOR IFNOTOR IFNOTEQVAL syn keyword acrKeyword IFNULL IFNOTNULL DIE syn keyword acrKeyword DIENOT DIENOW syn keyword acrKeyword ARG_WITH ARG_WITHOUT ARG_ENABLE ARG_DISABLE syn keyword acrOutput EXPORT OUTPUT_H OUTPUT_SH SUBST syn keyword acrOutput SUBST_FILES SUBDIRS SUBCONF REPORT syn match acrOperator "=" syn match acrOperator "+=" syn match acrOperator "?=" syn match acrOperator "<-" syn keyword acrTodo TODO FIXME XXX NOTE "syn region acrTag start="@" end="@" # TODO syn region acrComment start="//" skip="\\$" end="$" keepend syn region acrComment start="/\*" end="\*/" contains=acrTodo syn region acrComment start="((" end="))" contains=acrTodo syn region acrComment start="##" end="##" contains=acrTodo "syn region acrComment start="//" end="\\" contains=acrTodo syn region acrOutput start="<" # may help ? syn match acrSeparator ";" syn match acrSeparator "{" syn match acrSeparator "}" syn match acrSeparator "}{" syn match acrSeparator "}ELSE{" syn match acrError "<=" syn match acrMark "\$[a-zA-Z]*" syn sync ccomment acrComment command -nargs=+ HiLink hi def link HiLink acrSpecial Number HiLink acrContact Special HiLink acrKeyword Type HiLink acrLanguage acrKeyword HiLink acrOperator Type HiLink acrDirective String HiLink acrTodo Todo HiLink acrComment Comment HiLink acrKeyword Repeat HiLink acrOutput Number HiLink acrSeparator Macro HiLink acrError Error HiLink acrMark Function delcommand HiLink let b:current_syntax = "acr" acr-2.2.0/src/vim/vimrc000066400000000000000000000002501475143313200147050ustar00rootroot00000000000000" acr syntax plugin for vim " " @author: pancake sy on filetype plugin on filetype plugin indent off au BufRead,BufNewFile *.acr setfiletype acr acr-2.2.0/tests/000077500000000000000000000000001475143313200134255ustar00rootroot00000000000000acr-2.2.0/tests/Makefile000066400000000000000000000000211475143313200150560ustar00rootroot00000000000000all: sh test.sh acr-2.2.0/tests/bug-eof.acr000066400000000000000000000000071475143313200154350ustar00rootroot00000000000000REPORT acr-2.2.0/tests/test-triplet.sh000077500000000000000000000023531475143313200164270ustar00rootroot00000000000000#!/bin/sh split_host() { S="$" while : ; do ENVWORDS="${ENVWORDS} $1_CPU $1_OS" STR=`eval "echo ${S}$1"` SPLIT_CPU="`echo "$STR" | cut -d - -f 1`" SPLIT_OS="`echo "$STR" | awk -F - '{ if ($2=="unknown"){ if (NF<3) { print $2; } else { print $3; } } else { if ($2=="linux") { print $2; } else if (NF<3) { print $2; } else { print $3; } } }'`" eval "$1_CPU=\"$SPLIT_CPU\"" eval "$1_OS=\"$SPLIT_OS\"" shift [ -z "$1" ] && break done } test () { HOST="$1" split_host HOST echo ${HOST} # echo HOST_OS=$HOST_OS # echo HOST_CPU=$HOST_CPU if [ "${HOST_OS}" != "$2" ]; then echo " OS FAIL - $HOST_OS vs $2" fi if [ "${HOST_CPU}" != "$3" ]; then echo " CPU FAIL - $HOST_CPU vs $3" fi } # TRIPLETS ARE # UNAME=`uname | tr '[A-Z]' '[a-z]'` test i386-unknown-openbsd openbsd i386 test amd64-unknown-openbsd openbsd amd64 test x86_64-unknown-linux-gnu linux x86_64 test arm-foo-linux-gnueabihf linux arm #test openbsd-unknown-i386 openbsd i386 test x86_64-unknown-darwin darwin x86_64 test i686-pc-linux-gnu linux i686 test m68k-coff $UNAME m68k test alpha-netbsd netbsd alpha test i686-pc-mingw32 mingw32 i686 test m68k-apple-macos macos m68k test x86_64-w64-mingw32 mingw32 x86_64 test arm-linux-gnueabihf linux arm acr-2.2.0/tests/test.sh000077500000000000000000000016401475143313200147440ustar00rootroot00000000000000#!/bin/sh print_report() { echo if [ "${ERROR}" = 0 ]; then echo "OK: All tests has passed fine" else echo "ERROR: $ERROR/$COUNT tests has failed." fi exit ${ERROR} } do_remove() { rm -f `ls | egrep -v "test.sh|Makefile"` } control_c() { printf "\n\n^C control-c : script execution interrupted.\n" do_remove print_report exit 1 } trap control_c 2 PATH=${PWD}/../src:${PATH} chmod +x ../src/acr ../src/acr-sh ERROR=0 COUNT=0 if [ -z "$@" ]; then FILES=`ls ../examples/*.acr` else FILES=$@ fi for A in ${FILES} ; do if [ ! -e "${A}" ]; then echo "[*] error: cannot find ${A}" continue fi echo "[*] generating ${A}" cp "${A}" configure.acr acr > /dev/null if [ "$?" = "0" ]; then echo "[>] executing ${A}" ./configure 2> /dev/null > /dev/null echo else echo "[FAILED]" acr > /dev/null ERROR=$(($ERROR+1)) fi COUNT=$(($COUNT+1)) rm configure.acr done do_remove print_report