├── .auto-changelog
├── .github
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── DISCUSSION_TEMPLATE
│ ├── development.yml
│ └── help.yml
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug-report.yml
│ ├── config.yml
│ └── feature-request.yml
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ └── codeql.yml
├── .gitignore
├── AUTHORS
├── INSTALL.md
├── LICENSE
├── MagickCache
├── MagickCache-config.in
├── MagickCache.h
├── MagickCache.pc.in
├── Makefile.am
├── Makefile.in
├── magick-cache-private.h
├── magick-cache.c
├── version.c
└── version.h.in
├── Makefile.am
├── Makefile.in
├── README.md
├── SECURITY.md
├── aclocal.m4
├── compile
├── config.guess
├── config.h.in
├── config.sub
├── config
└── configure.xml.in
├── configure
├── configure.ac
├── depcomp
├── install-sh
├── ltmain.sh
├── m4
└── version.m4
├── missing
├── test-driver
├── tests
├── Makefile.am
├── Makefile.in
└── magick-cache.c
└── utilities
├── Makefile.am
├── Makefile.in
├── magick-cache.1.in
└── magick-cache.c
/.auto-changelog:
--------------------------------------------------------------------------------
1 | {
2 | "output": "ChangeLog.md",
3 | "template": "keepachangelog",
4 | "unreleased": false,
5 | "commitLimit": false,
6 | "startingVersion": "0.1.0-0",
7 | "hideCredit": true
8 | }
9 |
--------------------------------------------------------------------------------
/.github/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # ImageMagick Code of Conduct
2 |
3 | Strive to give back to the ImageMagick community more than you take and be excellent to each other.
4 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to contribute to MagickCache
2 |
3 | #### **Did you find a bug?**
4 |
5 | - Please ensure the bug was not already reported by searching our [issues](https://github.com/ImageMagick/MagickCache/issues).
6 | - If you're unable to find an open issue addressing the problem, please [open a new one](https://github.com/ImageMagick/MagickCache/issues/new).
7 | Be sure to follow the instructions in the issue template.
8 |
9 | #### **Did you write a patch that fixes a bug?**
10 |
11 | - Open a new pull request with the patch and follow the instructions from the pull request template.
12 | - Before submitting, please ensure that your code matches the existing coding patterns and practise as demonstrated in the repository.
13 | - Once the pull request has been accepted for the master branch, please submit another patch for the
14 |
15 | #### **Do you intend to add a new feature?**
16 |
17 | - Join the ImageMagick community [discussions](https://github.com/ImageMagick/MagickCache/discussions), suggest your change there and start writing code.
18 |
19 | #### **Do you want to change something in the `www` folder?**
20 |
21 | - Please submit a pull request in our [website repository](https://github.com/MagickCache/Website) instead.
22 |
23 | If you cannot help us by writing code, then take a look at the other ways you could [help](https://imagemagick.org/script/support.php) the ImageMagick team.
24 |
25 | \- The Wizards
26 |
--------------------------------------------------------------------------------
/.github/DISCUSSION_TEMPLATE/development.yml:
--------------------------------------------------------------------------------
1 | body:
2 | - type: input
3 | attributes:
4 | label: MagickCache version
5 | placeholder: 1.X.X-X
6 | validations:
7 | required: true
8 | - type: input
9 | attributes:
10 | label: Operating system, version and so on
11 | validations:
12 | required: true
13 | - type: textarea
14 | attributes:
15 | label: Description
16 | validations:
17 | required: true
18 |
--------------------------------------------------------------------------------
/.github/DISCUSSION_TEMPLATE/help.yml:
--------------------------------------------------------------------------------
1 | body:
2 | - type: input
3 | attributes:
4 | label: MagickCache version
5 | placeholder: 1.X.X-X
6 | validations:
7 | required: true
8 | - type: input
9 | attributes:
10 | label: Operating system, version and so on
11 | validations:
12 | required: true
13 | - type: textarea
14 | attributes:
15 | label: Description
16 | validations:
17 | required: true
18 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: ImageMagick
2 | custom: https://imagemagick.org/script/support.php
3 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug-report.yml:
--------------------------------------------------------------------------------
1 | name: Bug report
2 | description: Create a report to help us improve
3 | body:
4 | - type: input
5 | attributes:
6 | label: MagickCache version
7 | placeholder: 1.X.X-X
8 | validations:
9 | required: true
10 | - type: dropdown
11 | attributes:
12 | label: Operating system
13 | options:
14 | - Linux
15 | - Windows
16 | - MacOS
17 | - Other (enter below)
18 | validations:
19 | required: true
20 | - type: input
21 | attributes:
22 | label: Operating system, version and so on
23 | validations:
24 | required: true
25 | - type: textarea
26 | attributes:
27 | label: Description
28 | description: A description of the bug or feature.
29 | validations:
30 | required: true
31 | - type: textarea
32 | attributes:
33 | label: Steps to Reproduce
34 | description: List of steps, sample code, failing test or link to a project that reproduces the behavior. Make sure you place a stack trace inside a code (```) block to avoid linking unrelated issues.
35 | validations:
36 | required: true
37 | - type: textarea
38 | attributes:
39 | label: Images
40 | description: Please upload images that can be used to reproduce issues in the area below. If the file type is not supported the file can be zipped and then uploaded instead.
41 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Ask question
4 | url: https://github.com/ImageMagick/MagickCache/discussions/category_choices
5 | about: Ask a question about this project.
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature-request.yml:
--------------------------------------------------------------------------------
1 | name: Feature request
2 | description: Suggest an idea for this project
3 | body:
4 | - type: textarea
5 | attributes:
6 | label: Is your feature request related to a problem? Please describe.
7 | description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
8 | - type: textarea
9 | attributes:
10 | label: Describe the solution you'd like
11 | description: A clear and concise description of what you want to happen.
12 | validations:
13 | required: true
14 | - type: textarea
15 | attributes:
16 | label: Describe alternatives you've considered
17 | description: A clear and concise description of any alternative solutions or features you've considered.
18 | - type: textarea
19 | attributes:
20 | label: Additional context
21 | description: Add any other context or screenshots about the feature request here.
22 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Prerequisites
2 |
3 | - [ ] I have written a descriptive pull-request title
4 | - [ ] I have verified that there are no overlapping [pull-requests](https://github.com/ImageMagick/MagickCache/pulls) open
5 | - [ ] I have verified that I am following the existing coding patterns and practices as demonstrated in the repository.
6 |
7 | ### Description
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ "main" ]
17 | pull_request:
18 | branches: [ "main" ]
19 | schedule:
20 | - cron: '19 15 * * 5'
21 |
22 | jobs:
23 | analyze:
24 | name: Analyze
25 | # Runner size impacts CodeQL analysis time. To learn more, please see:
26 | # - https://gh.io/recommended-hardware-resources-for-running-codeql
27 | # - https://gh.io/supported-runners-and-hardware-resources
28 | # - https://gh.io/using-larger-runners
29 | # Consider using larger runners for possible analysis time improvements.
30 | runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31 | timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
32 | permissions:
33 | # required for all workflows
34 | security-events: write
35 |
36 | # only required for workflows in private repositories
37 | actions: read
38 | contents: read
39 |
40 | strategy:
41 | fail-fast: false
42 | matrix:
43 | language: [ 'c-cpp' ]
44 | # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
45 | # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
46 | # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
47 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
48 |
49 | steps:
50 | - name: Checkout repository
51 | uses: actions/checkout@v4
52 |
53 | - name: Configure MagickCache
54 | run: |
55 | sudo dpkg --purge --force-all imagemagick
56 | wget 'https://dist.1-2.dev/imei.sh' -qO imv7.sh && sudo bash imv7.sh --skip-dependencies
57 | autoreconf --force --install
58 | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
59 | ./configure
60 | echo "" > config.status
61 |
62 | # Initializes the CodeQL tools for scanning.
63 | - name: Initialize CodeQL
64 | uses: github/codeql-action/init@v3
65 | with:
66 | languages: ${{ matrix.language }}
67 | # If you wish to specify custom queries, you can do so here or in a config file.
68 | # By default, queries listed here will override any specified in a config file.
69 | # Prefix the list here with "+" to use these queries and those in the config file.
70 |
71 | # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
72 | # queries: security-extended,security-and-quality
73 |
74 |
75 | # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
76 | # If this step fails, then you should remove it and run the build manually (see below)
77 | - name: Autobuild
78 | uses: github/codeql-action/autobuild@v3
79 |
80 | # ℹ️ Command-line programs to run using the OS shell.
81 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
82 |
83 | # If the Autobuild fails above, remove it and uncomment the following three lines.
84 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
85 |
86 | # - run: |
87 | # echo "Run, Build Application using script"
88 | # ./location_of_script_within_repo/buildscript.sh
89 |
90 | - name: Perform CodeQL Analysis
91 | uses: github/codeql-action/analyze@v3
92 | with:
93 | category: "/language:${{matrix.language}}"
94 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Object files
5 | *.o
6 | *.ko
7 | *.obj
8 | *.elf
9 |
10 | # Linker output
11 | *.ilk
12 | *.map
13 | *.exp
14 |
15 | # Precompiled Headers
16 | *.gch
17 | *.pch
18 |
19 | # Libraries
20 | *.lib
21 | *.a
22 | *.la
23 | *.lo
24 |
25 | # Shared objects (inc. Windows DLLs)
26 | *.dll
27 | *.so
28 | *.so.*
29 | *.dylib
30 |
31 | # Executables
32 | *.exe
33 | *.out
34 | *.app
35 | *.i*86
36 | *.x86_64
37 | *.hex
38 |
39 | # Debug files
40 | *.dSYM/
41 | *.su
42 | *.idb
43 | *.pdb
44 |
45 | # Kernel Module Compile Results
46 | *.mod*
47 | *.cmd
48 | .tmp_versions/
49 | modules.order
50 | Module.symvers
51 | Mkfile.old
52 | dkms.conf
53 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ImageMagick/MagickCache/f72836711f7f791ab9feb8ad065de49a31214bc2/AUTHORS
--------------------------------------------------------------------------------
/INSTALL.md:
--------------------------------------------------------------------------------
1 | # Install Magick Cache
2 |
3 | ## Prerequisites
4 |
5 | (ImageMagick)[https://imagemagick.org] version 7.0.11-14 or newer is required before you can download, configure, build, install, and utilize the magick cache.
6 |
7 | ## Download
8 |
9 | ```
10 | $ git clone -b main https://github.com/ImageMagick/MagickCache.git MagickCache-0.9.2
11 | ```
12 |
13 | ## Configure
14 |
15 | ```
16 | $ cd MagickCache-0.9.2
17 | $ ./configuee
18 | ```
19 |
20 | ## Build, Verify, and Install
21 |
22 | ```
23 | $ make
24 | $ make check
25 | $ make install
26 | ```
27 |
28 | ## Utilize the Cache
29 |
30 | See README.MD to utilize the put, get, and identify resources within the cache.
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | ImageMagick License
2 | https://imagemagick.org/script/license.php
3 |
4 | Before we get to the text of the license, lets just review what the license says in simple terms:
5 |
6 | It allows you to:
7 |
8 | * freely download and use ImageMagick software, in whole or in part, for personal, company internal, or commercial purposes;
9 | * use ImageMagick software in packages or distributions that you create;
10 | * link against a library under a different license;
11 | * link code under a different license against a library under this license;
12 | * merge code into a work under a different license;
13 | * extend patent grants to any code using code under this license;
14 | * and extend patent protection.
15 |
16 | It forbids you to:
17 |
18 | * redistribute any piece of ImageMagick-originated software without proper attribution;
19 | * use any marks owned by ImageMagick Studio LLC in any way that might state or imply that ImageMagick Studio LLC endorses your distribution;
20 | * use any marks owned by ImageMagick Studio LLC in any way that might state or imply that you created the ImageMagick software in question.
21 |
22 | It requires you to:
23 |
24 | * include a copy of the license in any redistribution you may make that includes ImageMagick software;
25 | * provide clear attribution to ImageMagick Studio LLC for any distributions that include ImageMagick software.
26 |
27 | It does not require you to:
28 |
29 | * include the source of the ImageMagick software itself, or of any modifications you may have made to it, in any redistribution you may assemble that includes it;
30 | * submit changes that you make to the software back to the ImageMagick Studio LLC (though such feedback is encouraged).
31 |
32 | A few other clarifications include:
33 |
34 | * ImageMagick is freely available without charge;
35 | * you may include ImageMagick on a DVD as long as you comply with the terms of the license;
36 | * you can give modified code away for free or sell it under the terms of the ImageMagick license or distribute the result under a different license, but you need to acknowledge the use of the ImageMagick software;
37 | * the license is compatible with the GPL V3.
38 | * when exporting the ImageMagick software, review its export classification.
39 |
40 | Terms and Conditions for Use, Reproduction, and Distribution
41 |
42 | The legally binding and authoritative terms and conditions for use, reproduction, and distribution of ImageMagick follow:
43 |
44 | Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization dedicated to making software imaging solutions freely available.
45 |
46 | 1. Definitions.
47 |
48 | License shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
49 |
50 | Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
51 |
52 | Legal Entity shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, control means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
53 |
54 | You (or Your) shall mean an individual or Legal Entity exercising permissions granted by this License.
55 |
56 | Source form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
57 |
58 | Object form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
59 |
60 | Work shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
61 |
62 | Derivative Works shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
63 |
64 | Contribution shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution.
65 |
66 | Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
67 |
68 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
69 |
70 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
71 |
72 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
73 |
74 | * You must give any other recipients of the Work or Derivative Works a copy of this License; and
75 | * You must cause any modified files to carry prominent notices stating that You changed the files; and
76 | * You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
77 | * If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
78 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
79 |
80 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
81 |
82 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
83 |
84 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
85 |
86 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
87 |
88 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
89 |
90 | How to Apply the License to your Work
91 |
92 | To apply the ImageMagick License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information (don't include the brackets). The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
93 |
94 | Copyright [yyyy] [name of copyright owner]
95 |
96 | Licensed under the ImageMagick License (the "License"); you may not use
97 | this file except in compliance with the License. You may obtain a copy
98 | of the License at
99 |
100 | https://imagemagick.org/script/license.php
101 |
102 | Unless required by applicable law or agreed to in writing, software
103 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
104 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
105 | License for the specific language governing permissions and limitations
106 | under the License.
107 |
--------------------------------------------------------------------------------
/MagickCache/MagickCache-config.in:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Configure options script for re-calling MagickCache compilation options
4 | # required to use the MagickCache library.
5 | #
6 |
7 | prefix=@prefix@
8 | exec_prefix=@exec_prefix@
9 | pkgconfigdir=@pkgconfigdir@
10 | export PKG_CONFIG_LIBDIR="${pkgconfigdir}"
11 |
12 | usage="\
13 | Usage: MagickCache-config [--cflags] [--cppflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version]"
14 |
15 | if test $# -eq 0; then
16 | echo "${usage}" 1>&2
17 | echo "Example: gcc \`MagickCache-config --cflags --cppflags\` -o core core.c \`MagickCache-config --ldflags --libs\`" 1>&2
18 | exit 1
19 | fi
20 |
21 | while test $# -gt 0; do
22 | case "$1" in
23 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
24 | *) optarg= ;;
25 | esac
26 | case $1 in
27 | --prefix=*)
28 | prefix=$optarg
29 | ;;
30 | --prefix)
31 | echo $prefix
32 | ;;
33 | --exec-prefix=*)
34 | exec_prefix=$optarg
35 | ;;
36 | --exec-prefix)
37 | echo $exec_prefix
38 | ;;
39 | --version)
40 | echo '@PACKAGE_VERSION@ Q@QUANTUM_DEPTH@ @MAGICK_HDRI@'
41 | ;;
42 | --cc)
43 | echo '@CC@'
44 | ;;
45 | --cflags)
46 | @PKG_CONFIG@ --cflags MagickCache-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@
47 | ;;
48 | --cxx)
49 | echo '@CXX@'
50 | ;;
51 | --cxxflags)
52 | @PKG_CONFIG@ --cflags MagickCache-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@
53 | ;;
54 | --cppflags)
55 | @PKG_CONFIG@ --cflags MagickCache-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@
56 | ;;
57 | --ldflags)
58 | @PKG_CONFIG@ --libs MagickCache-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@
59 | ;;
60 | --libs)
61 | @PKG_CONFIG@ --libs MagickCache-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@
62 | ;;
63 | --coder-path)
64 | echo "@CODER_PATH@"
65 | ;;
66 | --filter-path)
67 | echo "@FILTER_PATH@"
68 | ;;
69 | *)
70 | echo "${usage}" 1>&2
71 | exit 1
72 | ;;
73 | esac
74 | shift
75 | done
76 |
--------------------------------------------------------------------------------
/MagickCache/MagickCache.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 1999 ImageMagick Studio LLC, a non-profit organization
3 | dedicated to making software imaging solutions freely available.
4 |
5 | You may not use this file except in compliance with the License. You may
6 | obtain a copy of the License at
7 |
8 | https://imagemagick.org/script/license.php
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | /*
18 | The MagickCache provides secure methods and tools to cache images, image
19 | sequences, video, audio or metadata in a local folder. Any content is
20 | memory-mapped for efficient retrieval. Additional efficiences are possible
21 | by retrieving a portion of an image. Content can persist or you can assign
22 | a time-to-live (TTL) to automatically expire content when the TTL is
23 | exceeded. MagickCache supports virtually unlimited content upwards of
24 | billions of images making it suitable as a web image service.
25 | */
26 |
27 | #ifndef MAGICKCACHE_MAGICKCACHE_H
28 | #define MAGICKCACHE_MAGICKCACHE_H
29 |
30 | #include
31 | #include
32 | #include "MagickCache/version.h"
33 |
34 | #if defined(__cplusplus) || defined(c_plusplus)
35 | extern "C" {
36 | #endif
37 |
38 | typedef enum
39 | {
40 | UndefinedResourceType,
41 | BlobResourceType,
42 | ImageResourceType,
43 | MetaResourceType,
44 | WildResourceType
45 | } MagickCacheResourceType;
46 |
47 | typedef struct _MagickCache
48 | MagickCache;
49 |
50 | typedef struct _MagickCacheResource
51 | MagickCacheResource;
52 |
53 | extern MagickExport char
54 | *GetMagickCacheException(const MagickCache *,ExceptionType *),
55 | *GetMagickCacheResourceException(const MagickCacheResource *,ExceptionType *),
56 | *GetMagickCacheResourceIRI(const MagickCacheResource *),
57 | *GetMagickCacheResourceMeta(MagickCache *,MagickCacheResource *);
58 |
59 | extern MagickExport Image
60 | *GetMagickCacheResourceImage(MagickCache *cache,MagickCacheResource *,
61 | const char *);
62 |
63 | extern MagickExport MagickBooleanType
64 | ClearMagickCacheException(MagickCache *),
65 | ClearMagickCacheResource(MagickCacheResource *),
66 | CreateMagickCache(const char *,const StringInfo *),
67 | DeleteMagickCacheResource(MagickCache *,MagickCacheResource *),
68 | GetMagickCacheResource(MagickCache *,MagickCacheResource *),
69 | GetMagickCacheResourceID(MagickCache *,const size_t,char *),
70 | IdentifyMagickCacheResource(MagickCache *,MagickCacheResource *,FILE *),
71 | IsMagickCacheResourceExpired(MagickCache *,MagickCacheResource *),
72 | IterateMagickCacheResources(MagickCache *,const char *,const void *,
73 | MagickBooleanType (*callback)(MagickCache *,MagickCacheResource *,
74 | const void *)),
75 | PutMagickCacheResource(MagickCache *,MagickCacheResource *),
76 | PutMagickCacheResourceBlob(MagickCache *,MagickCacheResource *,const size_t,
77 | const void *),
78 | PutMagickCacheResourceImage(MagickCache *,MagickCacheResource *,
79 | const Image *),
80 | PutMagickCacheResourceMeta(MagickCache *,MagickCacheResource *,const char *),
81 | SetMagickCacheResourceIRI(MagickCache *,MagickCacheResource *,const char *),
82 | SetMagickCacheResourceVersion(MagickCacheResource *,const size_t);
83 |
84 | extern MagickExport MagickCache
85 | *AcquireMagickCache(const char *,const StringInfo *),
86 | *DestroyMagickCache(MagickCache *);
87 |
88 | extern MagickExport MagickCacheResource
89 | *AcquireMagickCacheResource(MagickCache *,const char *),
90 | *DestroyMagickCacheResource(MagickCacheResource *);
91 |
92 | extern MagickExport MagickCacheResourceType
93 | GetMagickCacheResourceType(const MagickCacheResource *);
94 |
95 | extern MagickExport size_t
96 | GetMagickCacheResourceExtent(const MagickCacheResource *),
97 | GetMagickCacheResourceVersion(const MagickCacheResource *);
98 |
99 | extern MagickExport time_t
100 | GetMagickCacheTimestamp(const MagickCache *),
101 | GetMagickCacheResourceTimestamp(const MagickCacheResource *),
102 | GetMagickCacheResourceTTL(const MagickCacheResource *);
103 |
104 | extern MagickExport void
105 | *GetMagickCacheResourceBlob(MagickCache *,MagickCacheResource *),
106 | GetMagickCacheResourceSize(const MagickCacheResource *,size_t *,size_t *),
107 | SetMagickCacheResourceTTL(MagickCacheResource *,const time_t);
108 |
109 | #if defined(__cplusplus) || defined(c_plusplus)
110 | }
111 | #endif
112 |
113 | #endif
114 |
--------------------------------------------------------------------------------
/MagickCache/MagickCache.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@prefix@
2 | exec_prefix=@exec_prefix@
3 | libdir=@libdir@
4 | includedir=@includedir@/MagickCache
5 | includearchdir=@includedir@/MagickCache
6 | libname=MagickCache
7 |
8 | Name: MagickCache
9 | Description: MagickCache - C API for MagickCache
10 | URL: https://github.com/ImageMagick/MagickCache
11 | Version: @PACKAGE_BASE_VERSION@
12 | Cflags: -I${includearchdir} -I${includedir} @MAGICKCACHE_PCFLAGS@
13 | Libs: -L${libdir} -l${libname}
14 | Libs.private: -L${libdir} -l${libname}
15 |
--------------------------------------------------------------------------------
/MagickCache/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CFLAGS = $(MAGICKCORE_CFLAGS)
2 |
3 | # The libraries to build
4 | lib_LTLIBRARIES = libMagickCache.la
5 |
6 | # install headers
7 | #
8 | pkginclude_HEADERS = MagickCache.h \
9 | version.h
10 |
11 | noinst_HEADERS = magick-cache-private.h
12 |
13 | pkgconfigdir = $(libdir)/pkgconfig
14 |
15 | pkgconfig_DATA = MagickCache.pc
16 |
17 | # The files to add to the library and to the source distribution
18 | libMagickCache_la_SOURCES = \
19 | MagickCache.h \
20 | magick-cache.c \
21 | version.h \
22 | version.c
23 |
--------------------------------------------------------------------------------
/MagickCache/magick-cache-private.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 1999 ImageMagick Studio LLC, a non-profit organization
3 | dedicated to making software imaging solutions freely available.
4 |
5 | You may not use this file except in compliance with the License. You may
6 | obtain a copy of the License at
7 |
8 | https://imagemagick.org/script/license.php
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
16 | MagickCore private utility methods.
17 | */
18 | #ifndef MAGICKCORE_UTILITY_PRIVATE_H
19 | #define MAGICKCORE_UTILITY_PRIVATE_H
20 |
21 | #if defined(__cplusplus) || defined(c_plusplus)
22 | extern "C" {
23 | #endif
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #define MagickCacheSentinel ".magickcache.sentinel"
30 | #define MagickCacheResourceSentinel ".magickcache.resource.sentinel"
31 | #define MagickCacheMin(x,y) (((x) < (y)) ? (x) : (y))
32 |
33 | #if !defined(O_BINARY)
34 | #define O_BINARY 0x00
35 | #endif
36 |
37 | #if defined(MAGICKCORE_WINDOWS_SUPPORT)
38 | #if !defined(readdir)
39 | # define readdir(directory) NTReadDirectory(directory)
40 | #endif
41 | #endif
42 |
43 | static inline unsigned int CRC32(const unsigned char *message,
44 | const size_t length)
45 | {
46 | ssize_t
47 | i;
48 |
49 | static MagickBooleanType
50 | crc_initial = MagickFalse;
51 |
52 | static unsigned int
53 | crc_xor[256];
54 |
55 | unsigned int
56 | crc;
57 |
58 | /*
59 | Generate a 32-bit cyclic redundancy check for the message.
60 | */
61 | if (crc_initial == MagickFalse)
62 | {
63 | unsigned int
64 | j;
65 |
66 | unsigned int
67 | alpha;
68 |
69 | for (j=0; j < 256; j++)
70 | {
71 | ssize_t
72 | k;
73 |
74 | alpha=j;
75 | for (k=0; k < 8; k++)
76 | alpha=(alpha & 0x01) ? (0xEDB88320 ^ (alpha >> 1)) : (alpha >> 1);
77 | crc_xor[j]=alpha;
78 | }
79 | crc_initial=MagickTrue;
80 | }
81 | crc=0xFFFFFFFF;
82 | for (i=0; i < (ssize_t) length; i++)
83 | crc=crc_xor[(crc ^ message[i]) & 0xff] ^ (crc >> 8);
84 | return(crc ^ 0xFFFFFFFF);
85 | }
86 |
87 | static inline const struct tm *GetMagickUTCTime(const time_t *timep,
88 | struct tm *result)
89 | {
90 | #if defined(MAGICKCORE_HAVE_GMTIME_R)
91 | (void) gmtime_r(timep,result);
92 | #else
93 | {
94 | struct tm
95 | *my_time;
96 |
97 | my_time=gmtime(timep);
98 | if (my_time != (struct tm *) NULL)
99 | (void) memcpy(result,my_time,sizeof(*my_time));
100 | }
101 | #endif
102 | return(result);
103 | }
104 |
105 | #if defined(MAGICKCORE_WINDOWS_SUPPORT)
106 | static inline wchar_t *CreateWidePath(const char *path)
107 | {
108 | int
109 | count;
110 |
111 | wchar_t
112 | *wide_path;
113 |
114 | /*
115 | Create a wide path under Windows.
116 | */
117 | count=MultiByteToWideChar(CP_UTF8,0,path,-1,NULL,0);
118 | if ((count > MAX_PATH) && (strncmp(path,"\\\\?\\",4) != 0) &&
119 | (NTLongPathsEnabled() == MagickFalse))
120 | {
121 | char
122 | buffer[MagickPathExtent];
123 |
124 | wchar_t
125 | *long_path,
126 | short_path[MAX_PATH];
127 |
128 | (void) FormatLocaleString(buffer,MagickPathExtent,"\\\\?\\%s",path);
129 | count+=4;
130 | long_path=(wchar_t *) AcquireQuantumMemory(count,sizeof(*long_path));
131 | if (long_path == (wchar_t *) NULL)
132 | return((wchar_t *) NULL);
133 | count=MultiByteToWideChar(CP_UTF8,0,buffer,-1,long_path,count);
134 | if (count != 0)
135 | count=GetShortPathNameW(long_path,short_path,MAX_PATH);
136 | long_path=(wchar_t *) RelinquishMagickMemory(long_path);
137 | if ((count < 5) || (count >= MAX_PATH))
138 | return((wchar_t *) NULL);
139 | wide_path=(wchar_t *) AcquireQuantumMemory(count-3,sizeof(*wide_path));
140 | wcscpy(wide_path,short_path+4);
141 | return(wide_path);
142 | }
143 | wide_path=(wchar_t *) AcquireQuantumMemory(count,sizeof(*wide_path));
144 | if (wide_path == (wchar_t *) NULL)
145 | return((wchar_t *) NULL);
146 | count=MultiByteToWideChar(CP_UTF8,0,path,-1,wide_path,count);
147 | if (count == 0)
148 | {
149 | wide_path=(wchar_t *) RelinquishMagickMemory(wide_path);
150 | return((wchar_t *) NULL);
151 | }
152 | return(wide_path);
153 | }
154 |
155 | static inline struct dirent *NTReadDirectory(DIR *entry)
156 | {
157 | int
158 | status;
159 |
160 | size_t
161 | length;
162 |
163 | if (entry == (DIR *) NULL)
164 | return((struct dirent *) NULL);
165 | if (!entry->firsttime)
166 | {
167 | status=FindNextFileW(entry->hSearch,&entry->Win32FindData);
168 | if (status == 0)
169 | return((struct dirent *) NULL);
170 | }
171 | length=WideCharToMultiByte(CP_UTF8,0,entry->Win32FindData.cFileName,-1,
172 | entry->file_info.d_name,sizeof(entry->file_info.d_name),NULL,NULL);
173 | if (length == 0)
174 | return((struct dirent *) NULL);
175 | entry->firsttime=FALSE;
176 | entry->file_info.d_namlen=(int) strlen(entry->file_info.d_name);
177 | return(&entry->file_info);
178 | }
179 | #endif
180 |
181 | static inline MagickBooleanType MagickCreatePath(const char *path)
182 | {
183 | char
184 | *directed_path,
185 | *directed_walk,
186 | *p;
187 |
188 | int
189 | status = 0;
190 |
191 | size_t
192 | extent;
193 |
194 | struct stat
195 | attributes;
196 |
197 | extent=2*strlen(path)+2;
198 | directed_walk=(char *) AcquireCriticalMemory(extent*sizeof(*directed_walk));
199 | *directed_walk='\0';
200 | if (*path == '/')
201 | (void) ConcatenateMagickString(directed_walk,"/",extent);
202 | directed_path=ConstantString(path);
203 | for (p=strtok(directed_path,"/"); p != (char *) NULL; p=strtok(NULL,"/"))
204 | {
205 | (void) ConcatenateMagickString(directed_walk,p,extent);
206 | (void) ConcatenateMagickString(directed_walk,"/",extent);
207 | if (GetPathAttributes(directed_walk,&attributes) == MagickFalse)
208 | {
209 | #if defined(MAGICKCORE_WINDOWS_SUPPORT)
210 | {
211 | wchar_t
212 | wide_path;
213 |
214 | wide_path=CreateWidePath(directed_walk);
215 | if (wide_path == (wchar_t *) NULL)
216 | {
217 | status=(-1);
218 | break;
219 | }
220 | status=_wmkdir(wide_path);
221 | wide_path=(wchar_t *) RelinquishMagickMemory(wide_path);
222 | }
223 | #else
224 | status=mkdir(directed_walk,S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
225 | #endif
226 | if (status < 0)
227 | {
228 | status=(-1);
229 | break;
230 | }
231 | }
232 | }
233 | directed_path=DestroyString(directed_path);
234 | directed_walk=DestroyString(directed_walk);
235 | return(status == 0 ? MagickTrue : MagickFalse);
236 | }
237 |
238 | static inline int open_utf8(const char *path,int flags,mode_t mode)
239 | {
240 | #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__)
241 | return(open(path,flags,mode));
242 | #else
243 | int
244 | status;
245 |
246 | wchar_t
247 | *path_wide;
248 |
249 | path_wide=create_wchar_path(path);
250 | if (path_wide == (wchar_t *) NULL)
251 | return(-1);
252 | status=_wopen(path_wide,flags,mode);
253 | path_wide=(wchar_t *) RelinquishMagickMemory(path_wide);
254 | return(status);
255 | #endif
256 | }
257 |
258 | static inline int remove_utf8(const char *path)
259 | {
260 | #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__)
261 | return(remove(path));
262 | #else
263 | int
264 | status;
265 |
266 | wchar_t
267 | *path_wide;
268 |
269 | path_wide=create_wchar_path(path);
270 | if (path_wide == (wchar_t *) NULL)
271 | return(-1);
272 | status=_wremove(path_wide);
273 | path_wide=(wchar_t *) RelinquishMagickMemory(path_wide);
274 | return(status);
275 | #endif
276 | }
277 |
278 | #if defined(__cplusplus) || defined(c_plusplus)
279 | }
280 | #endif
281 |
282 | #endif
283 |
--------------------------------------------------------------------------------
/MagickCache/version.c:
--------------------------------------------------------------------------------
1 | /*
2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 | % %
4 | % %
5 | % %
6 | % V V EEEEE RRRR SSSSS IIIII OOO N N %
7 | % V V E R R SS I O O NN N %
8 | % V V EEE RRRR SSS I O O N N N %
9 | % V V E R R SS I O O N NN %
10 | % V EEEEE R R SSSSS IIIII OOO N N %
11 | % %
12 | % %
13 | % Magick Cache Version Methods %
14 | % %
15 | % Software Design %
16 | % Cristy %
17 | % March 2022 %
18 | % %
19 | % %
20 | % Copyright 1999 ImageMagick Studio LLC, a non-profit organization %
21 | % dedicated to making software imaging solutions freely available. %
22 | % %
23 | % You may not use this file except in compliance with the License. You may %
24 | % obtain a copy of the License at %
25 | % %
26 | % https://imagemagick.org/script/license.php %
27 | % %
28 | % Unless required by applicable law or agreed to in writing, software %
29 | % distributed under the License is distributed on an "AS IS" BASIS, %
30 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 | % See the License for the specific language governing permissions and %
32 | % limitations under the License. %
33 | % %
34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 | %
36 | %
37 | */
38 |
39 | /*
40 | Include declarations.
41 | */
42 | #include
43 | #include "MagickCache/MagickCache.h"
44 |
45 | /*
46 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 | % %
48 | % %
49 | % %
50 | % G e t M a g i c k C a c h e C o p y r i g h t %
51 | % %
52 | % %
53 | % %
54 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 | %
56 | % GetMagickCacheCopyright() returns the MagickCache API copyright as a string.
57 | %
58 | % The format of the GetMagickCacheCopyright method is:
59 | %
60 | % const char *GetMagickCacheCopyright(void)
61 | %
62 | */
63 | MagickExport const char *GetMagickCacheCopyright(void)
64 | {
65 | return(MagickCacheCopyright);
66 | }
67 |
68 | /*
69 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 | % %
71 | % %
72 | % %
73 | % G e t M a g i c k C a c h e V e r s i o n %
74 | % %
75 | % %
76 | % %
77 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 | %
79 | % GetMagickCacheVersion() returns the MagickCache API version as a string and
80 | % as a number.
81 | %
82 | % The format of the GetMagickCacheVersion method is:
83 | %
84 | % const char *GetMagickCacheVersion(size_t *version)
85 | %
86 | % A description of each parameter follows:
87 | %
88 | % o version: The MagickCache version is returned as a number.
89 | %
90 | */
91 | MagickExport const char *GetMagickCacheVersion(size_t *version)
92 | {
93 | if (version != (size_t *) NULL)
94 | *version=MagickCacheLibVersion;
95 | return(MagickCacheVersion);
96 | }
97 |
--------------------------------------------------------------------------------
/MagickCache/version.h.in:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization
3 | dedicated to making software imaging solutions freely available.
4 |
5 | You may not use this file except in compliance with the License.
6 | obtain a copy of the License at
7 |
8 | https://imagemagick.org/script/license.php
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
16 | MagickCache's Toolkit version and copyright.
17 | */
18 | #ifndef _MAGICKCACHE_VERSION_H
19 | #define _MAGICKCACHE_VERSION_H
20 |
21 | #if defined(__cplusplus) || defined(c_plusplus)
22 | extern "C" {
23 | #endif
24 |
25 | /*
26 | Define declarations.
27 | */
28 | #define MagickCachePackageName "@PACKAGE_NAME@"
29 | #define MagickCacheCopyright "Copyright @ 1999 ImageMagick Studio LLC"
30 | #define MagickCacheLibVersion @PACKAGE_LIB_VERSION@
31 | #define MagickCacheLibVersionText "@MAGICKCACHE_LIB_VERSION_TEXT@"
32 | #define MagickCacheLibVersionNumber @MAGICKCACHE_LIB_VERSION_NUMBER@
33 | #define MagickCacheLibAddendum "@PACKAGE_VERSION_ADDENDUM@"
34 | #define MagickCacheLibInterface @MAGICKCACHE_LIBRARY_CURRENT@
35 | #define MagickCacheLibMinInterface @MAGICKCACHE_LIBRARY_CURRENT_MIN@
36 | #define MagickCacheReleaseDate "@PACKAGE_RELEASE_DATE@"
37 | #define MagickCacheAuthoritativeURL "http://www.imagemagick.org"
38 | #define MagickCacheVersion MagickCachePackageName " " MagickCacheLibVersionText \
39 | MagickCacheLibAddendum " " MagickCacheReleaseDate " " MagickCacheAuthoritativeURL
40 |
41 | /*
42 | Method declarations.
43 | */
44 | extern MagickExport const char
45 | *GetMagickCacheCopyright(void),
46 | *GetMagickCacheVersion(size_t *);
47 |
48 | #if defined(__cplusplus) || defined(c_plusplus)
49 | }
50 | #endif
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | ACLOCAL_AMFLAGS = -I m4
2 |
3 | SUBDIRS = \
4 | MagickCache \
5 | utilities \
6 | tests
7 |
8 | TOP_EXTRA_DIST = \
9 | INSTALL.md \
10 | LICENSE \
11 | README.md \
12 | SECURITY.md
13 |
14 | # Binary scripts
15 | bin_SCRIPTS = \
16 | MagickCache/MagickCache-config
17 |
18 | # Additional files to distribute
19 | EXTRA_DIST = \
20 | $(TOP_EXTRA_DIST) \
21 | MagickCache/MagickCache-config.in
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MagickCache: an Efficient Digital Media Repository
2 |
3 | [](https://github.com/ImageMagick/MagickCache/actions)
4 | [](https://github.com/sponsors/ImageMagick)
5 |
6 | MagickCache is an advanced toolset that guarantees secure caching of images, image sequences, videos, audio, or metadata within a local folder. The content is memory-mapped to ensure fast and efficient retrieval, and retrieving a portion of an image further enhances its efficiency. You have the flexibility to choose whether the content should persist or have a specified time-to-live (TTL) to automatically expire when the TTL is exceeded. MagickCache has the ability to support virtually an unlimited amount of content, up to billions of images, videos, metadata, or blobs, making it ideal for use as a digital media repository.
7 |
8 | The MagickCache works in concert with [ImageMagick](https://imagemagick.org). Download the [MagickCache](https://github.com/ImageMagick/MagickCache) and install. You will now want to create the cache and populate it with images, video, audio, and any associated metadata.
9 |
10 | ## Create a Digital Media Repository
11 |
12 | You will require a place to store and retrieve your content. Let's create a digital media repository on your local filesystem:
13 |
14 | ```
15 | $ magick-cache -passkey ~/.passkey create /opt/dmr
16 | ```
17 |
18 | Where `~/.passkey` contains your cache passkey. The passkey can be any binary content, from a simple password or phrase, or an image, or even gibberish. Note, the passkey is sensitive to any control characters you include in the file. Here is one method to create a passkey without control characters:
19 |
20 | ```
21 | $ echo -n "myPasskey" > ~/.passkey
22 | ```
23 |
24 | To be effective, make your passkey at least 8 characters in length. Don't lose your passkey. Without it, you will be unable to identify, delete, or expire content in your cache.
25 |
26 | To reduce latency and increase efficiency, we recommend you create your digital media repository on a solid-state drive (SSD).
27 |
28 | You only need to create a MagickCache once to store upwards of billions of images, video, audio, and metadata. You can, however, create more than one MagickCache with different paths.
29 |
30 | Once the MagickCache is created, you will want to populate the cache with content that includes images, video, audio, or metadata.
31 |
32 | ## Put content in the Digital Media Repository
33 |
34 | Let's add a movie cast image to our newly created digital media repository:
35 |
36 | ```
37 | $ magick-cache put /opt/dmr movies/image/mission-impossible/cast/rebecca-ferguson 20240508-rebecca-ferguson.jpg
38 | ```
39 |
40 | Note that the image identifier is an IRI comprising the _project/type/resource-path_ components. In the given example, _project_ is movies, _type_ is image, and _resource-path_ is `mission-impossible/cast/rebecca-ferguson`, which serves as a unique identifier for the cached resource. It is important to ensure that two different images are stored using unique resource paths to prevent overwriting. If you need to store multiple versions of an image, consider using a distinct identifier such as `mission-impossible/cast/20240508-rebecca-ferguson-1` and `mission-impossible/cast/20240508-rebecca-ferguson-2`.
41 |
42 | Now, let's set a resource passkey and the time to live to 2 days:
43 |
44 | ```
45 | $ magick-cache -passkey ~/.passkey -ttl "2 days" put /opt/dmr movies/image/mission-impossible/cast/rebecca-ferguson 20240508-rebecca-ferguson.jpg
46 | ```
47 |
48 | Where `~/.passkey` contains your resource key. Don't lose your resource passkey. Without it, you will be unable to get, identify, delete, or expire resources you created.
49 |
50 | Anytime after the second day, the image is automatically deleted with the `expire` function.
51 |
52 | The resource passkey ensures only you and the cache owner can access your image. To prevent the cache owner from viewing its content, scramble it with a passphrase:
53 |
54 | ```
55 | $ magick-cache -passkey ~/.passkey -passphrase ~/.passphrase -ttl "2 days" put /opt/dmr movies/image/mission-impossible/cast/rebecca-ferguson 20240508-rebecca-ferguson.jpg
56 | ```
57 |
58 | You will need the same passphrase when you retrieve the image to restore it back to its original form.
59 |
60 | Note, only images are scrambled. Blobs and metadata are stored in the cache in plaintext. To prevent snooping, scramble any blobs or metadata *before* you store it in the cache.
61 |
62 | ## Get content from the Digital Media Repository
63 |
64 | Eventually you will want retrieve your content from the cache. As an example, let's get our original cast image from the cache:
65 |
66 | ```
67 | $ magick-cache -passkey ~/.passkey get /opt/dmr movies/image/mission-impossible/cast/rebecca-ferguson rebecca-ferguson.png
68 | ```
69 |
70 | Notice the original image was put in the cache in the JPEG format. Here we conveniently convert it to the PNG format as we extract the image.
71 |
72 | The `-extract` option is useful when retrieving an image if you want to extract just a portion of the image. Specify the tile width, height, and offset as follows:
73 |
74 | ```
75 | $ magick-cache -passkey ~/.passkey -extract 100x100+0+0 get /opt/dmr movies/image/mission-impossible/cast/rebecca-ferguson rebecca-ferguson.png
76 | ```
77 |
78 | To resize instead, do not specify the offset:
79 |
80 | ```
81 | $ magick-cache -passkey ~/.passkey -extract 100x100 get /opt/dmr movies/image/mission-impossible/cast/rebecca-ferguson rebecca-ferguson.png
82 | ```
83 |
84 | If your image is scrambled, provide the passphrase to descramble it first:
85 |
86 | ```
87 | $ magick-cache -passkey ~/.passkey -passphrase ~/.passphrase get /opt/dmr movies/image/mission-impossible/cast/rebecca-ferguson rebecca-ferguson.png
88 | ```
89 |
90 | ## Delete content from the Digital Media Repository
91 |
92 | We can explicitedly delete content:
93 |
94 | ```
95 | $ magick-cache -passkey ~/.passkey delete /opt/dmr movies/image/mission-impossible/cast/rebecca-ferguson
96 | ```
97 |
98 | or we can delete all cast images that have expired (exceeded their respective time to live), try this comand:
99 |
100 | ```
101 | $ magick-cache -passkey ~/.passkey expire /opt/dmr movies/image/mission-impossible/cast
102 | ```
103 |
104 | ## Identify the Digital Media Repository Content
105 |
106 | Perhaps you want to identify all the content you own:
107 |
108 | ```
109 | $ magick-cache -passkey ~/.passkey identify /opt/dmr movies/image/mission-impossible/cast
110 | movies/image/mission-impossible/cast/rebecca-ferguson[1368x912] 406B 1:0:0:0 2024-05-30T17:41:42Z
111 | identified 1 resources
112 | ```
113 |
114 | Each entry includes the IRI, image dimensions for images, the content extent in bytes, time to live, whether the resource is expired (denoted with a `*`), and the creation date.
115 |
116 | MagickCache supports a wild resource type as in this example:
117 |
118 | ```
119 | $ magick-cache -passkey ~/.passkey identify /opt/dmr movies/*/mission-impossible/cast
120 | movies/image/mission-impossible/cast/rebecca-ferguson[1368x912] 889B 0:0:0:0 2023-05-06T00:49:27Z
121 | movies/blob/mission-impossible/cast/rebecca-ferguson 1.14476MiB 0:0:0:0 2023-05-06T00:49:27Z
122 | movies/meta/mission-impossible/cast/rebecca-ferguson 11B 0:0:0:0 2023-05-06T00:49:27Z
123 | ```
124 |
125 | Others can store content in the cache along side your content. However, their content is unavailable to you. You cannot get, identify, delete, or expire content that you did not create or does not match your secret passkey.
126 |
127 | The MagickCache creator can get, identify, delete, or expire all the content, including content you own, with this command, for example:
128 |
129 | ```
130 | $ magick-cache -passkey ~/.passkey identify /opt/dmr /
131 | ```
132 |
133 | Note, expired resources are annotated with an asterisks.
134 |
135 | ## MagickCache is not just for Images
136 |
137 | In addition to a type of image, you can store the image content in its original form, video, or audio as content type of `blob` or metadata with a content type of `meta`:
138 |
139 | ```
140 | $ magick-cache -passkey ~/.passkey put /opt/dmr movies/blob/mission-impossible/cast/rebecca-ferguson 20240508-rebecca-ferguson.mp4
141 | ```
142 |
143 | or
144 |
145 | ```
146 | $ magick-cache -passkey ~/.passkey put /opt/dmr movies/meta/mission-impossible/cast/rebecca-ferguson 20240508-rebecca-ferguson.txt
147 | ```
148 |
149 | Images must be in a format that ImageMagick [supports](https://imagemagick.org/script/formats.php). Metadata should be text. Blobs can be any content, text or binary, including metadata or images, video, audio, or binary files.
150 |
151 | ## Delete a Digital Media Repository
152 |
153 | The MagickCache owner can completely delete all the content within a cache:
154 |
155 | ```
156 | $ magick-cache -passkey ~/.passkey delete /opt/dmr /
157 | ```
158 |
159 | Be careful. After this command, your cache content is irrevocably lost.
160 |
161 | ## Digital Media Repository Security
162 |
163 | It's important to note that the security measures employed by MagickCache are not based on cryptographic strength. Instead, the system generates a unique hash of appropriate quality for each resource to ensure that the resource ID remains unknown. Access to a resource is granted to both the cache user and the owner, provided they can present their respective passkeys. Furthermore, anyone with adequate privileges to access the MagickCache path directly on disk will also be able to access the resources stored therein.
164 |
165 | ## Portable Digital Media Repository
166 |
167 | The digital asset repository you created is engineered to be portable and fully self-contained. This means that you can effortlessly transfer or duplicate the repository to any storage location within your current host or even to a different host altogether. You can then retrieve or upload resources to the repository as long as you use the same key that was used during the repository's initial creation.
168 |
169 | ## MagickCache API
170 |
171 | You have seen how to create, put, get, identify, delete, or expire content to and from the MagickCache with the magick-cache command-line utility. All these functions are also available from the [MagickCache API](https://github.com/ImageMagick/MagickCache) to conveniently include MagickCache functionality directly in your projects.
172 |
173 | ## ImageMagick Digital Media Repository Access
174 |
175 | You can get media from, or put media to, the repository with [ImageMagick](https://imagemagick.org). To convert a digital media resource to PNG, try:
176 |
177 | ```
178 | convert -define dmr:path=/opt/dmr -define dmr:passkey=/dmr/.passkey \
179 | dmr:movies/image/mission-impossible/cast/rebecca-ferguson \
180 | rebecca-ferguson.png
181 | ```
182 |
183 | To put or replace a resource in the repository, try:
184 |
185 | ```
186 | convert rebecca-ferguson.png \
187 | -define dmr:path=/opt/dmr -define dmr:passkey=/dmr/.passkey \
188 | dmr:movies/image/mission-impossible/cast/rebecca-ferguson
189 | ```
190 |
191 | You can also store an image as a blob instead. To store meta data, set the `dmr:meta` property:
192 |
193 | ```
194 | convert -define dmr:path=/opt/dmr -define dmr:passkey=/home/cristy/.passkey \
195 | -define dmr:meta="Ilsa Faust" xc: \
196 | dmr:movies/meta/mission-impossible/cast/rebecca-ferguson
197 | ```
198 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | MagickCache's security relies on the ImageMagick security policy. Creating a [security policy](https://imagemagick.org/script/security-policy.php) that fits your specific local environment before making use of MagickCache is highly advised.
4 |
5 | ## Supported Versions
6 |
7 | We encourage users to upgrade to the latest MagickCache release to ensure that all known security vulnerabilities are addressed. On request, we can backport security fixes to other MagickCache versions.
8 |
9 | ## Reporting a Vulnerability
10 |
11 | Before you post a vulnerability, first determine if the vulnerability can be mitigated by a properly curated security policy. Next, verify your policy using the [validation tool](https://imagemagick-secevaluator.doyensec.com/). Now use a [development container](https://containers.dev/), available in the `.devcontainer/security` folder, to verify that the security issue can be reproduced with the latest source code and your security policy. If you feel confident that the security policy does not address the vulnerability, post the vulnerability as a [security advisory](https://github.com/ImageMagick/MagickCache/security/advisories/new). Most vulnerabilities are reviewed and resolved within 48 hours.
12 |
--------------------------------------------------------------------------------
/compile:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # Wrapper for compilers which do not understand '-c -o'.
3 |
4 | scriptversion=2018-03-07.03; # UTC
5 |
6 | # Copyright (C) 1999-2021 Free Software Foundation, Inc.
7 | # Written by Tom Tromey .
8 | #
9 | # This program is free software; you can redistribute it and/or modify
10 | # it under the terms of the GNU General Public License as published by
11 | # the Free Software Foundation; either version 2, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with this program. If not, see .
21 |
22 | # As a special exception to the GNU General Public License, if you
23 | # distribute this file as part of a program that contains a
24 | # configuration script generated by Autoconf, you may include it under
25 | # the same distribution terms that you use for the rest of that program.
26 |
27 | # This file is maintained in Automake, please report
28 | # bugs to or send patches to
29 | # .
30 |
31 | nl='
32 | '
33 |
34 | # We need space, tab and new line, in precisely that order. Quoting is
35 | # there to prevent tools from complaining about whitespace usage.
36 | IFS=" "" $nl"
37 |
38 | file_conv=
39 |
40 | # func_file_conv build_file lazy
41 | # Convert a $build file to $host form and store it in $file
42 | # Currently only supports Windows hosts. If the determined conversion
43 | # type is listed in (the comma separated) LAZY, no conversion will
44 | # take place.
45 | func_file_conv ()
46 | {
47 | file=$1
48 | case $file in
49 | / | /[!/]*) # absolute file, and not a UNC file
50 | if test -z "$file_conv"; then
51 | # lazily determine how to convert abs files
52 | case `uname -s` in
53 | MINGW*)
54 | file_conv=mingw
55 | ;;
56 | CYGWIN* | MSYS*)
57 | file_conv=cygwin
58 | ;;
59 | *)
60 | file_conv=wine
61 | ;;
62 | esac
63 | fi
64 | case $file_conv/,$2, in
65 | *,$file_conv,*)
66 | ;;
67 | mingw/*)
68 | file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
69 | ;;
70 | cygwin/* | msys/*)
71 | file=`cygpath -m "$file" || echo "$file"`
72 | ;;
73 | wine/*)
74 | file=`winepath -w "$file" || echo "$file"`
75 | ;;
76 | esac
77 | ;;
78 | esac
79 | }
80 |
81 | # func_cl_dashL linkdir
82 | # Make cl look for libraries in LINKDIR
83 | func_cl_dashL ()
84 | {
85 | func_file_conv "$1"
86 | if test -z "$lib_path"; then
87 | lib_path=$file
88 | else
89 | lib_path="$lib_path;$file"
90 | fi
91 | linker_opts="$linker_opts -LIBPATH:$file"
92 | }
93 |
94 | # func_cl_dashl library
95 | # Do a library search-path lookup for cl
96 | func_cl_dashl ()
97 | {
98 | lib=$1
99 | found=no
100 | save_IFS=$IFS
101 | IFS=';'
102 | for dir in $lib_path $LIB
103 | do
104 | IFS=$save_IFS
105 | if $shared && test -f "$dir/$lib.dll.lib"; then
106 | found=yes
107 | lib=$dir/$lib.dll.lib
108 | break
109 | fi
110 | if test -f "$dir/$lib.lib"; then
111 | found=yes
112 | lib=$dir/$lib.lib
113 | break
114 | fi
115 | if test -f "$dir/lib$lib.a"; then
116 | found=yes
117 | lib=$dir/lib$lib.a
118 | break
119 | fi
120 | done
121 | IFS=$save_IFS
122 |
123 | if test "$found" != yes; then
124 | lib=$lib.lib
125 | fi
126 | }
127 |
128 | # func_cl_wrapper cl arg...
129 | # Adjust compile command to suit cl
130 | func_cl_wrapper ()
131 | {
132 | # Assume a capable shell
133 | lib_path=
134 | shared=:
135 | linker_opts=
136 | for arg
137 | do
138 | if test -n "$eat"; then
139 | eat=
140 | else
141 | case $1 in
142 | -o)
143 | # configure might choose to run compile as 'compile cc -o foo foo.c'.
144 | eat=1
145 | case $2 in
146 | *.o | *.[oO][bB][jJ])
147 | func_file_conv "$2"
148 | set x "$@" -Fo"$file"
149 | shift
150 | ;;
151 | *)
152 | func_file_conv "$2"
153 | set x "$@" -Fe"$file"
154 | shift
155 | ;;
156 | esac
157 | ;;
158 | -I)
159 | eat=1
160 | func_file_conv "$2" mingw
161 | set x "$@" -I"$file"
162 | shift
163 | ;;
164 | -I*)
165 | func_file_conv "${1#-I}" mingw
166 | set x "$@" -I"$file"
167 | shift
168 | ;;
169 | -l)
170 | eat=1
171 | func_cl_dashl "$2"
172 | set x "$@" "$lib"
173 | shift
174 | ;;
175 | -l*)
176 | func_cl_dashl "${1#-l}"
177 | set x "$@" "$lib"
178 | shift
179 | ;;
180 | -L)
181 | eat=1
182 | func_cl_dashL "$2"
183 | ;;
184 | -L*)
185 | func_cl_dashL "${1#-L}"
186 | ;;
187 | -static)
188 | shared=false
189 | ;;
190 | -Wl,*)
191 | arg=${1#-Wl,}
192 | save_ifs="$IFS"; IFS=','
193 | for flag in $arg; do
194 | IFS="$save_ifs"
195 | linker_opts="$linker_opts $flag"
196 | done
197 | IFS="$save_ifs"
198 | ;;
199 | -Xlinker)
200 | eat=1
201 | linker_opts="$linker_opts $2"
202 | ;;
203 | -*)
204 | set x "$@" "$1"
205 | shift
206 | ;;
207 | *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
208 | func_file_conv "$1"
209 | set x "$@" -Tp"$file"
210 | shift
211 | ;;
212 | *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
213 | func_file_conv "$1" mingw
214 | set x "$@" "$file"
215 | shift
216 | ;;
217 | *)
218 | set x "$@" "$1"
219 | shift
220 | ;;
221 | esac
222 | fi
223 | shift
224 | done
225 | if test -n "$linker_opts"; then
226 | linker_opts="-link$linker_opts"
227 | fi
228 | exec "$@" $linker_opts
229 | exit 1
230 | }
231 |
232 | eat=
233 |
234 | case $1 in
235 | '')
236 | echo "$0: No command. Try '$0 --help' for more information." 1>&2
237 | exit 1;
238 | ;;
239 | -h | --h*)
240 | cat <<\EOF
241 | Usage: compile [--help] [--version] PROGRAM [ARGS]
242 |
243 | Wrapper for compilers which do not understand '-c -o'.
244 | Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
245 | arguments, and rename the output as expected.
246 |
247 | If you are trying to build a whole package this is not the
248 | right script to run: please start by reading the file 'INSTALL'.
249 |
250 | Report bugs to .
251 | EOF
252 | exit $?
253 | ;;
254 | -v | --v*)
255 | echo "compile $scriptversion"
256 | exit $?
257 | ;;
258 | cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
259 | icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
260 | func_cl_wrapper "$@" # Doesn't return...
261 | ;;
262 | esac
263 |
264 | ofile=
265 | cfile=
266 |
267 | for arg
268 | do
269 | if test -n "$eat"; then
270 | eat=
271 | else
272 | case $1 in
273 | -o)
274 | # configure might choose to run compile as 'compile cc -o foo foo.c'.
275 | # So we strip '-o arg' only if arg is an object.
276 | eat=1
277 | case $2 in
278 | *.o | *.obj)
279 | ofile=$2
280 | ;;
281 | *)
282 | set x "$@" -o "$2"
283 | shift
284 | ;;
285 | esac
286 | ;;
287 | *.c)
288 | cfile=$1
289 | set x "$@" "$1"
290 | shift
291 | ;;
292 | *)
293 | set x "$@" "$1"
294 | shift
295 | ;;
296 | esac
297 | fi
298 | shift
299 | done
300 |
301 | if test -z "$ofile" || test -z "$cfile"; then
302 | # If no '-o' option was seen then we might have been invoked from a
303 | # pattern rule where we don't need one. That is ok -- this is a
304 | # normal compilation that the losing compiler can handle. If no
305 | # '.c' file was seen then we are probably linking. That is also
306 | # ok.
307 | exec "$@"
308 | fi
309 |
310 | # Name of file we expect compiler to create.
311 | cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
312 |
313 | # Create the lock directory.
314 | # Note: use '[/\\:.-]' here to ensure that we don't use the same name
315 | # that we are using for the .o file. Also, base the name on the expected
316 | # object file name, since that is what matters with a parallel build.
317 | lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
318 | while true; do
319 | if mkdir "$lockdir" >/dev/null 2>&1; then
320 | break
321 | fi
322 | sleep 1
323 | done
324 | # FIXME: race condition here if user kills between mkdir and trap.
325 | trap "rmdir '$lockdir'; exit 1" 1 2 15
326 |
327 | # Run the compile.
328 | "$@"
329 | ret=$?
330 |
331 | if test -f "$cofile"; then
332 | test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
333 | elif test -f "${cofile}bj"; then
334 | test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
335 | fi
336 |
337 | rmdir "$lockdir"
338 | exit $ret
339 |
340 | # Local Variables:
341 | # mode: shell-script
342 | # sh-indentation: 2
343 | # eval: (add-hook 'before-save-hook 'time-stamp)
344 | # time-stamp-start: "scriptversion="
345 | # time-stamp-format: "%:y-%02m-%02d.%02H"
346 | # time-stamp-time-zone: "UTC0"
347 | # time-stamp-end: "; # UTC"
348 | # End:
349 |
--------------------------------------------------------------------------------
/config.h.in:
--------------------------------------------------------------------------------
1 | /* config.h.in. Generated from configure.ac by autoheader. */
2 |
3 | /* Define to 1 or higher if this is a debug build */
4 | #undef DEBUG
5 |
6 | /* Define to 1 if you have the header file. */
7 | #undef HAVE_DLFCN_H
8 |
9 | /* Define to 1 if you have the header file. */
10 | #undef HAVE_INTTYPES_H
11 |
12 | /* Define to 1 if you have the header file. */
13 | #undef HAVE_STDINT_H
14 |
15 | /* Define to 1 if you have the header file. */
16 | #undef HAVE_STDIO_H
17 |
18 | /* Define to 1 if you have the header file. */
19 | #undef HAVE_STDLIB_H
20 |
21 | /* Define to 1 if you have the header file. */
22 | #undef HAVE_STRINGS_H
23 |
24 | /* Define to 1 if you have the header file. */
25 | #undef HAVE_STRING_H
26 |
27 | /* Define to 1 if you have the 'sysconf' function. */
28 | #undef HAVE_SYSCONF
29 |
30 | /* Define to 1 if you have the header file. */
31 | #undef HAVE_SYS_STAT_H
32 |
33 | /* Define to 1 if you have the header file. */
34 | #undef HAVE_SYS_TYPES_H
35 |
36 | /* Define to 1 if you have the header file. */
37 | #undef HAVE_UNISTD_H
38 |
39 | /* Define to the sub-directory where libtool stores uninstalled libraries. */
40 | #undef LT_OBJDIR
41 |
42 | /* Define to the address where bug reports for this package should be sent. */
43 | #undef PACKAGE_BUGREPORT
44 |
45 | /* Define to the full name of this package. */
46 | #undef PACKAGE_NAME
47 |
48 | /* Define to the full name and version of this package. */
49 | #undef PACKAGE_STRING
50 |
51 | /* Define to the one symbol short name of this package. */
52 | #undef PACKAGE_TARNAME
53 |
54 | /* Define to the home page for this package. */
55 | #undef PACKAGE_URL
56 |
57 | /* Define to the version of this package. */
58 | #undef PACKAGE_VERSION
59 |
60 | /* Define to 1 if all of the C89 standard headers exist (not just the ones
61 | required in a freestanding environment). This macro is provided for
62 | backward compatibility; new code need not use it. */
63 | #undef STDC_HEADERS
64 |
65 | /* Define as 'unsigned int' if doesn't define. */
66 | #undef size_t
67 |
--------------------------------------------------------------------------------
/config/configure.xml.in:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
8 | ]>
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/configure.ac:
--------------------------------------------------------------------------------
1 | # Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization
2 | # dedicated to making software imaging solutions freely available.
3 | #
4 | # You may not use this file except in compliance with the License. You may
5 | # obtain a copy of the License at
6 | #
7 | # https://imagemagick.org/script/license.php
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | AC_PREREQ([2.69])
16 |
17 | # ==============================================================================
18 | # Initialize Automake
19 | # ==============================================================================
20 | m4_include([m4/version.m4])
21 | m4_define([magickcache_base_version],
22 | [magickcache_major_version.magickcache_minor_version.magickcache_micro_version])
23 | m4_define([magickcache_version],
24 | [magickcache_base_version-magickcache_patchlevel_version])
25 | m4_define([magickcache_lib_version_number],
26 | [magickcache_major_version,magickcache_minor_version,magickcache_micro_version,magickcache_patchlevel_version])
27 | m4_define([magickcache_git_revision],
28 | m4_esyscmd([
29 | h=$(git rev-parse --short HEAD)
30 | d=$(git log -1 --format=:%cd --date=format:%Y%m%d || date -u +%Y%m%d -r ./m4/version.m4)
31 | printf %s "$h$d"
32 | ]))
33 | m4_define([magickcache_release_date],
34 | m4_esyscmd([
35 | d=$(git log -1 --format=%cd --date=format:%Y-%m-%d || date -u +%F -r ./m4/version.m4)
36 | printf %s "$d"
37 | ]))
38 |
39 | AC_INIT([magickcache_name],[magickcache_version],[magickcache_bugreport],[magickcache_tarname],[magickcache_url])
40 |
41 | AC_CONFIG_SRCDIR([utilities/magick-cache.c])
42 | AC_CONFIG_HEADERS([config.h])
43 | AC_CONFIG_MACRO_DIR([m4])
44 | AM_INIT_AUTOMAKE([foreign no-define color-tests parallel-tests -Wall -Wno-portability subdir-objects dist-bzip2 dist-lzip dist-xz dist-zip tar-ustar])
45 |
46 | PKG_PROG_PKG_CONFIG
47 |
48 | # Ensure that make can run correctly
49 | AM_SANITY_CHECK
50 |
51 | # Substitute versioning
52 | AC_SUBST([MAGICKCACHE_MAJOR_VERSION],[magickcache_major_version])
53 | AC_SUBST([MAGICKCACHE_MINOR_VERSION],[magickcache_minor_version])
54 | AC_SUBST([MAGICKCACHE_MICRO_VERSION],[magickcache_micro_version])
55 | AC_SUBST([MAGICKCACHE_PATCHLEVEL_VERSION],[magickcache_patchlevel_version])
56 | AC_SUBST([MAGICKCACHE_VERSION],[magickcache_version])
57 | AC_SUBST([MAGICKCACHE_GIT_REVISION],[magickcache_git_revision])
58 |
59 | # Substitute library versioning
60 | AC_SUBST([MAGICKCACHE_LIBRARY_CURRENT],[magickcache_library_current])dnl
61 | AC_SUBST([MAGICKCACHE_LIBRARY_REVISION],[magickcache_library_revision])dnl
62 | AC_SUBST([MAGICKCACHE_LIBRARY_AGE],[magickcache_library_age])dnl
63 | AC_SUBST([MAGICKCACHE_LIBRARY_CURRENT_MIN],
64 | [`expr $MAGICKCACHE_LIBRARY_CURRENT - $MAGICKCACHE_LIBRARY_AGE`])
65 | AC_SUBST([MAGICKCACHE_LIBRARY_VERSION_INFO],
66 | [$MAGICKCACHE_LIBRARY_CURRENT:$MAGICKCACHE_LIBRARY_REVISION:$MAGICKCACHE_LIBRARY_AGE])
67 |
68 | AC_SUBST([PACKAGE_BASE_VERSION],[magickcache_base_version])
69 | AC_SUBST([PACKAGE_PATCHLEVEL_VERSION],[magickcache_patchlevel_version])
70 | AC_SUBST([PACKAGE_VERSION_ADDENDUM],[-magickcache_patchlevel_version])
71 | AC_SUBST([PACKAGE_LIB_VERSION],[magickcache_lib_version])
72 | AC_SUBST([PACKAGE_LIB_VERSION_NUMBER],[magickcache_lib_version_number])
73 | AC_SUBST([PACKAGE_RELEASE_DATE],[magickcache_release_date])
74 |
75 | # versioning of library
76 | MAGICKCACHE_LIB_VERSION="0x"
77 | if test ${MAGICKCACHE_LIBRARY_CURRENT} -lt 10 ; then
78 | MAGICKCACHE_LIB_VERSION=${MAGICKCACHE_LIB_VERSION}0
79 | fi
80 | MAGICKCACHE_LIB_VERSION=${MAGICKCACHE_LIB_VERSION}${MAGICKCACHE_LIBRARY_CURRENT}
81 | if test ${MAGICKCACHE_LIBRARY_AGE} -lt 10 ; then
82 | MAGICKCACHE_LIB_VERSION=${MAGICKCACHE_LIB_VERSION}0
83 | fi
84 | MAGICKCACHE_LIB_VERSION=${MAGICKCACHE_LIB_VERSION}${MAGICKCACHE_LIBRARY_AGE}
85 | if test ${MAGICKCACHE_LIBRARY_REVISION} -lt 10 ; then
86 | MAGICKCACHE_LIB_VERSION=${MAGICKCACHE_LIB_VERSION}0
87 | fi
88 | MAGICKCACHE_LIB_VERSION=${MAGICKCACHE_LIB_VERSION}${MAGICKCACHE_LIBRARY_REVISION}
89 | AC_SUBST([MAGICKCACHE_LIB_VERSION])
90 |
91 | # Definition used to define MagickLibVersionText in version.h
92 | MAGICKCACHE_LIB_VERSION_TEXT="${PACKAGE_BASE_VERSION}"
93 | AC_SUBST([MAGICKCACHE_LIB_VERSION_TEXT])
94 |
95 | # Definition used to define MagickLibVersionNumber in version.h
96 | MAGICKCACHE_LIB_VERSION_NUMBER="${MAGICKCACHE_LIBRARY_CURRENT},${MAGICKCACHE_LIBRARY_AGE},${MAGICKCACHE_LIBRARY_REVISION}"
97 | AC_SUBST([MAGICKCACHE_LIB_VERSION_NUMBER])
98 |
99 | # Definition used to define MagickLibVersionText in version.h
100 | MAGICKPP_LIB_VERSION_TEXT="${PACKAGE_BASE_VERSION}"
101 | AC_SUBST([MAGICKPP_LIB_VERSION_TEXT])
102 |
103 | # Definition used to define MagickLibVersionNumber in version.h
104 | MAGICKCACHE_LIB_VERSION_NUMBER="${MAGICKCACHE_LIBRARY_CURRENT},${MAGICKCACHE_LIBRARY_AGE},${MAGICKCACHE_LIBRARY_REVISION}"
105 | AC_SUBST([MAGICKCACHE_LIB_VERSION_NUMBER])
106 |
107 | MAGICKCACHE_PCFLAGS=$CPPFLAGS_USER
108 |
109 | # Remember externally set CFLAGS
110 | EXTERNAL_CFLAGS="$CFLAGS"
111 |
112 | # Checks for programs. These may set default variables, such as CFLAGS
113 | AC_PROG_CC
114 | AC_PROG_CPP
115 | AM_PROG_CC_C_O
116 | AC_PROG_INSTALL
117 |
118 | # Use the C language and compiler for the following checks
119 | AC_LANG([C])
120 |
121 | # Checks for libraries.
122 | PKG_CHECK_MODULES([MAGICKCORE], [MagickCore >= 7.1.0], [have_libMagickCore=yes], [have_libMagickCore=no])
123 | AM_CONDITIONAL([LIB_MAGICKCORE], [test "$have_libMagickCore" = "yes"])
124 |
125 | # Checks for header files.
126 | AC_CHECK_HEADERS([stdio.h])
127 |
128 | # Checks for typedefs, structures, and compiler characteristics.
129 | AC_TYPE_SIZE_T
130 |
131 | # Add debug support
132 | AC_ARG_ENABLE(debug,
133 | AS_HELP_STRING(
134 | [--enable-debug],
135 | [enable debugging, default: no]),
136 | [case "${enableval}" in
137 | yes) debug=true ;;
138 | no) debug=false ;;
139 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
140 | esac],
141 | [debug=false])
142 | AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
143 | AM_COND_IF(DEBUG,
144 | AC_DEFINE(DEBUG, 1, [Define to 0 if this is a release build]),
145 | AC_DEFINE(DEBUG, 0, [Define to 1 or higher if this is a debug build]))
146 |
147 | dnl ===========================================================================
148 |
149 | # Check for functions
150 | #
151 | AC_CHECK_FUNCS([sysconf])
152 |
153 | dnl ===========================================================================
154 |
155 | AC_SUBST([MAGICKCACHE_PCFLAGS])
156 |
157 | LT_INIT([win32-dll dlopen])
158 | LT_LANG([C++])
159 | AC_SUBST(LIBTOOL_DEPS)
160 |
161 | AC_CONFIG_FILES([Makefile
162 | config/configure.xml
163 | MagickCache/Makefile
164 | MagickCache/version.h
165 | MagickCache/MagickCache.pc
166 | MagickCache/MagickCache-config
167 | utilities/Makefile
168 | utilities/magick-cache.1
169 | tests/Makefile])
170 | AC_OUTPUT
171 |
172 | AC_MSG_NOTICE([Dumping MagickCache configuration:
173 | Compilation-related variables:
174 | CC = $CC
175 | CFLAGS = $CFLAGS
176 | CXX = $CXX
177 | CXXFLAGS = $CXXFLAGS
178 | LIBS = $LIBS
179 | LDFLAGS = $LDFLAGS
180 |
181 | Feature-related variables:
182 | ac_cv_header_HEADERNAME = $ac_cv_header_HEADERNAME
183 | ac_cv_func_FUNCTIONNAME = $ac_cv_func_FUNCTIONNAME
184 | ac_cv_type_TYPENAME = $ac_cv_type_TYPENAME
185 |
186 | System and architecture variables:
187 | host = $host
188 | host_alias = $host_alias
189 | host_cpu = $host_cpu
190 | host_vendor = $host_vendor
191 | host_os = $host_os
192 |
193 | Installation directories:
194 | prefix = $prefix
195 | exec_prefix = $exec_prefix
196 | bindir = $bindir
197 | libdir = $libdir
198 |
199 | Package information:
200 | PACKAGE = $PACKAGE
201 | VERSION = $VERSION])
202 |
--------------------------------------------------------------------------------
/depcomp:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # depcomp - compile a program generating dependencies as side-effects
3 |
4 | scriptversion=2018-03-07.03; # UTC
5 |
6 | # Copyright (C) 1999-2021 Free Software Foundation, Inc.
7 |
8 | # This program is free software; you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation; either version 2, or (at your option)
11 | # any later version.
12 |
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 |
18 | # You should have received a copy of the GNU General Public License
19 | # along with this program. If not, see .
20 |
21 | # As a special exception to the GNU General Public License, if you
22 | # distribute this file as part of a program that contains a
23 | # configuration script generated by Autoconf, you may include it under
24 | # the same distribution terms that you use for the rest of that program.
25 |
26 | # Originally written by Alexandre Oliva .
27 |
28 | case $1 in
29 | '')
30 | echo "$0: No command. Try '$0 --help' for more information." 1>&2
31 | exit 1;
32 | ;;
33 | -h | --h*)
34 | cat <<\EOF
35 | Usage: depcomp [--help] [--version] PROGRAM [ARGS]
36 |
37 | Run PROGRAMS ARGS to compile a file, generating dependencies
38 | as side-effects.
39 |
40 | Environment variables:
41 | depmode Dependency tracking mode.
42 | source Source file read by 'PROGRAMS ARGS'.
43 | object Object file output by 'PROGRAMS ARGS'.
44 | DEPDIR directory where to store dependencies.
45 | depfile Dependency file to output.
46 | tmpdepfile Temporary file to use when outputting dependencies.
47 | libtool Whether libtool is used (yes/no).
48 |
49 | Report bugs to .
50 | EOF
51 | exit $?
52 | ;;
53 | -v | --v*)
54 | echo "depcomp $scriptversion"
55 | exit $?
56 | ;;
57 | esac
58 |
59 | # Get the directory component of the given path, and save it in the
60 | # global variables '$dir'. Note that this directory component will
61 | # be either empty or ending with a '/' character. This is deliberate.
62 | set_dir_from ()
63 | {
64 | case $1 in
65 | */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
66 | *) dir=;;
67 | esac
68 | }
69 |
70 | # Get the suffix-stripped basename of the given path, and save it the
71 | # global variable '$base'.
72 | set_base_from ()
73 | {
74 | base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
75 | }
76 |
77 | # If no dependency file was actually created by the compiler invocation,
78 | # we still have to create a dummy depfile, to avoid errors with the
79 | # Makefile "include basename.Plo" scheme.
80 | make_dummy_depfile ()
81 | {
82 | echo "#dummy" > "$depfile"
83 | }
84 |
85 | # Factor out some common post-processing of the generated depfile.
86 | # Requires the auxiliary global variable '$tmpdepfile' to be set.
87 | aix_post_process_depfile ()
88 | {
89 | # If the compiler actually managed to produce a dependency file,
90 | # post-process it.
91 | if test -f "$tmpdepfile"; then
92 | # Each line is of the form 'foo.o: dependency.h'.
93 | # Do two passes, one to just change these to
94 | # $object: dependency.h
95 | # and one to simply output
96 | # dependency.h:
97 | # which is needed to avoid the deleted-header problem.
98 | { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
99 | sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
100 | } > "$depfile"
101 | rm -f "$tmpdepfile"
102 | else
103 | make_dummy_depfile
104 | fi
105 | }
106 |
107 | # A tabulation character.
108 | tab=' '
109 | # A newline character.
110 | nl='
111 | '
112 | # Character ranges might be problematic outside the C locale.
113 | # These definitions help.
114 | upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
115 | lower=abcdefghijklmnopqrstuvwxyz
116 | digits=0123456789
117 | alpha=${upper}${lower}
118 |
119 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then
120 | echo "depcomp: Variables source, object and depmode must be set" 1>&2
121 | exit 1
122 | fi
123 |
124 | # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
125 | depfile=${depfile-`echo "$object" |
126 | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
127 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
128 |
129 | rm -f "$tmpdepfile"
130 |
131 | # Avoid interferences from the environment.
132 | gccflag= dashmflag=
133 |
134 | # Some modes work just like other modes, but use different flags. We
135 | # parameterize here, but still list the modes in the big case below,
136 | # to make depend.m4 easier to write. Note that we *cannot* use a case
137 | # here, because this file can only contain one case statement.
138 | if test "$depmode" = hp; then
139 | # HP compiler uses -M and no extra arg.
140 | gccflag=-M
141 | depmode=gcc
142 | fi
143 |
144 | if test "$depmode" = dashXmstdout; then
145 | # This is just like dashmstdout with a different argument.
146 | dashmflag=-xM
147 | depmode=dashmstdout
148 | fi
149 |
150 | cygpath_u="cygpath -u -f -"
151 | if test "$depmode" = msvcmsys; then
152 | # This is just like msvisualcpp but w/o cygpath translation.
153 | # Just convert the backslash-escaped backslashes to single forward
154 | # slashes to satisfy depend.m4
155 | cygpath_u='sed s,\\\\,/,g'
156 | depmode=msvisualcpp
157 | fi
158 |
159 | if test "$depmode" = msvc7msys; then
160 | # This is just like msvc7 but w/o cygpath translation.
161 | # Just convert the backslash-escaped backslashes to single forward
162 | # slashes to satisfy depend.m4
163 | cygpath_u='sed s,\\\\,/,g'
164 | depmode=msvc7
165 | fi
166 |
167 | if test "$depmode" = xlc; then
168 | # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
169 | gccflag=-qmakedep=gcc,-MF
170 | depmode=gcc
171 | fi
172 |
173 | case "$depmode" in
174 | gcc3)
175 | ## gcc 3 implements dependency tracking that does exactly what
176 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
177 | ## it if -MD -MP comes after the -MF stuff. Hmm.
178 | ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
179 | ## the command line argument order; so add the flags where they
180 | ## appear in depend2.am. Note that the slowdown incurred here
181 | ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
182 | for arg
183 | do
184 | case $arg in
185 | -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
186 | *) set fnord "$@" "$arg" ;;
187 | esac
188 | shift # fnord
189 | shift # $arg
190 | done
191 | "$@"
192 | stat=$?
193 | if test $stat -ne 0; then
194 | rm -f "$tmpdepfile"
195 | exit $stat
196 | fi
197 | mv "$tmpdepfile" "$depfile"
198 | ;;
199 |
200 | gcc)
201 | ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
202 | ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
203 | ## (see the conditional assignment to $gccflag above).
204 | ## There are various ways to get dependency output from gcc. Here's
205 | ## why we pick this rather obscure method:
206 | ## - Don't want to use -MD because we'd like the dependencies to end
207 | ## up in a subdir. Having to rename by hand is ugly.
208 | ## (We might end up doing this anyway to support other compilers.)
209 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
210 | ## -MM, not -M (despite what the docs say). Also, it might not be
211 | ## supported by the other compilers which use the 'gcc' depmode.
212 | ## - Using -M directly means running the compiler twice (even worse
213 | ## than renaming).
214 | if test -z "$gccflag"; then
215 | gccflag=-MD,
216 | fi
217 | "$@" -Wp,"$gccflag$tmpdepfile"
218 | stat=$?
219 | if test $stat -ne 0; then
220 | rm -f "$tmpdepfile"
221 | exit $stat
222 | fi
223 | rm -f "$depfile"
224 | echo "$object : \\" > "$depfile"
225 | # The second -e expression handles DOS-style file names with drive
226 | # letters.
227 | sed -e 's/^[^:]*: / /' \
228 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
229 | ## This next piece of magic avoids the "deleted header file" problem.
230 | ## The problem is that when a header file which appears in a .P file
231 | ## is deleted, the dependency causes make to die (because there is
232 | ## typically no way to rebuild the header). We avoid this by adding
233 | ## dummy dependencies for each header file. Too bad gcc doesn't do
234 | ## this for us directly.
235 | ## Some versions of gcc put a space before the ':'. On the theory
236 | ## that the space means something, we add a space to the output as
237 | ## well. hp depmode also adds that space, but also prefixes the VPATH
238 | ## to the object. Take care to not repeat it in the output.
239 | ## Some versions of the HPUX 10.20 sed can't process this invocation
240 | ## correctly. Breaking it into two sed invocations is a workaround.
241 | tr ' ' "$nl" < "$tmpdepfile" \
242 | | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
243 | | sed -e 's/$/ :/' >> "$depfile"
244 | rm -f "$tmpdepfile"
245 | ;;
246 |
247 | hp)
248 | # This case exists only to let depend.m4 do its work. It works by
249 | # looking at the text of this script. This case will never be run,
250 | # since it is checked for above.
251 | exit 1
252 | ;;
253 |
254 | sgi)
255 | if test "$libtool" = yes; then
256 | "$@" "-Wp,-MDupdate,$tmpdepfile"
257 | else
258 | "$@" -MDupdate "$tmpdepfile"
259 | fi
260 | stat=$?
261 | if test $stat -ne 0; then
262 | rm -f "$tmpdepfile"
263 | exit $stat
264 | fi
265 | rm -f "$depfile"
266 |
267 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
268 | echo "$object : \\" > "$depfile"
269 | # Clip off the initial element (the dependent). Don't try to be
270 | # clever and replace this with sed code, as IRIX sed won't handle
271 | # lines with more than a fixed number of characters (4096 in
272 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
273 | # the IRIX cc adds comments like '#:fec' to the end of the
274 | # dependency line.
275 | tr ' ' "$nl" < "$tmpdepfile" \
276 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
277 | | tr "$nl" ' ' >> "$depfile"
278 | echo >> "$depfile"
279 | # The second pass generates a dummy entry for each header file.
280 | tr ' ' "$nl" < "$tmpdepfile" \
281 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
282 | >> "$depfile"
283 | else
284 | make_dummy_depfile
285 | fi
286 | rm -f "$tmpdepfile"
287 | ;;
288 |
289 | xlc)
290 | # This case exists only to let depend.m4 do its work. It works by
291 | # looking at the text of this script. This case will never be run,
292 | # since it is checked for above.
293 | exit 1
294 | ;;
295 |
296 | aix)
297 | # The C for AIX Compiler uses -M and outputs the dependencies
298 | # in a .u file. In older versions, this file always lives in the
299 | # current directory. Also, the AIX compiler puts '$object:' at the
300 | # start of each line; $object doesn't have directory information.
301 | # Version 6 uses the directory in both cases.
302 | set_dir_from "$object"
303 | set_base_from "$object"
304 | if test "$libtool" = yes; then
305 | tmpdepfile1=$dir$base.u
306 | tmpdepfile2=$base.u
307 | tmpdepfile3=$dir.libs/$base.u
308 | "$@" -Wc,-M
309 | else
310 | tmpdepfile1=$dir$base.u
311 | tmpdepfile2=$dir$base.u
312 | tmpdepfile3=$dir$base.u
313 | "$@" -M
314 | fi
315 | stat=$?
316 | if test $stat -ne 0; then
317 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
318 | exit $stat
319 | fi
320 |
321 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
322 | do
323 | test -f "$tmpdepfile" && break
324 | done
325 | aix_post_process_depfile
326 | ;;
327 |
328 | tcc)
329 | # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
330 | # FIXME: That version still under development at the moment of writing.
331 | # Make that this statement remains true also for stable, released
332 | # versions.
333 | # It will wrap lines (doesn't matter whether long or short) with a
334 | # trailing '\', as in:
335 | #
336 | # foo.o : \
337 | # foo.c \
338 | # foo.h \
339 | #
340 | # It will put a trailing '\' even on the last line, and will use leading
341 | # spaces rather than leading tabs (at least since its commit 0394caf7
342 | # "Emit spaces for -MD").
343 | "$@" -MD -MF "$tmpdepfile"
344 | stat=$?
345 | if test $stat -ne 0; then
346 | rm -f "$tmpdepfile"
347 | exit $stat
348 | fi
349 | rm -f "$depfile"
350 | # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
351 | # We have to change lines of the first kind to '$object: \'.
352 | sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
353 | # And for each line of the second kind, we have to emit a 'dep.h:'
354 | # dummy dependency, to avoid the deleted-header problem.
355 | sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
356 | rm -f "$tmpdepfile"
357 | ;;
358 |
359 | ## The order of this option in the case statement is important, since the
360 | ## shell code in configure will try each of these formats in the order
361 | ## listed in this file. A plain '-MD' option would be understood by many
362 | ## compilers, so we must ensure this comes after the gcc and icc options.
363 | pgcc)
364 | # Portland's C compiler understands '-MD'.
365 | # Will always output deps to 'file.d' where file is the root name of the
366 | # source file under compilation, even if file resides in a subdirectory.
367 | # The object file name does not affect the name of the '.d' file.
368 | # pgcc 10.2 will output
369 | # foo.o: sub/foo.c sub/foo.h
370 | # and will wrap long lines using '\' :
371 | # foo.o: sub/foo.c ... \
372 | # sub/foo.h ... \
373 | # ...
374 | set_dir_from "$object"
375 | # Use the source, not the object, to determine the base name, since
376 | # that's sadly what pgcc will do too.
377 | set_base_from "$source"
378 | tmpdepfile=$base.d
379 |
380 | # For projects that build the same source file twice into different object
381 | # files, the pgcc approach of using the *source* file root name can cause
382 | # problems in parallel builds. Use a locking strategy to avoid stomping on
383 | # the same $tmpdepfile.
384 | lockdir=$base.d-lock
385 | trap "
386 | echo '$0: caught signal, cleaning up...' >&2
387 | rmdir '$lockdir'
388 | exit 1
389 | " 1 2 13 15
390 | numtries=100
391 | i=$numtries
392 | while test $i -gt 0; do
393 | # mkdir is a portable test-and-set.
394 | if mkdir "$lockdir" 2>/dev/null; then
395 | # This process acquired the lock.
396 | "$@" -MD
397 | stat=$?
398 | # Release the lock.
399 | rmdir "$lockdir"
400 | break
401 | else
402 | # If the lock is being held by a different process, wait
403 | # until the winning process is done or we timeout.
404 | while test -d "$lockdir" && test $i -gt 0; do
405 | sleep 1
406 | i=`expr $i - 1`
407 | done
408 | fi
409 | i=`expr $i - 1`
410 | done
411 | trap - 1 2 13 15
412 | if test $i -le 0; then
413 | echo "$0: failed to acquire lock after $numtries attempts" >&2
414 | echo "$0: check lockdir '$lockdir'" >&2
415 | exit 1
416 | fi
417 |
418 | if test $stat -ne 0; then
419 | rm -f "$tmpdepfile"
420 | exit $stat
421 | fi
422 | rm -f "$depfile"
423 | # Each line is of the form `foo.o: dependent.h',
424 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
425 | # Do two passes, one to just change these to
426 | # `$object: dependent.h' and one to simply `dependent.h:'.
427 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
428 | # Some versions of the HPUX 10.20 sed can't process this invocation
429 | # correctly. Breaking it into two sed invocations is a workaround.
430 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
431 | | sed -e 's/$/ :/' >> "$depfile"
432 | rm -f "$tmpdepfile"
433 | ;;
434 |
435 | hp2)
436 | # The "hp" stanza above does not work with aCC (C++) and HP's ia64
437 | # compilers, which have integrated preprocessors. The correct option
438 | # to use with these is +Maked; it writes dependencies to a file named
439 | # 'foo.d', which lands next to the object file, wherever that
440 | # happens to be.
441 | # Much of this is similar to the tru64 case; see comments there.
442 | set_dir_from "$object"
443 | set_base_from "$object"
444 | if test "$libtool" = yes; then
445 | tmpdepfile1=$dir$base.d
446 | tmpdepfile2=$dir.libs/$base.d
447 | "$@" -Wc,+Maked
448 | else
449 | tmpdepfile1=$dir$base.d
450 | tmpdepfile2=$dir$base.d
451 | "$@" +Maked
452 | fi
453 | stat=$?
454 | if test $stat -ne 0; then
455 | rm -f "$tmpdepfile1" "$tmpdepfile2"
456 | exit $stat
457 | fi
458 |
459 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
460 | do
461 | test -f "$tmpdepfile" && break
462 | done
463 | if test -f "$tmpdepfile"; then
464 | sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
465 | # Add 'dependent.h:' lines.
466 | sed -ne '2,${
467 | s/^ *//
468 | s/ \\*$//
469 | s/$/:/
470 | p
471 | }' "$tmpdepfile" >> "$depfile"
472 | else
473 | make_dummy_depfile
474 | fi
475 | rm -f "$tmpdepfile" "$tmpdepfile2"
476 | ;;
477 |
478 | tru64)
479 | # The Tru64 compiler uses -MD to generate dependencies as a side
480 | # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
481 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
482 | # dependencies in 'foo.d' instead, so we check for that too.
483 | # Subdirectories are respected.
484 | set_dir_from "$object"
485 | set_base_from "$object"
486 |
487 | if test "$libtool" = yes; then
488 | # Libtool generates 2 separate objects for the 2 libraries. These
489 | # two compilations output dependencies in $dir.libs/$base.o.d and
490 | # in $dir$base.o.d. We have to check for both files, because
491 | # one of the two compilations can be disabled. We should prefer
492 | # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
493 | # automatically cleaned when .libs/ is deleted, while ignoring
494 | # the former would cause a distcleancheck panic.
495 | tmpdepfile1=$dir$base.o.d # libtool 1.5
496 | tmpdepfile2=$dir.libs/$base.o.d # Likewise.
497 | tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
498 | "$@" -Wc,-MD
499 | else
500 | tmpdepfile1=$dir$base.d
501 | tmpdepfile2=$dir$base.d
502 | tmpdepfile3=$dir$base.d
503 | "$@" -MD
504 | fi
505 |
506 | stat=$?
507 | if test $stat -ne 0; then
508 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
509 | exit $stat
510 | fi
511 |
512 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
513 | do
514 | test -f "$tmpdepfile" && break
515 | done
516 | # Same post-processing that is required for AIX mode.
517 | aix_post_process_depfile
518 | ;;
519 |
520 | msvc7)
521 | if test "$libtool" = yes; then
522 | showIncludes=-Wc,-showIncludes
523 | else
524 | showIncludes=-showIncludes
525 | fi
526 | "$@" $showIncludes > "$tmpdepfile"
527 | stat=$?
528 | grep -v '^Note: including file: ' "$tmpdepfile"
529 | if test $stat -ne 0; then
530 | rm -f "$tmpdepfile"
531 | exit $stat
532 | fi
533 | rm -f "$depfile"
534 | echo "$object : \\" > "$depfile"
535 | # The first sed program below extracts the file names and escapes
536 | # backslashes for cygpath. The second sed program outputs the file
537 | # name when reading, but also accumulates all include files in the
538 | # hold buffer in order to output them again at the end. This only
539 | # works with sed implementations that can handle large buffers.
540 | sed < "$tmpdepfile" -n '
541 | /^Note: including file: *\(.*\)/ {
542 | s//\1/
543 | s/\\/\\\\/g
544 | p
545 | }' | $cygpath_u | sort -u | sed -n '
546 | s/ /\\ /g
547 | s/\(.*\)/'"$tab"'\1 \\/p
548 | s/.\(.*\) \\/\1:/
549 | H
550 | $ {
551 | s/.*/'"$tab"'/
552 | G
553 | p
554 | }' >> "$depfile"
555 | echo >> "$depfile" # make sure the fragment doesn't end with a backslash
556 | rm -f "$tmpdepfile"
557 | ;;
558 |
559 | msvc7msys)
560 | # This case exists only to let depend.m4 do its work. It works by
561 | # looking at the text of this script. This case will never be run,
562 | # since it is checked for above.
563 | exit 1
564 | ;;
565 |
566 | #nosideeffect)
567 | # This comment above is used by automake to tell side-effect
568 | # dependency tracking mechanisms from slower ones.
569 |
570 | dashmstdout)
571 | # Important note: in order to support this mode, a compiler *must*
572 | # always write the preprocessed file to stdout, regardless of -o.
573 | "$@" || exit $?
574 |
575 | # Remove the call to Libtool.
576 | if test "$libtool" = yes; then
577 | while test "X$1" != 'X--mode=compile'; do
578 | shift
579 | done
580 | shift
581 | fi
582 |
583 | # Remove '-o $object'.
584 | IFS=" "
585 | for arg
586 | do
587 | case $arg in
588 | -o)
589 | shift
590 | ;;
591 | $object)
592 | shift
593 | ;;
594 | *)
595 | set fnord "$@" "$arg"
596 | shift # fnord
597 | shift # $arg
598 | ;;
599 | esac
600 | done
601 |
602 | test -z "$dashmflag" && dashmflag=-M
603 | # Require at least two characters before searching for ':'
604 | # in the target name. This is to cope with DOS-style filenames:
605 | # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
606 | "$@" $dashmflag |
607 | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
608 | rm -f "$depfile"
609 | cat < "$tmpdepfile" > "$depfile"
610 | # Some versions of the HPUX 10.20 sed can't process this sed invocation
611 | # correctly. Breaking it into two sed invocations is a workaround.
612 | tr ' ' "$nl" < "$tmpdepfile" \
613 | | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
614 | | sed -e 's/$/ :/' >> "$depfile"
615 | rm -f "$tmpdepfile"
616 | ;;
617 |
618 | dashXmstdout)
619 | # This case only exists to satisfy depend.m4. It is never actually
620 | # run, as this mode is specially recognized in the preamble.
621 | exit 1
622 | ;;
623 |
624 | makedepend)
625 | "$@" || exit $?
626 | # Remove any Libtool call
627 | if test "$libtool" = yes; then
628 | while test "X$1" != 'X--mode=compile'; do
629 | shift
630 | done
631 | shift
632 | fi
633 | # X makedepend
634 | shift
635 | cleared=no eat=no
636 | for arg
637 | do
638 | case $cleared in
639 | no)
640 | set ""; shift
641 | cleared=yes ;;
642 | esac
643 | if test $eat = yes; then
644 | eat=no
645 | continue
646 | fi
647 | case "$arg" in
648 | -D*|-I*)
649 | set fnord "$@" "$arg"; shift ;;
650 | # Strip any option that makedepend may not understand. Remove
651 | # the object too, otherwise makedepend will parse it as a source file.
652 | -arch)
653 | eat=yes ;;
654 | -*|$object)
655 | ;;
656 | *)
657 | set fnord "$@" "$arg"; shift ;;
658 | esac
659 | done
660 | obj_suffix=`echo "$object" | sed 's/^.*\././'`
661 | touch "$tmpdepfile"
662 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
663 | rm -f "$depfile"
664 | # makedepend may prepend the VPATH from the source file name to the object.
665 | # No need to regex-escape $object, excess matching of '.' is harmless.
666 | sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
667 | # Some versions of the HPUX 10.20 sed can't process the last invocation
668 | # correctly. Breaking it into two sed invocations is a workaround.
669 | sed '1,2d' "$tmpdepfile" \
670 | | tr ' ' "$nl" \
671 | | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
672 | | sed -e 's/$/ :/' >> "$depfile"
673 | rm -f "$tmpdepfile" "$tmpdepfile".bak
674 | ;;
675 |
676 | cpp)
677 | # Important note: in order to support this mode, a compiler *must*
678 | # always write the preprocessed file to stdout.
679 | "$@" || exit $?
680 |
681 | # Remove the call to Libtool.
682 | if test "$libtool" = yes; then
683 | while test "X$1" != 'X--mode=compile'; do
684 | shift
685 | done
686 | shift
687 | fi
688 |
689 | # Remove '-o $object'.
690 | IFS=" "
691 | for arg
692 | do
693 | case $arg in
694 | -o)
695 | shift
696 | ;;
697 | $object)
698 | shift
699 | ;;
700 | *)
701 | set fnord "$@" "$arg"
702 | shift # fnord
703 | shift # $arg
704 | ;;
705 | esac
706 | done
707 |
708 | "$@" -E \
709 | | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
710 | -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
711 | | sed '$ s: \\$::' > "$tmpdepfile"
712 | rm -f "$depfile"
713 | echo "$object : \\" > "$depfile"
714 | cat < "$tmpdepfile" >> "$depfile"
715 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
716 | rm -f "$tmpdepfile"
717 | ;;
718 |
719 | msvisualcpp)
720 | # Important note: in order to support this mode, a compiler *must*
721 | # always write the preprocessed file to stdout.
722 | "$@" || exit $?
723 |
724 | # Remove the call to Libtool.
725 | if test "$libtool" = yes; then
726 | while test "X$1" != 'X--mode=compile'; do
727 | shift
728 | done
729 | shift
730 | fi
731 |
732 | IFS=" "
733 | for arg
734 | do
735 | case "$arg" in
736 | -o)
737 | shift
738 | ;;
739 | $object)
740 | shift
741 | ;;
742 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
743 | set fnord "$@"
744 | shift
745 | shift
746 | ;;
747 | *)
748 | set fnord "$@" "$arg"
749 | shift
750 | shift
751 | ;;
752 | esac
753 | done
754 | "$@" -E 2>/dev/null |
755 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
756 | rm -f "$depfile"
757 | echo "$object : \\" > "$depfile"
758 | sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
759 | echo "$tab" >> "$depfile"
760 | sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
761 | rm -f "$tmpdepfile"
762 | ;;
763 |
764 | msvcmsys)
765 | # This case exists only to let depend.m4 do its work. It works by
766 | # looking at the text of this script. This case will never be run,
767 | # since it is checked for above.
768 | exit 1
769 | ;;
770 |
771 | none)
772 | exec "$@"
773 | ;;
774 |
775 | *)
776 | echo "Unknown depmode $depmode" 1>&2
777 | exit 1
778 | ;;
779 | esac
780 |
781 | exit 0
782 |
783 | # Local Variables:
784 | # mode: shell-script
785 | # sh-indentation: 2
786 | # eval: (add-hook 'before-save-hook 'time-stamp)
787 | # time-stamp-start: "scriptversion="
788 | # time-stamp-format: "%:y-%02m-%02d.%02H"
789 | # time-stamp-time-zone: "UTC0"
790 | # time-stamp-end: "; # UTC"
791 | # End:
792 |
--------------------------------------------------------------------------------
/install-sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/sh
2 | # install - install a program, script, or datafile
3 |
4 | scriptversion=2023-11-23.18; # UTC
5 |
6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was
7 | # later released in X11R6 (xc/config/util/install.sh) with the
8 | # following copyright and license.
9 | #
10 | # Copyright (C) 1994 X Consortium
11 | #
12 | # Permission is hereby granted, free of charge, to any person obtaining a copy
13 | # of this software and associated documentation files (the "Software"), to
14 | # deal in the Software without restriction, including without limitation the
15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 | # sell copies of the Software, and to permit persons to whom the Software is
17 | # furnished to do so, subject to the following conditions:
18 | #
19 | # The above copyright notice and this permission notice shall be included in
20 | # all copies or substantial portions of the Software.
21 | #
22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 | #
29 | # Except as contained in this notice, the name of the X Consortium shall not
30 | # be used in advertising or otherwise to promote the sale, use or other deal-
31 | # ings in this Software without prior written authorization from the X Consor-
32 | # tium.
33 | #
34 | #
35 | # FSF changes to this file are in the public domain.
36 | #
37 | # Calling this script install-sh is preferred over install.sh, to prevent
38 | # 'make' implicit rules from creating a file called install from it
39 | # when there is no Makefile.
40 | #
41 | # This script is compatible with the BSD install script, but was written
42 | # from scratch.
43 |
44 | tab=' '
45 | nl='
46 | '
47 | IFS=" $tab$nl"
48 |
49 | # Set DOITPROG to "echo" to test this script.
50 |
51 | doit=${DOITPROG-}
52 | doit_exec=${doit:-exec}
53 |
54 | # Put in absolute file names if you don't have them in your path;
55 | # or use environment vars.
56 |
57 | chgrpprog=${CHGRPPROG-chgrp}
58 | chmodprog=${CHMODPROG-chmod}
59 | chownprog=${CHOWNPROG-chown}
60 | cmpprog=${CMPPROG-cmp}
61 | cpprog=${CPPROG-cp}
62 | mkdirprog=${MKDIRPROG-mkdir}
63 | mvprog=${MVPROG-mv}
64 | rmprog=${RMPROG-rm}
65 | stripprog=${STRIPPROG-strip}
66 |
67 | posix_mkdir=
68 |
69 | # Desired mode of installed file.
70 | mode=0755
71 |
72 | # Create dirs (including intermediate dirs) using mode 755.
73 | # This is like GNU 'install' as of coreutils 8.32 (2020).
74 | mkdir_umask=22
75 |
76 | backupsuffix=
77 | chgrpcmd=
78 | chmodcmd=$chmodprog
79 | chowncmd=
80 | mvcmd=$mvprog
81 | rmcmd="$rmprog -f"
82 | stripcmd=
83 |
84 | src=
85 | dst=
86 | dir_arg=
87 | dst_arg=
88 |
89 | copy_on_change=false
90 | is_target_a_directory=possibly
91 |
92 | usage="\
93 | Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
94 | or: $0 [OPTION]... SRCFILES... DIRECTORY
95 | or: $0 [OPTION]... -t DIRECTORY SRCFILES...
96 | or: $0 [OPTION]... -d DIRECTORIES...
97 |
98 | In the 1st form, copy SRCFILE to DSTFILE.
99 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
100 | In the 4th, create DIRECTORIES.
101 |
102 | Options:
103 | --help display this help and exit.
104 | --version display version info and exit.
105 |
106 | -c (ignored)
107 | -C install only if different (preserve data modification time)
108 | -d create directories instead of installing files.
109 | -g GROUP $chgrpprog installed files to GROUP.
110 | -m MODE $chmodprog installed files to MODE.
111 | -o USER $chownprog installed files to USER.
112 | -p pass -p to $cpprog.
113 | -s $stripprog installed files.
114 | -S SUFFIX attempt to back up existing files, with suffix SUFFIX.
115 | -t DIRECTORY install into DIRECTORY.
116 | -T report an error if DSTFILE is a directory.
117 |
118 | Environment variables override the default commands:
119 | CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
120 | RMPROG STRIPPROG
121 |
122 | By default, rm is invoked with -f; when overridden with RMPROG,
123 | it's up to you to specify -f if you want it.
124 |
125 | If -S is not specified, no backups are attempted.
126 |
127 | Report bugs to .
128 | GNU Automake home page: .
129 | General help using GNU software: ."
130 |
131 | while test $# -ne 0; do
132 | case $1 in
133 | -c) ;;
134 |
135 | -C) copy_on_change=true;;
136 |
137 | -d) dir_arg=true;;
138 |
139 | -g) chgrpcmd="$chgrpprog $2"
140 | shift;;
141 |
142 | --help) echo "$usage"; exit $?;;
143 |
144 | -m) mode=$2
145 | case $mode in
146 | *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
147 | echo "$0: invalid mode: $mode" >&2
148 | exit 1;;
149 | esac
150 | shift;;
151 |
152 | -o) chowncmd="$chownprog $2"
153 | shift;;
154 |
155 | -p) cpprog="$cpprog -p";;
156 |
157 | -s) stripcmd=$stripprog;;
158 |
159 | -S) backupsuffix="$2"
160 | shift;;
161 |
162 | -t)
163 | is_target_a_directory=always
164 | dst_arg=$2
165 | # Protect names problematic for 'test' and other utilities.
166 | case $dst_arg in
167 | -* | [=\(\)!]) dst_arg=./$dst_arg;;
168 | esac
169 | shift;;
170 |
171 | -T) is_target_a_directory=never;;
172 |
173 | --version) echo "$0 $scriptversion"; exit $?;;
174 |
175 | --) shift
176 | break;;
177 |
178 | -*) echo "$0: invalid option: $1" >&2
179 | exit 1;;
180 |
181 | *) break;;
182 | esac
183 | shift
184 | done
185 |
186 | # We allow the use of options -d and -T together, by making -d
187 | # take the precedence; this is for compatibility with GNU install.
188 |
189 | if test -n "$dir_arg"; then
190 | if test -n "$dst_arg"; then
191 | echo "$0: target directory not allowed when installing a directory." >&2
192 | exit 1
193 | fi
194 | fi
195 |
196 | if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
197 | # When -d is used, all remaining arguments are directories to create.
198 | # When -t is used, the destination is already specified.
199 | # Otherwise, the last argument is the destination. Remove it from $@.
200 | for arg
201 | do
202 | if test -n "$dst_arg"; then
203 | # $@ is not empty: it contains at least $arg.
204 | set fnord "$@" "$dst_arg"
205 | shift # fnord
206 | fi
207 | shift # arg
208 | dst_arg=$arg
209 | # Protect names problematic for 'test' and other utilities.
210 | case $dst_arg in
211 | -* | [=\(\)!]) dst_arg=./$dst_arg;;
212 | esac
213 | done
214 | fi
215 |
216 | if test $# -eq 0; then
217 | if test -z "$dir_arg"; then
218 | echo "$0: no input file specified." >&2
219 | exit 1
220 | fi
221 | # It's OK to call 'install-sh -d' without argument.
222 | # This can happen when creating conditional directories.
223 | exit 0
224 | fi
225 |
226 | if test -z "$dir_arg"; then
227 | if test $# -gt 1 || test "$is_target_a_directory" = always; then
228 | if test ! -d "$dst_arg"; then
229 | echo "$0: $dst_arg: Is not a directory." >&2
230 | exit 1
231 | fi
232 | fi
233 | fi
234 |
235 | if test -z "$dir_arg"; then
236 | do_exit='(exit $ret); exit $ret'
237 | trap "ret=129; $do_exit" 1
238 | trap "ret=130; $do_exit" 2
239 | trap "ret=141; $do_exit" 13
240 | trap "ret=143; $do_exit" 15
241 |
242 | # Set umask so as not to create temps with too-generous modes.
243 | # However, 'strip' requires both read and write access to temps.
244 | case $mode in
245 | # Optimize common cases.
246 | *644) cp_umask=133;;
247 | *755) cp_umask=22;;
248 |
249 | *[0-7])
250 | if test -z "$stripcmd"; then
251 | u_plus_rw=
252 | else
253 | u_plus_rw='% 200'
254 | fi
255 | cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
256 | *)
257 | if test -z "$stripcmd"; then
258 | u_plus_rw=
259 | else
260 | u_plus_rw=,u+rw
261 | fi
262 | cp_umask=$mode$u_plus_rw;;
263 | esac
264 | fi
265 |
266 | for src
267 | do
268 | # Protect names problematic for 'test' and other utilities.
269 | case $src in
270 | -* | [=\(\)!]) src=./$src;;
271 | esac
272 |
273 | if test -n "$dir_arg"; then
274 | dst=$src
275 | dstdir=$dst
276 | test -d "$dstdir"
277 | dstdir_status=$?
278 | # Don't chown directories that already exist.
279 | if test $dstdir_status = 0; then
280 | chowncmd=""
281 | fi
282 | else
283 |
284 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
285 | # might cause directories to be created, which would be especially bad
286 | # if $src (and thus $dsttmp) contains '*'.
287 | if test ! -f "$src" && test ! -d "$src"; then
288 | echo "$0: $src does not exist." >&2
289 | exit 1
290 | fi
291 |
292 | if test -z "$dst_arg"; then
293 | echo "$0: no destination specified." >&2
294 | exit 1
295 | fi
296 | dst=$dst_arg
297 |
298 | # If destination is a directory, append the input filename.
299 | if test -d "$dst"; then
300 | if test "$is_target_a_directory" = never; then
301 | echo "$0: $dst_arg: Is a directory" >&2
302 | exit 1
303 | fi
304 | dstdir=$dst
305 | dstbase=`basename "$src"`
306 | case $dst in
307 | */) dst=$dst$dstbase;;
308 | *) dst=$dst/$dstbase;;
309 | esac
310 | dstdir_status=0
311 | else
312 | dstdir=`dirname "$dst"`
313 | test -d "$dstdir"
314 | dstdir_status=$?
315 | fi
316 | fi
317 |
318 | case $dstdir in
319 | */) dstdirslash=$dstdir;;
320 | *) dstdirslash=$dstdir/;;
321 | esac
322 |
323 | obsolete_mkdir_used=false
324 |
325 | if test $dstdir_status != 0; then
326 | case $posix_mkdir in
327 | '')
328 | # With -d, create the new directory with the user-specified mode.
329 | # Otherwise, rely on $mkdir_umask.
330 | if test -n "$dir_arg"; then
331 | mkdir_mode=-m$mode
332 | else
333 | mkdir_mode=
334 | fi
335 |
336 | posix_mkdir=false
337 | # The $RANDOM variable is not portable (e.g., dash). Use it
338 | # here however when possible just to lower collision chance.
339 | tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
340 |
341 | trap '
342 | ret=$?
343 | rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
344 | exit $ret
345 | ' 0
346 |
347 | # Because "mkdir -p" follows existing symlinks and we likely work
348 | # directly in world-writeable /tmp, make sure that the '$tmpdir'
349 | # directory is successfully created first before we actually test
350 | # 'mkdir -p'.
351 | if (umask $mkdir_umask &&
352 | $mkdirprog $mkdir_mode "$tmpdir" &&
353 | exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
354 | then
355 | if test -z "$dir_arg" || {
356 | # Check for POSIX incompatibilities with -m.
357 | # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
358 | # other-writable bit of parent directory when it shouldn't.
359 | # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
360 | test_tmpdir="$tmpdir/a"
361 | ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
362 | case $ls_ld_tmpdir in
363 | d????-?r-*) different_mode=700;;
364 | d????-?--*) different_mode=755;;
365 | *) false;;
366 | esac &&
367 | $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
368 | ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
369 | test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
370 | }
371 | }
372 | then posix_mkdir=:
373 | fi
374 | rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
375 | else
376 | # Remove any dirs left behind by ancient mkdir implementations.
377 | rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
378 | fi
379 | trap '' 0;;
380 | esac
381 |
382 | if
383 | $posix_mkdir && (
384 | umask $mkdir_umask &&
385 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
386 | )
387 | then :
388 | else
389 |
390 | # mkdir does not conform to POSIX,
391 | # or it failed possibly due to a race condition. Create the
392 | # directory the slow way, step by step, checking for races as we go.
393 |
394 | case $dstdir in
395 | /*) prefix='/';;
396 | [-=\(\)!]*) prefix='./';;
397 | *) prefix='';;
398 | esac
399 |
400 | oIFS=$IFS
401 | IFS=/
402 | set -f
403 | set fnord $dstdir
404 | shift
405 | set +f
406 | IFS=$oIFS
407 |
408 | prefixes=
409 |
410 | for d
411 | do
412 | test X"$d" = X && continue
413 |
414 | prefix=$prefix$d
415 | if test -d "$prefix"; then
416 | prefixes=
417 | else
418 | if $posix_mkdir; then
419 | (umask $mkdir_umask &&
420 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
421 | # Don't fail if two instances are running concurrently.
422 | test -d "$prefix" || exit 1
423 | else
424 | case $prefix in
425 | *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
426 | *) qprefix=$prefix;;
427 | esac
428 | prefixes="$prefixes '$qprefix'"
429 | fi
430 | fi
431 | prefix=$prefix/
432 | done
433 |
434 | if test -n "$prefixes"; then
435 | # Don't fail if two instances are running concurrently.
436 | (umask $mkdir_umask &&
437 | eval "\$doit_exec \$mkdirprog $prefixes") ||
438 | test -d "$dstdir" || exit 1
439 | obsolete_mkdir_used=true
440 | fi
441 | fi
442 | fi
443 |
444 | if test -n "$dir_arg"; then
445 | { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
446 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
447 | { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
448 | test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
449 | else
450 |
451 | # Make a couple of temp file names in the proper directory.
452 | dsttmp=${dstdirslash}_inst.$$_
453 | rmtmp=${dstdirslash}_rm.$$_
454 |
455 | # Trap to clean up those temp files at exit.
456 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
457 |
458 | # Copy the file name to the temp name.
459 | (umask $cp_umask &&
460 | { test -z "$stripcmd" || {
461 | # Create $dsttmp read-write so that cp doesn't create it read-only,
462 | # which would cause strip to fail.
463 | if test -z "$doit"; then
464 | : >"$dsttmp" # No need to fork-exec 'touch'.
465 | else
466 | $doit touch "$dsttmp"
467 | fi
468 | }
469 | } &&
470 | $doit_exec $cpprog "$src" "$dsttmp") &&
471 |
472 | # and set any options; do chmod last to preserve setuid bits.
473 | #
474 | # If any of these fail, we abort the whole thing. If we want to
475 | # ignore errors from any of these, just make sure not to ignore
476 | # errors from the above "$doit $cpprog $src $dsttmp" command.
477 | #
478 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
479 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
480 | { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
481 | { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
482 |
483 | # If -C, don't bother to copy if it wouldn't change the file.
484 | if $copy_on_change &&
485 | old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
486 | new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
487 | set -f &&
488 | set X $old && old=:$2:$4:$5:$6 &&
489 | set X $new && new=:$2:$4:$5:$6 &&
490 | set +f &&
491 | test "$old" = "$new" &&
492 | $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
493 | then
494 | rm -f "$dsttmp"
495 | else
496 | # If $backupsuffix is set, and the file being installed
497 | # already exists, attempt a backup. Don't worry if it fails,
498 | # e.g., if mv doesn't support -f.
499 | if test -n "$backupsuffix" && test -f "$dst"; then
500 | $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
501 | fi
502 |
503 | # Rename the file to the real destination.
504 | $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
505 |
506 | # The rename failed, perhaps because mv can't rename something else
507 | # to itself, or perhaps because mv is so ancient that it does not
508 | # support -f.
509 | {
510 | # Now remove or move aside any old file at destination location.
511 | # We try this two ways since rm can't unlink itself on some
512 | # systems and the destination file might be busy for other
513 | # reasons. In this case, the final cleanup might fail but the new
514 | # file should still install successfully.
515 | {
516 | test ! -f "$dst" ||
517 | $doit $rmcmd "$dst" 2>/dev/null ||
518 | { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
519 | { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
520 | } ||
521 | { echo "$0: cannot unlink or rename $dst" >&2
522 | (exit 1); exit 1
523 | }
524 | } &&
525 |
526 | # Now rename the file to the real destination.
527 | $doit $mvcmd "$dsttmp" "$dst"
528 | }
529 | fi || exit 1
530 |
531 | trap '' 0
532 | fi
533 | done
534 |
535 | # Local variables:
536 | # eval: (add-hook 'before-save-hook 'time-stamp)
537 | # time-stamp-start: "scriptversion="
538 | # time-stamp-format: "%:y-%02m-%02d.%02H"
539 | # time-stamp-time-zone: "UTC0"
540 | # time-stamp-end: "; # UTC"
541 | # End:
542 |
--------------------------------------------------------------------------------
/m4/version.m4:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization
2 | # dedicated to making software imaging solutions freely available.
3 | #
4 | # You may not use this file except in compliance with the License. You may
5 | # obtain a copy of the License at
6 | #
7 | # https://imagemagick.org/script/license.php
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | # Given a version number MAJOR.MINOR.MICRO-PATCH, increment the:
16 | #
17 | # 1. MAJOR version for incompatible API changes,
18 | # 2. MINOR version when MICRO version exceeds 15 e.g. 0x70F becomes 0x710
19 | # 3. MICRO version for added functionality in backwards compatible
20 | # manner, and
21 | # 4. PATCH version when you make backwards compatible bug fixes.
22 | #
23 | # Additional labels for pre-release and build metadata are available as
24 | # extensions to the MAJOR.MINOR.MICRO-PATCH format.
25 | #
26 | m4_define([magickcache_name], [MagickCache])
27 | m4_define([magickcache_major_version], [1])
28 | m4_define([magickcache_minor_version], [0])
29 | m4_define([magickcache_micro_version], [0])
30 | m4_define([magickcache_patchlevel_version], [1])
31 | m4_define([magickcache_bugreport],
32 | [https://github.com/ImageMagick/MagickCache/issues])
33 | m4_define([magickcache_url], [https://imagemagick.org])
34 | m4_define([magickcache_lib_version], [0x10A])
35 | m4_define([magickcache_tarname],[MagickCache])
36 |
37 | #
38 | # If the library source code has changed at all since the last update,
39 | # increment revision (‘c:r:a’ becomes ‘c:r+1:a’). If any interfaces have been
40 | # added, removed, or changed since the last update, increment current, and set
41 | # revision to 0. If any interfaces have been added since the last public
42 | # release, then increment age. If any interfaces have been removed or changed
43 | # since the last public release, then set age to 0.
44 | #
45 | # PLEASE NOTE that doing a SO BUMP aka raising the CURRENT REVISION
46 | # could be avoided using libversioning aka map files. You MUST change .map
47 | # files if you raise these versions.
48 | #
49 | # Bump the minor release # whenever there is an SOVersion bump.
50 | m4_define([magickcache_library_current], [0])
51 | m4_define([magickcache_library_revision], [0])
52 | m4_define([magickcache_library_age], [0])
53 |
--------------------------------------------------------------------------------
/missing:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # Common wrapper for a few potentially missing GNU programs.
3 |
4 | scriptversion=2018-03-07.03; # UTC
5 |
6 | # Copyright (C) 1996-2021 Free Software Foundation, Inc.
7 | # Originally written by Fran,cois Pinard , 1996.
8 |
9 | # This program is free software; you can redistribute it and/or modify
10 | # it under the terms of the GNU General Public License as published by
11 | # the Free Software Foundation; either version 2, or (at your option)
12 | # any later version.
13 |
14 | # This program is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 |
19 | # You should have received a copy of the GNU General Public License
20 | # along with this program. If not, see .
21 |
22 | # As a special exception to the GNU General Public License, if you
23 | # distribute this file as part of a program that contains a
24 | # configuration script generated by Autoconf, you may include it under
25 | # the same distribution terms that you use for the rest of that program.
26 |
27 | if test $# -eq 0; then
28 | echo 1>&2 "Try '$0 --help' for more information"
29 | exit 1
30 | fi
31 |
32 | case $1 in
33 |
34 | --is-lightweight)
35 | # Used by our autoconf macros to check whether the available missing
36 | # script is modern enough.
37 | exit 0
38 | ;;
39 |
40 | --run)
41 | # Back-compat with the calling convention used by older automake.
42 | shift
43 | ;;
44 |
45 | -h|--h|--he|--hel|--help)
46 | echo "\
47 | $0 [OPTION]... PROGRAM [ARGUMENT]...
48 |
49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
50 | to PROGRAM being missing or too old.
51 |
52 | Options:
53 | -h, --help display this help and exit
54 | -v, --version output version information and exit
55 |
56 | Supported PROGRAM values:
57 | aclocal autoconf autoheader autom4te automake makeinfo
58 | bison yacc flex lex help2man
59 |
60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
61 | 'g' are ignored when checking the name.
62 |
63 | Send bug reports to ."
64 | exit $?
65 | ;;
66 |
67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
68 | echo "missing $scriptversion (GNU Automake)"
69 | exit $?
70 | ;;
71 |
72 | -*)
73 | echo 1>&2 "$0: unknown '$1' option"
74 | echo 1>&2 "Try '$0 --help' for more information"
75 | exit 1
76 | ;;
77 |
78 | esac
79 |
80 | # Run the given program, remember its exit status.
81 | "$@"; st=$?
82 |
83 | # If it succeeded, we are done.
84 | test $st -eq 0 && exit 0
85 |
86 | # Also exit now if we it failed (or wasn't found), and '--version' was
87 | # passed; such an option is passed most likely to detect whether the
88 | # program is present and works.
89 | case $2 in --version|--help) exit $st;; esac
90 |
91 | # Exit code 63 means version mismatch. This often happens when the user
92 | # tries to use an ancient version of a tool on a file that requires a
93 | # minimum version.
94 | if test $st -eq 63; then
95 | msg="probably too old"
96 | elif test $st -eq 127; then
97 | # Program was missing.
98 | msg="missing on your system"
99 | else
100 | # Program was found and executed, but failed. Give up.
101 | exit $st
102 | fi
103 |
104 | perl_URL=https://www.perl.org/
105 | flex_URL=https://github.com/westes/flex
106 | gnu_software_URL=https://www.gnu.org/software
107 |
108 | program_details ()
109 | {
110 | case $1 in
111 | aclocal|automake)
112 | echo "The '$1' program is part of the GNU Automake package:"
113 | echo "<$gnu_software_URL/automake>"
114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
115 | echo "<$gnu_software_URL/autoconf>"
116 | echo "<$gnu_software_URL/m4/>"
117 | echo "<$perl_URL>"
118 | ;;
119 | autoconf|autom4te|autoheader)
120 | echo "The '$1' program is part of the GNU Autoconf package:"
121 | echo "<$gnu_software_URL/autoconf/>"
122 | echo "It also requires GNU m4 and Perl in order to run:"
123 | echo "<$gnu_software_URL/m4/>"
124 | echo "<$perl_URL>"
125 | ;;
126 | esac
127 | }
128 |
129 | give_advice ()
130 | {
131 | # Normalize program name to check for.
132 | normalized_program=`echo "$1" | sed '
133 | s/^gnu-//; t
134 | s/^gnu//; t
135 | s/^g//; t'`
136 |
137 | printf '%s\n' "'$1' is $msg."
138 |
139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
140 | case $normalized_program in
141 | autoconf*)
142 | echo "You should only need it if you modified 'configure.ac',"
143 | echo "or m4 files included by it."
144 | program_details 'autoconf'
145 | ;;
146 | autoheader*)
147 | echo "You should only need it if you modified 'acconfig.h' or"
148 | echo "$configure_deps."
149 | program_details 'autoheader'
150 | ;;
151 | automake*)
152 | echo "You should only need it if you modified 'Makefile.am' or"
153 | echo "$configure_deps."
154 | program_details 'automake'
155 | ;;
156 | aclocal*)
157 | echo "You should only need it if you modified 'acinclude.m4' or"
158 | echo "$configure_deps."
159 | program_details 'aclocal'
160 | ;;
161 | autom4te*)
162 | echo "You might have modified some maintainer files that require"
163 | echo "the 'autom4te' program to be rebuilt."
164 | program_details 'autom4te'
165 | ;;
166 | bison*|yacc*)
167 | echo "You should only need it if you modified a '.y' file."
168 | echo "You may want to install the GNU Bison package:"
169 | echo "<$gnu_software_URL/bison/>"
170 | ;;
171 | lex*|flex*)
172 | echo "You should only need it if you modified a '.l' file."
173 | echo "You may want to install the Fast Lexical Analyzer package:"
174 | echo "<$flex_URL>"
175 | ;;
176 | help2man*)
177 | echo "You should only need it if you modified a dependency" \
178 | "of a man page."
179 | echo "You may want to install the GNU Help2man package:"
180 | echo "<$gnu_software_URL/help2man/>"
181 | ;;
182 | makeinfo*)
183 | echo "You should only need it if you modified a '.texi' file, or"
184 | echo "any other file indirectly affecting the aspect of the manual."
185 | echo "You might want to install the Texinfo package:"
186 | echo "<$gnu_software_URL/texinfo/>"
187 | echo "The spurious makeinfo call might also be the consequence of"
188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
189 | echo "want to install GNU make:"
190 | echo "<$gnu_software_URL/make/>"
191 | ;;
192 | *)
193 | echo "You might have modified some files without having the proper"
194 | echo "tools for further handling them. Check the 'README' file, it"
195 | echo "often tells you about the needed prerequisites for installing"
196 | echo "this package. You may also peek at any GNU archive site, in"
197 | echo "case some other package contains this missing '$1' program."
198 | ;;
199 | esac
200 | }
201 |
202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \
203 | -e '2,$s/^/ /' >&2
204 |
205 | # Propagate the correct exit status (expected to be 127 for a program
206 | # not found, 63 for a program that failed due to version mismatch).
207 | exit $st
208 |
209 | # Local variables:
210 | # eval: (add-hook 'before-save-hook 'time-stamp)
211 | # time-stamp-start: "scriptversion="
212 | # time-stamp-format: "%:y-%02m-%02d.%02H"
213 | # time-stamp-time-zone: "UTC0"
214 | # time-stamp-end: "; # UTC"
215 | # End:
216 |
--------------------------------------------------------------------------------
/test-driver:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # test-driver - basic testsuite driver script.
3 |
4 | scriptversion=2018-03-07.03; # UTC
5 |
6 | # Copyright (C) 2011-2021 Free Software Foundation, Inc.
7 | #
8 | # This program is free software; you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation; either version 2, or (at your option)
11 | # any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU General Public License
19 | # along with this program. If not, see .
20 |
21 | # As a special exception to the GNU General Public License, if you
22 | # distribute this file as part of a program that contains a
23 | # configuration script generated by Autoconf, you may include it under
24 | # the same distribution terms that you use for the rest of that program.
25 |
26 | # This file is maintained in Automake, please report
27 | # bugs to or send patches to
28 | # .
29 |
30 | # Make unconditional expansion of undefined variables an error. This
31 | # helps a lot in preventing typo-related bugs.
32 | set -u
33 |
34 | usage_error ()
35 | {
36 | echo "$0: $*" >&2
37 | print_usage >&2
38 | exit 2
39 | }
40 |
41 | print_usage ()
42 | {
43 | cat <"$log_file"
112 | "$@" >>"$log_file" 2>&1
113 | estatus=$?
114 |
115 | if test $enable_hard_errors = no && test $estatus -eq 99; then
116 | tweaked_estatus=1
117 | else
118 | tweaked_estatus=$estatus
119 | fi
120 |
121 | case $tweaked_estatus:$expect_failure in
122 | 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
123 | 0:*) col=$grn res=PASS recheck=no gcopy=no;;
124 | 77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
125 | 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
126 | *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
127 | *:*) col=$red res=FAIL recheck=yes gcopy=yes;;
128 | esac
129 |
130 | # Report the test outcome and exit status in the logs, so that one can
131 | # know whether the test passed or failed simply by looking at the '.log'
132 | # file, without the need of also peaking into the corresponding '.trs'
133 | # file (automake bug#11814).
134 | echo "$res $test_name (exit status: $estatus)" >>"$log_file"
135 |
136 | # Report outcome to console.
137 | echo "${col}${res}${std}: $test_name"
138 |
139 | # Register the test result, and other relevant metadata.
140 | echo ":test-result: $res" > $trs_file
141 | echo ":global-test-result: $res" >> $trs_file
142 | echo ":recheck: $recheck" >> $trs_file
143 | echo ":copy-in-global-log: $gcopy" >> $trs_file
144 |
145 | # Local Variables:
146 | # mode: shell-script
147 | # sh-indentation: 2
148 | # eval: (add-hook 'before-save-hook 'time-stamp)
149 | # time-stamp-start: "scriptversion="
150 | # time-stamp-format: "%:y-%02m-%02d.%02H"
151 | # time-stamp-time-zone: "UTC0"
152 | # time-stamp-end: "; # UTC"
153 | # End:
154 |
--------------------------------------------------------------------------------
/tests/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CFLAGS = $(MAGICKCORE_CFLAGS)
2 |
3 | TESTS = magick-cache
4 |
5 | check_PROGRAMS = magick-cache
6 | magick_cache_SOURCES = magick-cache.c
7 |
8 | magick_cache_LDADD = $(top_builddir)/MagickCache/libMagickCache.la $(AM_LDFLAGS)
9 | magick_cache_LDADD += $(MAGICKCORE_LIBS)
10 |
--------------------------------------------------------------------------------
/tests/magick-cache.c:
--------------------------------------------------------------------------------
1 | /*
2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 | % %
4 | % %
5 | % %
6 | % M M AAA GGGG IIIII CCCC K K %
7 | % MM MM A A G I C K K %
8 | % M M M AAAAA G GGG I C KKK %
9 | % M M A A G G I C K K %
10 | % M M A A GGGG IIIII CCCC K K %
11 | % %
12 | % CCCC AAA CCCC H H EEEEE %
13 | % C A A C H H E %
14 | % C AAAAA C HHHHH EEE %
15 | % C A A C H H E %
16 | % CCCC A A CCCC H H EEEEE %
17 | % %
18 | % MagickCache Repository Unit Tests %
19 | % %
20 | % Software Design %
21 | % Cristy %
22 | % March 2021 %
23 | % %
24 | % %
25 | % Copyright 1999 ImageMagick Studio LLC, a non-profit organization %
26 | % dedicated to making software imaging solutions freely available. %
27 | % %
28 | % You may not use this file except in compliance with the License. You may %
29 | % obtain a copy of the License at %
30 | % %
31 | % https://imagemagick.org/script/license.php %
32 | % %
33 | % Unless required by applicable law or agreed to in writing, software %
34 | % distributed under the License is distributed on an "AS IS" BASIS, %
35 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
36 | % See the License for the specific language governing permissions and %
37 | % limitations under the License. %
38 | % %
39 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 | %
41 | % The MagickCache provides secure methods and tools to cache images, image
42 | % sequences, video, audio or metadata in a local folder. Any content is
43 | % memory-mapped for efficient retrieval. Additional efficiences are possible
44 | % by retrieving a portion of an image. Content can persist or you can assign
45 | % a time-to-live (TTL) to automatically expire content when the TTL is
46 | % exceeded. MagickCache supports virtually unlimited content upwards of
47 | % billions of images making it suitable as a web image service.
48 | %
49 | */
50 |
51 | #include
52 | #include "MagickCache/MagickCache.h"
53 | #include "MagickCache/magick-cache-private.h"
54 |
55 | /*
56 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 | % %
58 | % %
59 | % %
60 | % M a i n %
61 | % %
62 | % %
63 | % %
64 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 | %
66 | %
67 | */
68 |
69 | static MagickBooleanType DeleteResources(MagickCache *cache,
70 | MagickCacheResource *resource,const void *context)
71 | {
72 | MagickBooleanType
73 | status;
74 |
75 | ssize_t
76 | *count = (ssize_t *) context;
77 |
78 | status=DeleteMagickCacheResource(cache,resource);
79 | if (status != MagickFalse)
80 | (*count)++;
81 | return(status);
82 | }
83 |
84 | static MagickBooleanType ExpireResources(MagickCache *cache,
85 | MagickCacheResource *resource,const void *context)
86 | {
87 | MagickBooleanType
88 | status;
89 |
90 | ssize_t
91 | *count = (ssize_t *) context;
92 |
93 | status=IsMagickCacheResourceExpired(cache,resource);
94 | if (status != MagickFalse)
95 | {
96 | (*count)++;
97 | return(DeleteMagickCacheResource(cache,resource));
98 | }
99 | return(MagickTrue);
100 | }
101 |
102 | static MagickBooleanType IdentifyResources(MagickCache *cache,
103 | MagickCacheResource *resource,const void *context)
104 | {
105 | MagickBooleanType
106 | status;
107 |
108 | ssize_t
109 | *count = (ssize_t *) context;
110 |
111 | status=IdentifyMagickCacheResource(cache,resource,stdout);
112 | if (status != MagickFalse)
113 | (*count)++;
114 | return(status);
115 | }
116 |
117 | static MagickBooleanType MagickCacheCLI(int argc,char **argv,
118 | ExceptionInfo *exception)
119 | {
120 | #define MagickCacheKey "5u[Jz,3!"
121 | #define MagickCacheRepo "./magick-cache-repo"
122 | #define MagickCacheResourceIRI "tests"
123 | #define MagickCacheResourceBlobIRI "tests/blob/rose"
124 | #define MagickCacheResourceImageIRI "tests/image/rose"
125 | #define MagickCacheResourceTTL 75
126 | #define MagickCacheResourceMeta "a woody perennial flowering plant of the " \
127 | "genus Rosa, in the family Rosaceae, or the flower it bears"
128 | #define MagickCacheResourceMetaIRI "tests/meta/rose"
129 | #define ThrowMagickCacheException(cache) \
130 | { \
131 | description=GetMagickCacheException(cache,&severity); \
132 | (void) FormatLocaleFile(stderr,"%s %s %lu %s\n",GetMagickModule(), \
133 | description); \
134 | description=(char *) DestroyString(description); \
135 | }
136 | #define ThrowMagickCacheResourceException(resource) \
137 | { \
138 | description=GetMagickCacheResourceException(resource,&severity); \
139 | (void) FormatLocaleFile(stderr,"%s %s %lu %s\n",GetMagickModule(), \
140 | description); \
141 | description=(char *) DestroyString(description); \
142 | }
143 |
144 | char
145 | *description;
146 |
147 | const char
148 | *meta = (const char *) NULL,
149 | *path = MagickCacheRepo;
150 |
151 | const Image
152 | *image = (const Image *) NULL;
153 |
154 | const void
155 | *blob = (const void *) NULL;
156 |
157 | double
158 | distortion = 0.0;
159 |
160 | ExceptionType
161 | severity = UndefinedException;
162 |
163 | Image
164 | *difference = (Image *) NULL,
165 | *rose = (Image *) NULL;
166 |
167 | ImageInfo
168 | *image_info = AcquireImageInfo();
169 |
170 | MagickBooleanType
171 | status;
172 |
173 | MagickCache
174 | *cache = (MagickCache *) NULL;
175 |
176 | MagickCacheResource
177 | *blob_resource = (MagickCacheResource *) NULL,
178 | *image_resource = (MagickCacheResource *) NULL,
179 | *meta_resource = (MagickCacheResource *) NULL;
180 |
181 | size_t
182 | columns = 0,
183 | count = 0,
184 | extent = 0,
185 | fail = 0,
186 | rows = 0,
187 | tests = 0;
188 |
189 | StringInfo
190 | *passkey = StringToStringInfo(MagickCacheKey);
191 |
192 | unsigned long
193 | signature = MagickCoreSignature;
194 |
195 | /*
196 | Run the unit tests to exercise the MagickCache repository methods.
197 | */
198 | (void) argv;
199 | (void) argc;
200 | (void) FormatLocaleFile(stdout,"%g: create magick cache\n",(double) tests);
201 | tests++;
202 | status=CreateMagickCache(path,passkey);
203 | if (status == MagickFalse)
204 | {
205 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
206 | GetMagickModule());
207 | fail++;
208 | }
209 |
210 | (void) FormatLocaleFile(stdout,"%g: acquire magick cache\n",(double) tests);
211 | tests++;
212 | cache=AcquireMagickCache(path,passkey);
213 | if (cache == (MagickCache *) NULL)
214 | {
215 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
216 | GetMagickModule());
217 | fail++;
218 | }
219 |
220 | (void) FormatLocaleFile(stdout,"%g: acquire magick cache resource\n",(double)
221 | tests);
222 | tests++;
223 | if (cache != (MagickCache *) NULL)
224 | {
225 | blob_resource=AcquireMagickCacheResource(cache,
226 | MagickCacheResourceBlobIRI);
227 | image_resource=AcquireMagickCacheResource(cache,
228 | MagickCacheResourceImageIRI);
229 | meta_resource=AcquireMagickCacheResource(cache,
230 | MagickCacheResourceMetaIRI);
231 | }
232 | if ((blob_resource == (MagickCacheResource *) NULL) &&
233 | (image_resource == (MagickCacheResource *) NULL) &&
234 | (meta_resource == (MagickCacheResource *) NULL))
235 | {
236 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
237 | GetMagickModule());
238 | ThrowMagickCacheException(cache);
239 | fail++;
240 | }
241 |
242 | (void) FormatLocaleFile(stdout,"%g: put magick cache (image)\n",(double)
243 | tests);
244 | tests++;
245 | (void) strcpy(image_info->filename,"rose:");
246 | if (cache != (MagickCache *) NULL)
247 | rose=ReadImage(image_info,exception);
248 | if ((cache != (MagickCache *) NULL) &&
249 | (image_resource != (MagickCacheResource *) NULL) &&
250 | (rose != (Image *) NULL))
251 | {
252 | SetMagickCacheResourceTTL(image_resource,1);
253 | status=PutMagickCacheResourceImage(cache,image_resource,rose);
254 | }
255 | else
256 | status=MagickFalse;
257 | if (status == MagickFalse)
258 | {
259 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
260 | GetMagickModule());
261 | ThrowMagickCacheResourceException(image_resource);
262 | fail++;
263 | }
264 | (void) sleep(1);
265 |
266 | (void) FormatLocaleFile(stdout,"%g: put/get magick cache (blob)\n",(double)
267 | tests);
268 | tests++;
269 | if ((cache != (MagickCache *) NULL) &&
270 | (image_resource != (MagickCacheResource *) NULL))
271 | {
272 | SetMagickCacheResourceTTL(blob_resource,MagickCacheResourceTTL);
273 | status=PutMagickCacheResourceBlob(cache,blob_resource,sizeof(signature),
274 | &signature);
275 | }
276 | if ((cache != (MagickCache *) NULL) &&
277 | (blob_resource != (MagickCacheResource *) NULL) &&
278 | (status != MagickFalse))
279 | {
280 | blob=GetMagickCacheResourceBlob(cache,blob_resource);
281 | extent=GetMagickCacheResourceExtent(blob_resource);
282 | }
283 | if ((status == MagickFalse) || (blob == (const void *) NULL) ||
284 | (extent != sizeof(signature)) || (memcmp(blob,&signature,extent)))
285 | {
286 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
287 | GetMagickModule());
288 | ThrowMagickCacheResourceException(blob_resource);
289 | fail++;
290 | }
291 | (void) sleep(1);
292 |
293 | (void) FormatLocaleFile(stdout,"%g: put/get magick cache (meta)\n",(double)
294 | tests);
295 | tests++;
296 | if ((cache != (MagickCache *) NULL) &&
297 | (meta_resource != (MagickCacheResource *) NULL))
298 | {
299 | SetMagickCacheResourceTTL(meta_resource,MagickCacheResourceTTL);
300 | status=PutMagickCacheResourceMeta(cache,meta_resource,
301 | MagickCacheResourceMeta);
302 | }
303 | if ((cache != (MagickCache *) NULL) &&
304 | (meta_resource != (MagickCacheResource *) NULL) &&
305 | (status != MagickFalse))
306 | meta=GetMagickCacheResourceMeta(cache,meta_resource);
307 | if ((status == MagickFalse) || (meta == (const char *) NULL) ||
308 | (strlen(meta) != strlen(MagickCacheResourceMeta)) ||
309 | (memcmp(meta,MagickCacheResourceMeta,strlen(meta))))
310 | {
311 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
312 | GetMagickModule());
313 | ThrowMagickCacheResourceException(meta_resource);
314 | fail++;
315 | }
316 |
317 | (void) FormatLocaleFile(stdout,"%g: identify magick cache resources\n",
318 | (double) tests);
319 | tests++;
320 | if (cache != (MagickCache *) NULL)
321 | {
322 | count=0;
323 | status=IterateMagickCacheResources(cache,MagickCacheResourceIRI,&count,
324 | IdentifyResources);
325 | (void) fprintf(stderr,"identified %g resources\n",(double) count);
326 | }
327 | if ((status == MagickFalse) || (count != 3))
328 | {
329 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
330 | GetMagickModule());
331 | ThrowMagickCacheException(cache);
332 | fail++;
333 | }
334 |
335 | (void) FormatLocaleFile(stdout,"%g: get magick cache (image)\n",(double)
336 | tests);
337 | tests++;
338 | if ((cache != (MagickCache *) NULL) &&
339 | (image_resource != (MagickCacheResource *) NULL))
340 | image=GetMagickCacheResourceImage(cache,image_resource,(const char *) NULL);
341 | if ((image != (const Image *) NULL) && (rose != (Image *) NULL))
342 | difference=CompareImages(rose,image,RootMeanSquaredErrorMetric,
343 | &distortion,exception);
344 | if ((image == (Image *) NULL) || (distortion >= MagickEpsilon))
345 | {
346 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
347 | GetMagickModule());
348 | ThrowMagickCacheResourceException(image_resource);
349 | fail++;
350 | }
351 |
352 | (void) FormatLocaleFile(stdout,"%g: get magick cache (image tile)\n",(double)
353 | tests);
354 | tests++;
355 | if ((cache != (MagickCache *) NULL) &&
356 | (image_resource != (MagickCacheResource *) NULL))
357 | image=GetMagickCacheResourceImage(cache,image_resource,"35x23+0+0");
358 | if (image != (const Image *) NULL)
359 | GetMagickCacheResourceSize(image_resource,&columns,&rows);
360 | if ((image == (Image *) NULL) || (columns != 35) || (rows != 23))
361 | {
362 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
363 | GetMagickModule());
364 | ThrowMagickCacheResourceException(image_resource);
365 | fail++;
366 | }
367 |
368 | (void) FormatLocaleFile(stdout,"%g: get magick cache (image resize)\n",
369 | (double) tests);
370 | tests++;
371 | if ((cache != (MagickCache *) NULL) &&
372 | (image_resource != (MagickCacheResource *) NULL))
373 | image=GetMagickCacheResourceImage(cache,image_resource,"35x23");
374 | if (image != (const Image *) NULL)
375 | GetMagickCacheResourceSize(image_resource,&columns,&rows);
376 | if ((image == (Image *) NULL) || (columns != 35) || (rows != 23))
377 | {
378 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
379 | GetMagickModule());
380 | ThrowMagickCacheResourceException(image_resource);
381 | fail++;
382 | }
383 |
384 | (void) FormatLocaleFile(stdout,"%g: expire magick cache resource\n",(double)
385 | tests);
386 | tests++;
387 | if ((cache != (MagickCache *) NULL) &&
388 | (image_resource != (MagickCacheResource *) NULL))
389 | {
390 | count=0;
391 | status=IterateMagickCacheResources(cache,MagickCacheResourceIRI,&count,
392 | ExpireResources);
393 | (void) fprintf(stderr,"expired %g resources\n",(double) count);
394 | }
395 | if ((status == MagickFalse) || (count != 1))
396 | {
397 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
398 | GetMagickModule());
399 | ThrowMagickCacheException(cache);
400 | fail++;
401 | }
402 | (void) FormatLocaleFile(stdout,"%g: delete magick cache resource\n",(double)
403 | tests);
404 | tests++;
405 | if ((cache != (MagickCache *) NULL) &&
406 | (image_resource != (MagickCacheResource *) NULL))
407 | {
408 | count=0;
409 | status=IterateMagickCacheResources(cache,MagickCacheResourceIRI,&count,
410 | DeleteResources);
411 | (void) fprintf(stderr,"deleted %g resources\n",(double) count);
412 | }
413 | if ((status == MagickFalse) || (count != 2))
414 | {
415 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
416 | GetMagickModule());
417 | ThrowMagickCacheException(cache);
418 | fail++;
419 | }
420 |
421 | (void) FormatLocaleFile(stdout,"%g: delete magick cache\n",(double) tests);
422 | tests++;
423 | if (cache != (MagickCache *) NULL)
424 | {
425 | const char *path = MagickCacheRepo "/" MagickCacheSentinel;
426 | if (remove_utf8(path) == -1)
427 | status=MagickFalse;
428 | if (remove_utf8(MagickCacheRepo) == -1)
429 | status=MagickFalse;
430 | }
431 | if (status == MagickFalse)
432 | {
433 | (void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
434 | GetMagickModule());
435 | ThrowMagickCacheException(cache);
436 | fail++;
437 | }
438 |
439 | /*
440 | Free memory.
441 | */
442 | if (difference != (Image *) NULL)
443 | difference=DestroyImageList(difference);
444 | if (rose != (Image *) NULL)
445 | rose=DestroyImageList(rose);
446 | if (image_info != (ImageInfo *) NULL)
447 | image_info=DestroyImageInfo(image_info);
448 | if (meta_resource != (MagickCacheResource *) NULL)
449 | meta_resource=DestroyMagickCacheResource(meta_resource);
450 | if (image_resource != (MagickCacheResource *) NULL)
451 | image_resource=DestroyMagickCacheResource(image_resource);
452 | if (blob_resource != (MagickCacheResource *) NULL)
453 | blob_resource=DestroyMagickCacheResource(blob_resource);
454 | if (cache != (MagickCache *) NULL)
455 | cache=DestroyMagickCache(cache);
456 |
457 | /*
458 | Unit tests accounting.
459 | */
460 | (void) FormatLocaleFile(stdout,
461 | "validation suite: %.20g tests; %.20g passed; %.20g failed.\n",(double)
462 | tests,(double) (tests-fail),(double) fail);
463 | return(fail == 0 ? MagickTrue : MagickFalse);
464 | }
465 |
466 | static int MagickCacheMain(int argc,char **argv)
467 | {
468 | ExceptionInfo
469 | *exception;
470 |
471 | MagickBooleanType
472 | status;
473 |
474 | MagickCoreGenesis(*argv,MagickTrue);
475 | exception=AcquireExceptionInfo();
476 | status=MagickCacheCLI(argc,argv,exception);
477 | exception=DestroyExceptionInfo(exception);
478 | MagickCoreTerminus();
479 | return(status != MagickFalse ? 0 : 1);
480 | }
481 |
482 | #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)
483 | int main(int argc,char **argv)
484 | {
485 | return(MagickCacheMain(argc,argv));
486 | }
487 | #else
488 | int wmain(int argc,wchar_t *argv[])
489 | {
490 | char
491 | **utf8;
492 |
493 | int
494 | status;
495 |
496 | int
497 | i;
498 |
499 | utf8=NTArgvToUTF8(argc,argv);
500 | status=MagickCacheMain(argc,utf8);
501 | for (i=0; i < argc; i++)
502 | utf8[i]=DestroyString(utf8[i]);
503 | utf8=(char **) RelinquishMagickMemory(utf8);
504 | return(status);
505 | }
506 | #endif
507 |
--------------------------------------------------------------------------------
/utilities/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CFLAGS = $(MAGICKCORE_CFLAGS)
2 |
3 | bin_PROGRAMS = magick-cache
4 | magick_cache_SOURCES = magick-cache.c
5 |
6 | magick_cache_LDADD = $(top_builddir)/MagickCache/libMagickCache.la $(AM_LDFLAGS)
7 | magick_cache_LDADD += $(MAGICKCORE_LIBS)
8 |
9 | UTILITIES_MANS = \
10 | utilities/magick-cache.1
11 |
12 | UTILITIES_CONFIGURE = \
13 | utilities/magick-cache.1.in
14 |
--------------------------------------------------------------------------------
/utilities/Makefile.in:
--------------------------------------------------------------------------------
1 | # Makefile.in generated by automake 1.16.5 from Makefile.am.
2 | # @configure_input@
3 |
4 | # Copyright (C) 1994-2021 Free Software Foundation, Inc.
5 |
6 | # This Makefile.in is free software; the Free Software Foundation
7 | # gives unlimited permission to copy and/or distribute it,
8 | # with or without modifications, as long as this notice is preserved.
9 |
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 | # PARTICULAR PURPOSE.
14 |
15 | @SET_MAKE@
16 |
17 | VPATH = @srcdir@
18 | am__is_gnu_make = { \
19 | if test -z '$(MAKELEVEL)'; then \
20 | false; \
21 | elif test -n '$(MAKE_HOST)'; then \
22 | true; \
23 | elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
24 | true; \
25 | else \
26 | false; \
27 | fi; \
28 | }
29 | am__make_running_with_option = \
30 | case $${target_option-} in \
31 | ?) ;; \
32 | *) echo "am__make_running_with_option: internal error: invalid" \
33 | "target option '$${target_option-}' specified" >&2; \
34 | exit 1;; \
35 | esac; \
36 | has_opt=no; \
37 | sane_makeflags=$$MAKEFLAGS; \
38 | if $(am__is_gnu_make); then \
39 | sane_makeflags=$$MFLAGS; \
40 | else \
41 | case $$MAKEFLAGS in \
42 | *\\[\ \ ]*) \
43 | bs=\\; \
44 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
45 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
46 | esac; \
47 | fi; \
48 | skip_next=no; \
49 | strip_trailopt () \
50 | { \
51 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
52 | }; \
53 | for flg in $$sane_makeflags; do \
54 | test $$skip_next = yes && { skip_next=no; continue; }; \
55 | case $$flg in \
56 | *=*|--*) continue;; \
57 | -*I) strip_trailopt 'I'; skip_next=yes;; \
58 | -*I?*) strip_trailopt 'I';; \
59 | -*O) strip_trailopt 'O'; skip_next=yes;; \
60 | -*O?*) strip_trailopt 'O';; \
61 | -*l) strip_trailopt 'l'; skip_next=yes;; \
62 | -*l?*) strip_trailopt 'l';; \
63 | -[dEDm]) skip_next=yes;; \
64 | -[JT]) skip_next=yes;; \
65 | esac; \
66 | case $$flg in \
67 | *$$target_option*) has_opt=yes; break;; \
68 | esac; \
69 | done; \
70 | test $$has_opt = yes
71 | am__make_dryrun = (target_option=n; $(am__make_running_with_option))
72 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
73 | pkgdatadir = $(datadir)/@PACKAGE@
74 | pkgincludedir = $(includedir)/@PACKAGE@
75 | pkglibdir = $(libdir)/@PACKAGE@
76 | pkglibexecdir = $(libexecdir)/@PACKAGE@
77 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
78 | install_sh_DATA = $(install_sh) -c -m 644
79 | install_sh_PROGRAM = $(install_sh) -c
80 | install_sh_SCRIPT = $(install_sh) -c
81 | INSTALL_HEADER = $(INSTALL_DATA)
82 | transform = $(program_transform_name)
83 | NORMAL_INSTALL = :
84 | PRE_INSTALL = :
85 | POST_INSTALL = :
86 | NORMAL_UNINSTALL = :
87 | PRE_UNINSTALL = :
88 | POST_UNINSTALL = :
89 | build_triplet = @build@
90 | host_triplet = @host@
91 | bin_PROGRAMS = magick-cache$(EXEEXT)
92 | subdir = utilities
93 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
94 | am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
95 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
96 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
97 | $(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
98 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
99 | $(ACLOCAL_M4)
100 | DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
101 | mkinstalldirs = $(install_sh) -d
102 | CONFIG_HEADER = $(top_builddir)/config.h
103 | CONFIG_CLEAN_FILES = magick-cache.1
104 | CONFIG_CLEAN_VPATH_FILES =
105 | am__installdirs = "$(DESTDIR)$(bindir)"
106 | PROGRAMS = $(bin_PROGRAMS)
107 | am_magick_cache_OBJECTS = magick-cache.$(OBJEXT)
108 | magick_cache_OBJECTS = $(am_magick_cache_OBJECTS)
109 | am__DEPENDENCIES_1 =
110 | magick_cache_DEPENDENCIES = \
111 | $(top_builddir)/MagickCache/libMagickCache.la \
112 | $(am__DEPENDENCIES_1)
113 | AM_V_lt = $(am__v_lt_@AM_V@)
114 | am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
115 | am__v_lt_0 = --silent
116 | am__v_lt_1 =
117 | AM_V_P = $(am__v_P_@AM_V@)
118 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
119 | am__v_P_0 = false
120 | am__v_P_1 = :
121 | AM_V_GEN = $(am__v_GEN_@AM_V@)
122 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
123 | am__v_GEN_0 = @echo " GEN " $@;
124 | am__v_GEN_1 =
125 | AM_V_at = $(am__v_at_@AM_V@)
126 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
127 | am__v_at_0 = @
128 | am__v_at_1 =
129 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
130 | depcomp = $(SHELL) $(top_srcdir)/depcomp
131 | am__maybe_remake_depfiles = depfiles
132 | am__depfiles_remade = ./$(DEPDIR)/magick-cache.Po
133 | am__mv = mv -f
134 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
135 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
136 | LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
137 | $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
138 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
139 | $(AM_CFLAGS) $(CFLAGS)
140 | AM_V_CC = $(am__v_CC_@AM_V@)
141 | am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
142 | am__v_CC_0 = @echo " CC " $@;
143 | am__v_CC_1 =
144 | CCLD = $(CC)
145 | LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
146 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
147 | $(AM_LDFLAGS) $(LDFLAGS) -o $@
148 | AM_V_CCLD = $(am__v_CCLD_@AM_V@)
149 | am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
150 | am__v_CCLD_0 = @echo " CCLD " $@;
151 | am__v_CCLD_1 =
152 | SOURCES = $(magick_cache_SOURCES)
153 | DIST_SOURCES = $(magick_cache_SOURCES)
154 | am__can_run_installinfo = \
155 | case $$AM_UPDATE_INFO_DIR in \
156 | n|no|NO) false;; \
157 | *) (install-info --version) >/dev/null 2>&1;; \
158 | esac
159 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
160 | # Read a list of newline-separated strings from the standard input,
161 | # and print each of them once, without duplicates. Input order is
162 | # *not* preserved.
163 | am__uniquify_input = $(AWK) '\
164 | BEGIN { nonempty = 0; } \
165 | { items[$$0] = 1; nonempty = 1; } \
166 | END { if (nonempty) { for (i in items) print i; }; } \
167 | '
168 | # Make sure the list of sources is unique. This is necessary because,
169 | # e.g., the same source file might be shared among _SOURCES variables
170 | # for different programs/libraries.
171 | am__define_uniq_tagged_files = \
172 | list='$(am__tagged_files)'; \
173 | unique=`for i in $$list; do \
174 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
175 | done | $(am__uniquify_input)`
176 | am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/magick-cache.1.in \
177 | $(top_srcdir)/depcomp
178 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
179 | ACLOCAL = @ACLOCAL@
180 | AMTAR = @AMTAR@
181 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
182 | AR = @AR@
183 | AS = @AS@
184 | AUTOCONF = @AUTOCONF@
185 | AUTOHEADER = @AUTOHEADER@
186 | AUTOMAKE = @AUTOMAKE@
187 | AWK = @AWK@
188 | CC = @CC@
189 | CCDEPMODE = @CCDEPMODE@
190 | CFLAGS = @CFLAGS@
191 | CPP = @CPP@
192 | CPPFLAGS = @CPPFLAGS@
193 | CSCOPE = @CSCOPE@
194 | CTAGS = @CTAGS@
195 | CXX = @CXX@
196 | CXXCPP = @CXXCPP@
197 | CXXDEPMODE = @CXXDEPMODE@
198 | CXXFLAGS = @CXXFLAGS@
199 | CYGPATH_W = @CYGPATH_W@
200 | DEFS = @DEFS@
201 | DEPDIR = @DEPDIR@
202 | DLLTOOL = @DLLTOOL@
203 | DSYMUTIL = @DSYMUTIL@
204 | DUMPBIN = @DUMPBIN@
205 | ECHO_C = @ECHO_C@
206 | ECHO_N = @ECHO_N@
207 | ECHO_T = @ECHO_T@
208 | EGREP = @EGREP@
209 | ETAGS = @ETAGS@
210 | EXEEXT = @EXEEXT@
211 | FGREP = @FGREP@
212 | FILECMD = @FILECMD@
213 | GREP = @GREP@
214 | INSTALL = @INSTALL@
215 | INSTALL_DATA = @INSTALL_DATA@
216 | INSTALL_PROGRAM = @INSTALL_PROGRAM@
217 | INSTALL_SCRIPT = @INSTALL_SCRIPT@
218 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
219 | LD = @LD@
220 | LDFLAGS = @LDFLAGS@
221 | LIBOBJS = @LIBOBJS@
222 | LIBS = @LIBS@
223 | LIBTOOL = @LIBTOOL@
224 | LIBTOOL_DEPS = @LIBTOOL_DEPS@
225 | LIPO = @LIPO@
226 | LN_S = @LN_S@
227 | LTLIBOBJS = @LTLIBOBJS@
228 | LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
229 | MAGICKCACHE_GIT_REVISION = @MAGICKCACHE_GIT_REVISION@
230 | MAGICKCACHE_LIBRARY_AGE = @MAGICKCACHE_LIBRARY_AGE@
231 | MAGICKCACHE_LIBRARY_CURRENT = @MAGICKCACHE_LIBRARY_CURRENT@
232 | MAGICKCACHE_LIBRARY_CURRENT_MIN = @MAGICKCACHE_LIBRARY_CURRENT_MIN@
233 | MAGICKCACHE_LIBRARY_REVISION = @MAGICKCACHE_LIBRARY_REVISION@
234 | MAGICKCACHE_LIBRARY_VERSION_INFO = @MAGICKCACHE_LIBRARY_VERSION_INFO@
235 | MAGICKCACHE_LIB_VERSION = @MAGICKCACHE_LIB_VERSION@
236 | MAGICKCACHE_LIB_VERSION_NUMBER = @MAGICKCACHE_LIB_VERSION_NUMBER@
237 | MAGICKCACHE_LIB_VERSION_TEXT = @MAGICKCACHE_LIB_VERSION_TEXT@
238 | MAGICKCACHE_MAJOR_VERSION = @MAGICKCACHE_MAJOR_VERSION@
239 | MAGICKCACHE_MICRO_VERSION = @MAGICKCACHE_MICRO_VERSION@
240 | MAGICKCACHE_MINOR_VERSION = @MAGICKCACHE_MINOR_VERSION@
241 | MAGICKCACHE_PATCHLEVEL_VERSION = @MAGICKCACHE_PATCHLEVEL_VERSION@
242 | MAGICKCACHE_PCFLAGS = @MAGICKCACHE_PCFLAGS@
243 | MAGICKCACHE_VERSION = @MAGICKCACHE_VERSION@
244 | MAGICKCORE_CFLAGS = @MAGICKCORE_CFLAGS@
245 | MAGICKCORE_LIBS = @MAGICKCORE_LIBS@
246 | MAGICKPP_LIB_VERSION_TEXT = @MAGICKPP_LIB_VERSION_TEXT@
247 | MAKEINFO = @MAKEINFO@
248 | MANIFEST_TOOL = @MANIFEST_TOOL@
249 | MKDIR_P = @MKDIR_P@
250 | NM = @NM@
251 | NMEDIT = @NMEDIT@
252 | OBJDUMP = @OBJDUMP@
253 | OBJEXT = @OBJEXT@
254 | OTOOL = @OTOOL@
255 | OTOOL64 = @OTOOL64@
256 | PACKAGE = @PACKAGE@
257 | PACKAGE_BASE_VERSION = @PACKAGE_BASE_VERSION@
258 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
259 | PACKAGE_LIB_VERSION = @PACKAGE_LIB_VERSION@
260 | PACKAGE_LIB_VERSION_NUMBER = @PACKAGE_LIB_VERSION_NUMBER@
261 | PACKAGE_NAME = @PACKAGE_NAME@
262 | PACKAGE_PATCHLEVEL_VERSION = @PACKAGE_PATCHLEVEL_VERSION@
263 | PACKAGE_RELEASE_DATE = @PACKAGE_RELEASE_DATE@
264 | PACKAGE_STRING = @PACKAGE_STRING@
265 | PACKAGE_TARNAME = @PACKAGE_TARNAME@
266 | PACKAGE_URL = @PACKAGE_URL@
267 | PACKAGE_VERSION = @PACKAGE_VERSION@
268 | PACKAGE_VERSION_ADDENDUM = @PACKAGE_VERSION_ADDENDUM@
269 | PATH_SEPARATOR = @PATH_SEPARATOR@
270 | PKG_CONFIG = @PKG_CONFIG@
271 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
272 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
273 | RANLIB = @RANLIB@
274 | SED = @SED@
275 | SET_MAKE = @SET_MAKE@
276 | SHELL = @SHELL@
277 | STRIP = @STRIP@
278 | VERSION = @VERSION@
279 | abs_builddir = @abs_builddir@
280 | abs_srcdir = @abs_srcdir@
281 | abs_top_builddir = @abs_top_builddir@
282 | abs_top_srcdir = @abs_top_srcdir@
283 | ac_ct_AR = @ac_ct_AR@
284 | ac_ct_CC = @ac_ct_CC@
285 | ac_ct_CXX = @ac_ct_CXX@
286 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
287 | am__include = @am__include@
288 | am__leading_dot = @am__leading_dot@
289 | am__quote = @am__quote@
290 | am__tar = @am__tar@
291 | am__untar = @am__untar@
292 | bindir = @bindir@
293 | build = @build@
294 | build_alias = @build_alias@
295 | build_cpu = @build_cpu@
296 | build_os = @build_os@
297 | build_vendor = @build_vendor@
298 | builddir = @builddir@
299 | datadir = @datadir@
300 | datarootdir = @datarootdir@
301 | docdir = @docdir@
302 | dvidir = @dvidir@
303 | exec_prefix = @exec_prefix@
304 | host = @host@
305 | host_alias = @host_alias@
306 | host_cpu = @host_cpu@
307 | host_os = @host_os@
308 | host_vendor = @host_vendor@
309 | htmldir = @htmldir@
310 | includedir = @includedir@
311 | infodir = @infodir@
312 | install_sh = @install_sh@
313 | libdir = @libdir@
314 | libexecdir = @libexecdir@
315 | localedir = @localedir@
316 | localstatedir = @localstatedir@
317 | mandir = @mandir@
318 | mkdir_p = @mkdir_p@
319 | oldincludedir = @oldincludedir@
320 | pdfdir = @pdfdir@
321 | prefix = @prefix@
322 | program_transform_name = @program_transform_name@
323 | psdir = @psdir@
324 | runstatedir = @runstatedir@
325 | sbindir = @sbindir@
326 | sharedstatedir = @sharedstatedir@
327 | srcdir = @srcdir@
328 | sysconfdir = @sysconfdir@
329 | target_alias = @target_alias@
330 | top_build_prefix = @top_build_prefix@
331 | top_builddir = @top_builddir@
332 | top_srcdir = @top_srcdir@
333 | AM_CFLAGS = $(MAGICKCORE_CFLAGS)
334 | magick_cache_SOURCES = magick-cache.c
335 | magick_cache_LDADD = $(top_builddir)/MagickCache/libMagickCache.la \
336 | $(AM_LDFLAGS) $(MAGICKCORE_LIBS)
337 | UTILITIES_MANS = \
338 | utilities/magick-cache.1
339 |
340 | UTILITIES_CONFIGURE = \
341 | utilities/magick-cache.1.in
342 |
343 | all: all-am
344 |
345 | .SUFFIXES:
346 | .SUFFIXES: .c .lo .o .obj
347 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
348 | @for dep in $?; do \
349 | case '$(am__configure_deps)' in \
350 | *$$dep*) \
351 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
352 | && { if test -f $@; then exit 0; else break; fi; }; \
353 | exit 1;; \
354 | esac; \
355 | done; \
356 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utilities/Makefile'; \
357 | $(am__cd) $(top_srcdir) && \
358 | $(AUTOMAKE) --foreign utilities/Makefile
359 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
360 | @case '$?' in \
361 | *config.status*) \
362 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
363 | *) \
364 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
365 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
366 | esac;
367 |
368 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
369 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
370 |
371 | $(top_srcdir)/configure: $(am__configure_deps)
372 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
373 | $(ACLOCAL_M4): $(am__aclocal_m4_deps)
374 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
375 | $(am__aclocal_m4_deps):
376 | magick-cache.1: $(top_builddir)/config.status $(srcdir)/magick-cache.1.in
377 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
378 | install-binPROGRAMS: $(bin_PROGRAMS)
379 | @$(NORMAL_INSTALL)
380 | @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
381 | if test -n "$$list"; then \
382 | echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
383 | $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
384 | fi; \
385 | for p in $$list; do echo "$$p $$p"; done | \
386 | sed 's/$(EXEEXT)$$//' | \
387 | while read p p1; do if test -f $$p \
388 | || test -f $$p1 \
389 | ; then echo "$$p"; echo "$$p"; else :; fi; \
390 | done | \
391 | sed -e 'p;s,.*/,,;n;h' \
392 | -e 's|.*|.|' \
393 | -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
394 | sed 'N;N;N;s,\n, ,g' | \
395 | $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
396 | { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
397 | if ($$2 == $$4) files[d] = files[d] " " $$1; \
398 | else { print "f", $$3 "/" $$4, $$1; } } \
399 | END { for (d in files) print "f", d, files[d] }' | \
400 | while read type dir files; do \
401 | if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
402 | test -z "$$files" || { \
403 | echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
404 | $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
405 | } \
406 | ; done
407 |
408 | uninstall-binPROGRAMS:
409 | @$(NORMAL_UNINSTALL)
410 | @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
411 | files=`for p in $$list; do echo "$$p"; done | \
412 | sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
413 | -e 's/$$/$(EXEEXT)/' \
414 | `; \
415 | test -n "$$list" || exit 0; \
416 | echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
417 | cd "$(DESTDIR)$(bindir)" && rm -f $$files
418 |
419 | clean-binPROGRAMS:
420 | @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
421 | echo " rm -f" $$list; \
422 | rm -f $$list || exit $$?; \
423 | test -n "$(EXEEXT)" || exit 0; \
424 | list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
425 | echo " rm -f" $$list; \
426 | rm -f $$list
427 |
428 | magick-cache$(EXEEXT): $(magick_cache_OBJECTS) $(magick_cache_DEPENDENCIES) $(EXTRA_magick_cache_DEPENDENCIES)
429 | @rm -f magick-cache$(EXEEXT)
430 | $(AM_V_CCLD)$(LINK) $(magick_cache_OBJECTS) $(magick_cache_LDADD) $(LIBS)
431 |
432 | mostlyclean-compile:
433 | -rm -f *.$(OBJEXT)
434 |
435 | distclean-compile:
436 | -rm -f *.tab.c
437 |
438 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/magick-cache.Po@am__quote@ # am--include-marker
439 |
440 | $(am__depfiles_remade):
441 | @$(MKDIR_P) $(@D)
442 | @echo '# dummy' >$@-t && $(am__mv) $@-t $@
443 |
444 | am--depfiles: $(am__depfiles_remade)
445 |
446 | .c.o:
447 | @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
448 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
449 | @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
450 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
451 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
452 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
453 |
454 | .c.obj:
455 | @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
456 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
457 | @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
458 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
459 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
460 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
461 |
462 | .c.lo:
463 | @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
464 | @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
465 | @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
466 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
467 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
468 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
469 |
470 | mostlyclean-libtool:
471 | -rm -f *.lo
472 |
473 | clean-libtool:
474 | -rm -rf .libs _libs
475 |
476 | ID: $(am__tagged_files)
477 | $(am__define_uniq_tagged_files); mkid -fID $$unique
478 | tags: tags-am
479 | TAGS: tags
480 |
481 | tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
482 | set x; \
483 | here=`pwd`; \
484 | $(am__define_uniq_tagged_files); \
485 | shift; \
486 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
487 | test -n "$$unique" || unique=$$empty_fix; \
488 | if test $$# -gt 0; then \
489 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
490 | "$$@" $$unique; \
491 | else \
492 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
493 | $$unique; \
494 | fi; \
495 | fi
496 | ctags: ctags-am
497 |
498 | CTAGS: ctags
499 | ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
500 | $(am__define_uniq_tagged_files); \
501 | test -z "$(CTAGS_ARGS)$$unique" \
502 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
503 | $$unique
504 |
505 | GTAGS:
506 | here=`$(am__cd) $(top_builddir) && pwd` \
507 | && $(am__cd) $(top_srcdir) \
508 | && gtags -i $(GTAGS_ARGS) "$$here"
509 | cscopelist: cscopelist-am
510 |
511 | cscopelist-am: $(am__tagged_files)
512 | list='$(am__tagged_files)'; \
513 | case "$(srcdir)" in \
514 | [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
515 | *) sdir=$(subdir)/$(srcdir) ;; \
516 | esac; \
517 | for i in $$list; do \
518 | if test -f "$$i"; then \
519 | echo "$(subdir)/$$i"; \
520 | else \
521 | echo "$$sdir/$$i"; \
522 | fi; \
523 | done >> $(top_builddir)/cscope.files
524 |
525 | distclean-tags:
526 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
527 | distdir: $(BUILT_SOURCES)
528 | $(MAKE) $(AM_MAKEFLAGS) distdir-am
529 |
530 | distdir-am: $(DISTFILES)
531 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
532 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
533 | list='$(DISTFILES)'; \
534 | dist_files=`for file in $$list; do echo $$file; done | \
535 | sed -e "s|^$$srcdirstrip/||;t" \
536 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
537 | case $$dist_files in \
538 | */*) $(MKDIR_P) `echo "$$dist_files" | \
539 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
540 | sort -u` ;; \
541 | esac; \
542 | for file in $$dist_files; do \
543 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
544 | if test -d $$d/$$file; then \
545 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
546 | if test -d "$(distdir)/$$file"; then \
547 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
548 | fi; \
549 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
550 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
551 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
552 | fi; \
553 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
554 | else \
555 | test -f "$(distdir)/$$file" \
556 | || cp -p $$d/$$file "$(distdir)/$$file" \
557 | || exit 1; \
558 | fi; \
559 | done
560 | check-am: all-am
561 | check: check-am
562 | all-am: Makefile $(PROGRAMS)
563 | installdirs:
564 | for dir in "$(DESTDIR)$(bindir)"; do \
565 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \
566 | done
567 | install: install-am
568 | install-exec: install-exec-am
569 | install-data: install-data-am
570 | uninstall: uninstall-am
571 |
572 | install-am: all-am
573 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
574 |
575 | installcheck: installcheck-am
576 | install-strip:
577 | if test -z '$(STRIP)'; then \
578 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
579 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
580 | install; \
581 | else \
582 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
583 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
584 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
585 | fi
586 | mostlyclean-generic:
587 |
588 | clean-generic:
589 |
590 | distclean-generic:
591 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
592 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
593 |
594 | maintainer-clean-generic:
595 | @echo "This command is intended for maintainers to use"
596 | @echo "it deletes files that may require special tools to rebuild."
597 | clean: clean-am
598 |
599 | clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
600 |
601 | distclean: distclean-am
602 | -rm -f ./$(DEPDIR)/magick-cache.Po
603 | -rm -f Makefile
604 | distclean-am: clean-am distclean-compile distclean-generic \
605 | distclean-tags
606 |
607 | dvi: dvi-am
608 |
609 | dvi-am:
610 |
611 | html: html-am
612 |
613 | html-am:
614 |
615 | info: info-am
616 |
617 | info-am:
618 |
619 | install-data-am:
620 |
621 | install-dvi: install-dvi-am
622 |
623 | install-dvi-am:
624 |
625 | install-exec-am: install-binPROGRAMS
626 |
627 | install-html: install-html-am
628 |
629 | install-html-am:
630 |
631 | install-info: install-info-am
632 |
633 | install-info-am:
634 |
635 | install-man:
636 |
637 | install-pdf: install-pdf-am
638 |
639 | install-pdf-am:
640 |
641 | install-ps: install-ps-am
642 |
643 | install-ps-am:
644 |
645 | installcheck-am:
646 |
647 | maintainer-clean: maintainer-clean-am
648 | -rm -f ./$(DEPDIR)/magick-cache.Po
649 | -rm -f Makefile
650 | maintainer-clean-am: distclean-am maintainer-clean-generic
651 |
652 | mostlyclean: mostlyclean-am
653 |
654 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \
655 | mostlyclean-libtool
656 |
657 | pdf: pdf-am
658 |
659 | pdf-am:
660 |
661 | ps: ps-am
662 |
663 | ps-am:
664 |
665 | uninstall-am: uninstall-binPROGRAMS
666 |
667 | .MAKE: install-am install-strip
668 |
669 | .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
670 | clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
671 | ctags ctags-am distclean distclean-compile distclean-generic \
672 | distclean-libtool distclean-tags distdir dvi dvi-am html \
673 | html-am info info-am install install-am install-binPROGRAMS \
674 | install-data install-data-am install-dvi install-dvi-am \
675 | install-exec install-exec-am install-html install-html-am \
676 | install-info install-info-am install-man install-pdf \
677 | install-pdf-am install-ps install-ps-am install-strip \
678 | installcheck installcheck-am installdirs maintainer-clean \
679 | maintainer-clean-generic mostlyclean mostlyclean-compile \
680 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
681 | tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
682 |
683 | .PRECIOUS: Makefile
684 |
685 |
686 | # Tell versions [3.59,3.63) of GNU make to not export all variables.
687 | # Otherwise a system limit (for SysV at least) may be exceeded.
688 | .NOEXPORT:
689 |
--------------------------------------------------------------------------------
/utilities/magick-cache.1.in:
--------------------------------------------------------------------------------
1 | .TH magick-cache 1 "Date: 2021/01/10 01:00:00" "ImageMagick"
2 | .SH NAME
3 | magick-cache \- The Magick Cache stores and retrieves images efficiently within milliseconds with a small memory footprint.
4 | .SH SYNOPSIS
5 | .TP
6 | \fBmagick-cache\fP [\fI-passkey filename\fP] \fIcreate\fP \fIpath\fP
7 | \fBmagick-cache\fP [\fI-passkey filename\fP] [\fIdelete | expire | identify\fP] [\fIpath\fP] \fIiri\fP
8 | \fBmagick-cache\fP [\fI-passkey filename\fP] [\fI-passphrase filename\fP] [\fI-ttl time\fP] [\fI-extract geometry\fP] get [\fIpath\fP] \fIiri\fP \fIfilename\fP
9 | \fBmagick-cache\fP [\fI-passkey filename\fP] [\fI-passphrase filename\fP] [\fI-ttl time\fP put \fIpath\fP \fIiri\fP \fIfilename\fP
10 | .SH OVERVIEW
11 | magick-cache \- is a tool to cache images, image sequences,
12 | video, audio or metadata in a local folder. Any content is memory-mapped for
13 | efficient retrieval. Additional efficiences are possible by retrieving a
14 | portion of an image. Content can persist or you can assign a time-to-live
15 | (TTL) to automatically expire content when the TTL is exceeded. MagickCache
16 | supports virtually unlimited content upwards of billions of images making it
17 | suitable as a web image service.
18 |
19 | For more information about the magick-cache command, point your browser to file://@DOCUMENTATION_PATH@/www/magick-cache.html or http://imagemagick.org/script/magick-cache.php.
20 | .SH DESCRIPTION
21 | \-passkey passkey passkey file
22 | \-passphrase passphrase passphrase file
23 | \-extract geometry extract or resize the image
24 | \-ttl time time to live in seconds or neumonics, e.g. "2 days"
25 |
26 | .SH COPYRIGHT
27 | \fBCopyright @ 1999 ImageMagick Studio LLC. Additional copyrights and licenses apply to this software, see file://@DOCUMENTATION_PATH@/www/license.html or http://imagemagick.org/script/license.php\fP
28 |
--------------------------------------------------------------------------------
/utilities/magick-cache.c:
--------------------------------------------------------------------------------
1 | /*
2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 | % %
4 | % %
5 | % %
6 | % M M AAA GGGG IIIII CCCC K K %
7 | % MM MM A A G I C K K %
8 | % M M M AAAAA G GGG I C KKK %
9 | % M M A A G G I C K K %
10 | % M M A A GGGG IIIII CCCC K K %
11 | % %
12 | % CCCC AAA CCCC H H EEEEE %
13 | % C A A C H H E %
14 | % C AAAAA C HHHHH EEE %
15 | % C A A C H H E %
16 | % CCCC A A CCCC H H EEEEE %
17 | % %
18 | % CLI Interface to the MagickCache Repository %
19 | % %
20 | % Software Design %
21 | % Cristy %
22 | % March 2021 %
23 | % %
24 | % %
25 | % Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization %
26 | % dedicated to making software imaging solutions freely available. %
27 | % %
28 | % You may not use this file except in compliance with the License. You may %
29 | % obtain a copy of the License at %
30 | % %
31 | % https://imagemagick.org/script/license.php %
32 | % %
33 | % Unless required by applicable law or agreed to in writing, software %
34 | % distributed under the License is distributed on an "AS IS" BASIS, %
35 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
36 | % See the License for the specific language governing permissions and %
37 | % limitations under the License. %
38 | % %
39 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 | %
41 | % The MagickCache provides secure methods and tools to cache images, image
42 | % sequences, video, audio or metadata in a local folder. Any content is
43 | % memory-mapped for efficient retrieval. Additional efficiences are possible
44 | % by retrieving a portion of an image. Content can persist or you can assign
45 | % a time-to-live (TTL) to automatically expire content when the TTL is
46 | % exceeded. MagickCache supports virtually unlimited content upwards of
47 | % billions of images making it suitable as a web image service.
48 | %
49 | */
50 |
51 | #include
52 | #include "MagickCache/MagickCache.h"
53 |
54 | /*
55 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 | % %
57 | % %
58 | % %
59 | % M a i n %
60 | % %
61 | % %
62 | % %
63 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 | %
65 | %
66 | */
67 |
68 | static MagickBooleanType DeleteResources(MagickCache *cache,
69 | MagickCacheResource *resource,const void *context)
70 | {
71 | MagickBooleanType
72 | status;
73 |
74 | ssize_t
75 | *count = (ssize_t *) context;
76 |
77 | status=DeleteMagickCacheResource(cache,resource);
78 | if (status != MagickFalse)
79 | (*count)++;
80 | return(status);
81 | }
82 |
83 | static MagickBooleanType ExpireResources(MagickCache *cache,
84 | MagickCacheResource *resource,const void *context)
85 | {
86 | MagickBooleanType
87 | status;
88 |
89 | ssize_t
90 | *count = (ssize_t *) context;
91 |
92 | status=IsMagickCacheResourceExpired(cache,resource);
93 | if (status != MagickFalse)
94 | {
95 | (*count)++;
96 | return(DeleteMagickCacheResource(cache,resource));
97 | }
98 | return(MagickTrue);
99 | }
100 |
101 | static MagickBooleanType IdentifyResources(MagickCache *cache,
102 | MagickCacheResource *resource,const void *context)
103 | {
104 | MagickBooleanType
105 | status;
106 |
107 | ssize_t
108 | *count = (ssize_t *) context;
109 |
110 | status=IdentifyMagickCacheResource(cache,resource,stdout);
111 | if (status != MagickFalse)
112 | (*count)++;
113 | return(status);
114 | }
115 |
116 | static void MagickCacheUsage(int argc,char **argv)
117 | {
118 | (void) fprintf(stdout,"Version: %s\n",GetMagickCacheVersion((size_t *) NULL));
119 | (void) fprintf(stdout,"Copyright: %s\n\n",GetMagickCacheCopyright());
120 | (void) fprintf(stdout,"Usage: %s [-passkey filename] create path\n",*argv);
121 | (void) fprintf(stdout,"Usage: %s [-passkey filename] "
122 | "[delete | expire | identify] path iri\n",*argv);
123 | (void) fprintf(stdout,"Usage: %s [-passkey filename] [-passphrase filename]"
124 | " [-extract geometry] [-ttl seconds] get path iri filename\n",*argv);
125 | (void) fprintf(stdout,"Usage: %s [-passkey filename] [-passphrase filename]"
126 | " [-ttl seconds] put path iri filename\n",*argv);
127 | exit(0);
128 | }
129 |
130 | static MagickBooleanType MagickCacheCLI(int argc,char **argv,
131 | ExceptionInfo *exception)
132 | {
133 | #define MagickCacheExit(exception) \
134 | { \
135 | CatchException(exception); \
136 | if (passphrase != (StringInfo *) NULL) \
137 | passphrase=DestroyStringInfo(passphrase); \
138 | if (passkey != (StringInfo *) NULL) \
139 | passkey=DestroyStringInfo(passkey); \
140 | if (resource != (MagickCacheResource *) NULL) \
141 | resource=DestroyMagickCacheResource(resource); \
142 | if (cache != (MagickCache *) NULL) \
143 | cache=DestroyMagickCache(cache); \
144 | if (message != (char *) NULL) \
145 | message=DestroyString(message); \
146 | return(MagickFalse); \
147 | }
148 | #define ThrowMagickCacheException(cache) \
149 | { \
150 | description=GetMagickCacheException(cache,&severity); \
151 | (void) FormatLocaleFile(stderr,"%s %s %lu %s\n",GetMagickModule(), \
152 | description); \
153 | description=(char *) DestroyString(description); \
154 | MagickCacheExit(exception); \
155 | }
156 | #define ThrowMagickCacheResourceException(cache,resource) \
157 | { \
158 | ThrowMagickCacheException(cache); \
159 | description=GetMagickCacheResourceException(resource,&severity); \
160 | (void) FormatLocaleFile(stderr,"%s %s %lu %s\n",GetMagickModule(), \
161 | description); \
162 | description=(char *) DestroyString(description); \
163 | MagickCacheExit(exception); \
164 | }
165 |
166 | char
167 | *description = (char *) NULL,
168 | *extract = (char *) NULL,
169 | *filename = (char *) "not defined",
170 | *function,
171 | *iri,
172 | *message = (char *) NULL,
173 | *path;
174 |
175 | const char
176 | *meta;
177 |
178 | const Image
179 | *image;
180 |
181 | ExceptionType
182 | severity = UndefinedException;
183 |
184 | ImageInfo
185 | *image_info;
186 |
187 | int
188 | i = 1;
189 |
190 | MagickBooleanType
191 | status;
192 |
193 | MagickCache
194 | *cache = (MagickCache *) NULL;
195 |
196 | MagickCacheResource
197 | *resource = (MagickCacheResource *) NULL;
198 |
199 | MagickCacheResourceType
200 | type;
201 |
202 | size_t
203 | extent;
204 |
205 | StringInfo
206 | *passkey = (StringInfo *) NULL,
207 | *passphrase = (StringInfo *) NULL;
208 |
209 | time_t
210 | ttl = 0;
211 |
212 | if (argc < 2)
213 | MagickCacheUsage(argc,argv);
214 | for ( ; i < (argc-1); i++)
215 | {
216 | if (*argv[i] != '-')
217 | break;
218 | if (LocaleCompare(argv[i],"-passkey") == 0)
219 | {
220 | /*
221 | Protect your cache repository and its resources with a passkey.
222 | */
223 | passkey=FileToStringInfo(argv[++i],~0UL,exception);
224 | if (passkey == (StringInfo *) NULL)
225 | {
226 | message=GetExceptionMessage(errno);
227 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
228 | "unable to read passkey","`%s': %s",argv[i],message);
229 | MagickCacheExit(exception);
230 | }
231 | }
232 | if (LocaleCompare(argv[i],"-passphrase") == 0)
233 | {
234 | /*
235 | Protect your image by scrambling its content.
236 | */
237 | passphrase=FileToStringInfo(argv[++i],~0UL,exception);
238 | if (passphrase == (StringInfo *) NULL)
239 | {
240 | message=GetExceptionMessage(errno);
241 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
242 | "unable to read passphrase","`%s': %s",argv[i],message);
243 | MagickCacheExit(exception);
244 | }
245 | }
246 | if (LocaleCompare(argv[i],"-ttl") == 0)
247 | {
248 | char
249 | *q;
250 |
251 | /*
252 | Time to live, absolute or relative, e.g. 1440, 2 hours, 3 days, ...
253 | */
254 | ttl=(time_t) InterpretLocaleValue(argv[++i],&q);
255 | if (q != argv[i])
256 | {
257 | while (isspace((int) ((unsigned char) *q)) != 0)
258 | q++;
259 | if (LocaleNCompare(q,"second",6) == 0)
260 | ttl*=1;
261 | if (LocaleNCompare(q,"minute",6) == 0)
262 | ttl*=60;
263 | if (LocaleNCompare(q,"hour",4) == 0)
264 | ttl*=3600;
265 | if (LocaleNCompare(q,"day",3) == 0)
266 | ttl*=86400;
267 | if (LocaleNCompare(q,"week",4) == 0)
268 | ttl*=604800;
269 | if (LocaleNCompare(q,"month",5) == 0)
270 | ttl*=2628000;
271 | if (LocaleNCompare(q,"year",4) == 0)
272 | ttl*=31536000;
273 | }
274 | }
275 | if (LocaleCompare(argv[i],"-extract") == 0)
276 | extract=argv[++i];
277 | }
278 | if (i == (argc-1))
279 | MagickCacheUsage(argc,argv);
280 | function=argv[i];
281 | if (i == (argc-1))
282 | MagickCacheUsage(argc,argv);
283 | path=argv[++i];
284 | if (LocaleCompare(function,"create") == 0)
285 | {
286 | /*
287 | Create a new cache repository.
288 | */
289 | status=CreateMagickCache(path,passkey);
290 | if (status == MagickFalse)
291 | {
292 | message=GetExceptionMessage(errno);
293 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
294 | "unable to create magick cache","`%s': %s",path,message);
295 | MagickCacheExit(exception);
296 | }
297 | return(MagickTrue);
298 | }
299 | cache=AcquireMagickCache(path,passkey);
300 | if (cache == (MagickCache *) NULL)
301 | {
302 | message=GetExceptionMessage(errno);
303 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
304 | "unable to open magick cache","`%s': %s",path,message);
305 | MagickCacheExit(exception);
306 | }
307 | if (i == (argc-1))
308 | MagickCacheUsage(argc,argv);
309 | iri=argv[++i];
310 | resource=AcquireMagickCacheResource(cache,iri);
311 | SetMagickCacheResourceTTL(resource,ttl);
312 | type=GetMagickCacheResourceType(resource);
313 | if ((LocaleCompare(function,"delete") != 0) &&
314 | (LocaleCompare(function,"expire") != 0) &&
315 | (LocaleCompare(function,"identify") != 0))
316 | {
317 | if (type == UndefinedResourceType)
318 | {
319 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
320 | "unrecognized resource type","`%s'",iri);
321 | ThrowMagickCacheResourceException(cache,resource);
322 | }
323 | if (i == (argc-1))
324 | MagickCacheUsage(argc,argv);
325 | filename=argv[++i];
326 | }
327 | status=MagickTrue;
328 | switch (*function)
329 | {
330 | case 'd':
331 | {
332 | if (LocaleCompare(function,"delete") == 0)
333 | {
334 | /*
335 | Delete one or more resources in the cache repository.
336 | */
337 | ssize_t count = 0;
338 | status=IterateMagickCacheResources(cache,iri,&count,DeleteResources);
339 | (void) fprintf(stderr,"deleted %g resources\n",(double) count);
340 | break;
341 | }
342 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
343 | "unrecognized magick cache function","`%s'",filename);
344 | ThrowMagickCacheResourceException(cache,resource);
345 | }
346 | case 'e':
347 | {
348 | if (LocaleCompare(function,"expire") == 0)
349 | {
350 | /*
351 | Expire one or more resources in the cache repository.
352 | */
353 | ssize_t count = 0;
354 | status=IterateMagickCacheResources(cache,iri,&count,ExpireResources);
355 | (void) fprintf(stderr,"expired %g resources\n",(double) count);
356 | break;
357 | }
358 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
359 | "unrecognized magick cache function","`%s'",filename);
360 | ThrowMagickCacheResourceException(cache,resource);
361 | }
362 | case 'g':
363 | {
364 | if (LocaleCompare(function,"get") == 0)
365 | {
366 | /*
367 | Get a resource from the cache repository.
368 | */
369 | switch (type)
370 | {
371 | case BlobResourceType:
372 | {
373 | void *blob = GetMagickCacheResourceBlob(cache,resource);
374 | if (blob == (void *) NULL)
375 | {
376 | status=MagickFalse;
377 | break;
378 | }
379 | status=BlobToFile(filename,blob,GetMagickCacheResourceExtent(
380 | resource),exception);
381 | break;
382 | }
383 | case ImageResourceType:
384 | {
385 | Image
386 | *write_image;
387 |
388 | image=GetMagickCacheResourceImage(cache,resource,extract);
389 | if (image == (Image *) NULL)
390 | {
391 | status=MagickFalse;
392 | break;
393 | }
394 | image_info=AcquireImageInfo();
395 | write_image=CloneImageList(image,exception);
396 | if (passphrase != (StringInfo *) NULL)
397 | status=PasskeyDecipherImage(write_image,passphrase,exception);
398 | if (status != MagickFalse)
399 | status=WriteImages(image_info,write_image,filename,exception);
400 | write_image=DestroyImageList(write_image);
401 | image_info=DestroyImageInfo(image_info);
402 | break;
403 | }
404 | case MetaResourceType:
405 | {
406 | meta=GetMagickCacheResourceMeta(cache,resource);
407 | if (meta == (void *) NULL)
408 | {
409 | status=MagickFalse;
410 | break;
411 | }
412 | status=BlobToFile(filename,meta,strlen(meta),exception);
413 | break;
414 | }
415 | default:
416 | {
417 | (void) ThrowMagickException(exception,GetMagickModule(),
418 | OptionError,"unrecognized IRI type","`%s'",iri);
419 | break;
420 | }
421 | }
422 | if (status == MagickFalse)
423 | {
424 | (void) ThrowMagickException(exception,GetMagickModule(),
425 | OptionError,"unable to get resource","`%s'",filename);
426 | ThrowMagickCacheResourceException(cache,resource);
427 | }
428 | break;
429 | }
430 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
431 | "unrecognized magick cache function","`%s'",filename);
432 | MagickCacheExit(exception);
433 | }
434 | case 'i':
435 | {
436 | if (LocaleCompare(function,"identify") == 0)
437 | {
438 | /*
439 | Identify one or more resources in the cache repository.
440 | */
441 | ssize_t count = 0;
442 | MagickCacheResource *resource = AcquireMagickCacheResource(cache,iri);
443 | MagickCacheResourceType type = GetMagickCacheResourceType(resource);
444 | resource=DestroyMagickCacheResource(resource);
445 | if (type != WildResourceType)
446 | status=IterateMagickCacheResources(cache,iri,&count,
447 | IdentifyResources);
448 | else
449 | {
450 | char *clone_iri = AcquireString(iri);
451 | (void) SubstituteString(&clone_iri,"/*/","/image/");
452 | resource=AcquireMagickCacheResource(cache,clone_iri);
453 | if (resource != (MagickCacheResource *) NULL)
454 | {
455 | status=IterateMagickCacheResources(cache,clone_iri,&count,
456 | IdentifyResources);
457 | resource=DestroyMagickCacheResource(resource);
458 | }
459 | (void) SubstituteString(&clone_iri,"/image/","/blob/");
460 | resource=AcquireMagickCacheResource(cache,clone_iri);
461 | if (resource != (MagickCacheResource *) NULL)
462 | {
463 | status=IterateMagickCacheResources(cache,clone_iri,&count,
464 | IdentifyResources);
465 | resource=DestroyMagickCacheResource(resource);
466 | }
467 | (void) SubstituteString(&clone_iri,"/blob/","/meta/");
468 | resource=AcquireMagickCacheResource(cache,clone_iri);
469 | if (resource != (MagickCacheResource *) NULL)
470 | {
471 | status=IterateMagickCacheResources(cache,clone_iri,&count,
472 | IdentifyResources);
473 | resource=DestroyMagickCacheResource(resource);
474 | }
475 | clone_iri=DestroyString(clone_iri);
476 | }
477 | (void) fprintf(stderr,"identified %g resources\n",(double) count);
478 | if (status == MagickFalse)
479 | {
480 | (void) ThrowMagickException(exception,GetMagickModule(),
481 | OptionError,"unable to identify resource","`%s'",filename);
482 | ThrowMagickCacheResourceException(cache,resource);
483 | }
484 | break;
485 | }
486 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
487 | "unrecognized magick cache function","`%s'",filename);
488 | MagickCacheExit(exception);
489 | }
490 | case 'p':
491 | {
492 | if (LocaleCompare(function,"put") == 0)
493 | {
494 | /*
495 | Put a resource in the cache repository.
496 | */
497 | switch (type)
498 | {
499 | case BlobResourceType:
500 | {
501 | void *blob = FileToBlob(filename,~0UL,&extent,exception);
502 | if (blob == (void *) NULL)
503 | {
504 | status=MagickFalse;
505 | break;
506 | }
507 | status=PutMagickCacheResourceBlob(cache,resource,extent,blob);
508 | blob=RelinquishMagickMemory(blob);
509 | break;
510 | }
511 | case ImageResourceType:
512 | {
513 | Image
514 | *resource_image;
515 |
516 | image_info=AcquireImageInfo();
517 | (void) CopyMagickString(image_info->filename,filename,
518 | MagickPathExtent);
519 | image=ReadImage(image_info,exception);
520 | image_info=DestroyImageInfo(image_info);
521 | if (image == (Image *) NULL)
522 | {
523 | status=MagickFalse;
524 | break;
525 | }
526 | resource_image=CloneImageList(image,exception);
527 | if (resource_image == (Image *) NULL)
528 | {
529 | status=MagickFalse;
530 | break;
531 | }
532 | if (passphrase != (StringInfo *) NULL)
533 | status=PasskeyEncipherImage(resource_image,passphrase,
534 | exception);
535 | if (status != MagickFalse)
536 | status=PutMagickCacheResourceImage(cache,resource,
537 | resource_image);
538 | resource_image=DestroyImageList(resource_image);
539 | break;
540 | }
541 | case MetaResourceType:
542 | {
543 | meta=(char *) FileToBlob(filename,~0UL,&extent,exception);
544 | if (meta == (char *) NULL)
545 | {
546 | status=MagickFalse;
547 | break;
548 | }
549 | status=PutMagickCacheResourceMeta(cache,resource,meta);
550 | break;
551 | }
552 | default:
553 | {
554 | (void) ThrowMagickException(exception,GetMagickModule(),
555 | OptionError,"unrecognized IRI type","`%s'",iri);
556 | break;
557 | }
558 | }
559 | if (status == MagickFalse)
560 | {
561 | (void) ThrowMagickException(exception,GetMagickModule(),
562 | OptionError,"unable to put resource","`%s'",filename);
563 | ThrowMagickCacheResourceException(cache,resource);
564 | }
565 | break;
566 | }
567 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
568 | "unrecognized magick cache function","`%s'",function);
569 | MagickCacheExit(exception);
570 | }
571 | default:
572 | {
573 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
574 | "unrecognized magick cache function","`%s'",function);
575 | MagickCacheExit(exception);
576 | }
577 | }
578 | if (passphrase != (StringInfo *) NULL)
579 | passphrase=DestroyStringInfo(passphrase);
580 | if (passkey != (StringInfo *) NULL)
581 | passkey=DestroyStringInfo(passkey);
582 | resource=DestroyMagickCacheResource(resource);
583 | cache=DestroyMagickCache(cache);
584 | return(MagickTrue);
585 | }
586 |
587 | static int MagickCacheMain(int argc,char **argv)
588 | {
589 | ExceptionInfo
590 | *exception;
591 |
592 | MagickBooleanType
593 | status;
594 |
595 | MagickCoreGenesis(*argv,MagickTrue);
596 | exception=AcquireExceptionInfo();
597 | status=MagickCacheCLI(argc,argv,exception);
598 | exception=DestroyExceptionInfo(exception);
599 | MagickCoreTerminus();
600 | return(status != MagickFalse ? 0 : 1);
601 | }
602 |
603 | #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)
604 | int main(int argc,char **argv)
605 | {
606 | return(MagickCacheMain(argc,argv));
607 | }
608 | #else
609 | int wmain(int argc,wchar_t *argv[])
610 | {
611 | char
612 | **utf8;
613 |
614 | int
615 | status;
616 |
617 | int
618 | i;
619 |
620 | utf8=NTArgvToUTF8(argc,argv);
621 | status=MagickCacheMain(argc,utf8);
622 | for (i=0; i < argc; i++)
623 | utf8[i]=DestroyString(utf8[i]);
624 | utf8=(char **) RelinquishMagickMemory(utf8);
625 | return(status);
626 | }
627 | #endif
628 |
--------------------------------------------------------------------------------