pax_global_header00006660000000000000000000000064151146240600014511gustar00rootroot0000000000000052 comment=c7b01379fa00ff152bc22d4dd0e0d5bb862282d9 swig-4.4.1/000077500000000000000000000000001511462406000124705ustar00rootroot00000000000000swig-4.4.1/.github/000077500000000000000000000000001511462406000140305ustar00rootroot00000000000000swig-4.4.1/.github/workflows/000077500000000000000000000000001511462406000160655ustar00rootroot00000000000000swig-4.4.1/.github/workflows/linux.yml000066400000000000000000000400071511462406000177500ustar00rootroot00000000000000name: linux on: push: paths-ignore: - 'CHANGES*' - 'Doc/**' - 'appveyor.yml' pull_request: branches: master paths-ignore: - 'CHANGES*' - 'Doc/**' - 'appveyor.yml' permissions: contents: read jobs: build: # When continue-on-error is true for an individual build, that build can fail (it'll show red), # but it won't fail the overall build continue-on-error: ${{ matrix.continue-on-error || false }} runs-on: ${{ matrix.os || 'ubuntu-22.04' }} # By default, the name of the build is the language used and SWIG options, but matrix entries # can define the additional "desc" field with any additional information to include in the name. name: ${{ matrix.SWIGLANG || 'none' }}${{ matrix.PY2 }} ${{ matrix.ENGINE}} ${{ matrix.VER }} ${{ matrix.PY_ABI_VER && format('abi={0}', matrix.PY_ABI_VER) }} ${{ matrix.SWIG_FEATURES }} ${{ (matrix.compiler || 'gcc') }}${{ matrix.GCC }} ${{ matrix.CPPSTD }} ${{ matrix.CSTD }} ${{ matrix.desc }} ${{ matrix.continue-on-error && '(can fail)' }} strategy: matrix: include: - SWIGLANG: "" CPPFLAGS: "-DDOH_POISON" - SWIGLANG: "" GCC: 9 CPPSTD: c++98 CSTD: c99 - SWIGLANG: "" GCC: 9 - SWIGLANG: "" GCC: 10 - SWIGLANG: "" GCC: 11 - SWIGLANG: "" GCC: 12 os: ubuntu-22.04 - SWIGLANG: "" GCC: 13 os: ubuntu-22.04 - SWIGLANG: "" compiler: clang os: ubuntu-22.04 - SWIGLANG: c CPPSTD: c++11 - SWIGLANG: csharp - SWIGLANG: d VER: 'ldc' CPPSTD: c++14 - SWIGLANG: d VER: 'gdmd' CPPSTD: c++11 - SWIGLANG: d VER: '2.103.1' CPPSTD: c++17 - SWIGLANG: go VER: '1.20' CSTD: gnu11 - SWIGLANG: go VER: '1.24' CSTD: gnu99 # Go 1.24 doesn't build with -Wdeclaration-after-statement - SWIGLANG: guile - SWIGLANG: guile VER: '3.0' - SWIGLANG: java - SWIGLANG: javascript ENGINE: jsc VER: '4.0' - SWIGLANG: javascript ENGINE: node VER: '12' CPPSTD: c++11 - SWIGLANG: lua - SWIGLANG: lua VER: '5.3' - SWIGLANG: octave CPPSTD: c++11 - SWIGLANG: octave os: ubuntu-22.04 # Octave 6.4.0 CPPSTD: c++11 - SWIGLANG: perl5 - SWIGLANG: php VER: '8.0' - SWIGLANG: php VER: '8.1' - SWIGLANG: php VER: '8.2' - SWIGLANG: php VER: '8.3' CPPSTD: c++11 # C++98 not supported by PHP. - SWIGLANG: php VER: '8.4' CPPSTD: c++11 # C++98 not supported by PHP. - SWIGLANG: php VER: '8.5' CPPSTD: c++11 # C++98 not supported by PHP. continue-on-error: true # PHP 8.5 has not yet been released. - SWIGLANG: python PY2: 2 #- SWIGLANG: python # VER: '3.5' # os: ubuntu-20.04 # Python < 3.7 not available for 22.04. #- SWIGLANG: python # VER: '3.6' # os: ubuntu-20.04 # Python < 3.7 not available for 22.04. - SWIGLANG: python VER: '3.7' - SWIGLANG: python VER: '3.8' - SWIGLANG: python VER: '3.9' - SWIGLANG: python VER: '3.10' - SWIGLANG: python VER: '3.11' - SWIGLANG: python VER: '3.12' CSTD: gnu99 - SWIGLANG: python VER: '3.13' CSTD: gnu99 - SWIGLANG: python VER: '3.13' PY_ABI_VER: '3.9' CSTD: gnu99 - SWIGLANG: python VER: '3.13-dbg' CSTD: gnu99 - SWIGLANG: python VER: '3.13' CSTD: gnu99 SWIG_FEATURES: -nogil # Test that -nogil has no effect on non-free-threading Python - SWIGLANG: python VER: '3.13t' CSTD: gnu99 SWIG_FEATURES: -nogil - SWIGLANG: python VER: '3.14' PY_ABI_VER: '3.14' CSTD: gnu99 - SWIGLANG: python VER: '3.14' CSTD: gnu99 - SWIGLANG: python PY2: 2 SWIG_FEATURES: -builtin - SWIGLANG: python PY2: 2 SWIG_FEATURES: -builtin -O - SWIGLANG: python SWIG_FEATURES: -builtin - SWIGLANG: python VER: '3.8' SWIG_FEATURES: -builtin - SWIGLANG: python SWIG_FEATURES: -builtin -O - SWIGLANG: python VER: '3.13' SWIG_FEATURES: -builtin - SWIGLANG: python VER: '3.13' SWIG_FEATURES: -builtin -O - SWIGLANG: python VER: '3.8' PY_ABI_VER: '3.5' - SWIGLANG: r os: ubuntu-24.04 - SWIGLANG: ruby VER: '2.0' - SWIGLANG: ruby VER: '2.1' - SWIGLANG: ruby VER: '2.2' - SWIGLANG: ruby VER: '2.3' # Ruby 2.4 and 2.6 both fail with ubuntu-22.04 with error: # Error running '__rvm_make -j4', # please read /usr/share/rvm/log/1740710476_ruby-3.0.0/make.log # - SWIGLANG: ruby # VER: '2.4' - SWIGLANG: ruby VER: '2.5' # - SWIGLANG: ruby # VER: '2.6' - SWIGLANG: ruby VER: '2.7' - SWIGLANG: ruby VER: '3.0' CPPSTD: c++11 - SWIGLANG: ruby VER: '3.1' CPPSTD: c++11 - SWIGLANG: ruby CPPSTD: c++11 VER: '3.2' - SWIGLANG: scilab VER: '5.5.2' - SWIGLANG: scilab VER: '6.0.2' - SWIGLANG: scilab os: ubuntu-22.04 # scilab 6.1.1 - SWIGLANG: scilab VER: '2023.1.0' - SWIGLANG: scilab VER: '2024.1.0' - SWIGLANG: scilab VER: '2025.1.0' - SWIGLANG: tcl # c++11 testing - SWIGLANG: csharp CPPSTD: c++11 - SWIGLANG: go VER: '1.20' CPPSTD: c++11 CSTD: gnu11 - SWIGLANG: guile CPPSTD: c++11 - SWIGLANG: java CPPSTD: c++11 - SWIGLANG: javascript ENGINE: jsc VER: '4.1' os: ubuntu-22.04 CPPSTD: c++11 - SWIGLANG: javascript ENGINE: node VER: '14' CPPSTD: c++11 - SWIGLANG: lua CPPSTD: c++11 - SWIGLANG: perl5 CPPSTD: c++11 - SWIGLANG: php CPPSTD: c++11 CSTD: gnu11 - SWIGLANG: python CPPSTD: c++11 - SWIGLANG: r CPPSTD: c++11 - SWIGLANG: ruby CPPSTD: c++11 VER: '3.3.9' # 3.3.10 has an error: -Werror=missing-field-initializers, see https://bugs.ruby-lang.org/issues/21659 - SWIGLANG: ruby CPPSTD: c++11 - SWIGLANG: scilab CPPSTD: c++11 - SWIGLANG: tcl CPPSTD: c++11 # c++14 testing - SWIGLANG: csharp CPPSTD: c++14 - SWIGLANG: go VER: '1.20' CPPSTD: c++14 CSTD: gnu11 - SWIGLANG: guile CPPSTD: c++14 - SWIGLANG: java CPPSTD: c++14 - SWIGLANG: javascript ENGINE: node VER: '16' CPPSTD: c++14 - SWIGLANG: lua CPPSTD: c++14 - SWIGLANG: octave CPPSTD: c++14 - SWIGLANG: perl5 CPPSTD: c++14 - SWIGLANG: php CPPSTD: c++14 CSTD: gnu11 - SWIGLANG: python CPPSTD: c++14 - SWIGLANG: r CPPSTD: c++14 - SWIGLANG: ruby CPPSTD: c++14 - SWIGLANG: scilab CPPSTD: c++14 - SWIGLANG: tcl CPPSTD: c++14 # c++17 testing (using gcc13) - SWIGLANG: csharp CPPSTD: c++17 GCC: 13 - SWIGLANG: go VER: '1.20' CPPSTD: c++17 GCC: 13 CSTD: gnu17 - SWIGLANG: guile CPPSTD: c++17 GCC: 13 - SWIGLANG: java CPPSTD: c++17 GCC: 13 - SWIGLANG: javascript ENGINE: node VER: '18' CPPSTD: c++17 GCC: 13 - SWIGLANG: javascript ENGINE: napi VER: '20' CPPSTD: c++17 GCC: 13 - SWIGLANG: lua CPPSTD: c++17 GCC: 13 - SWIGLANG: octave CPPSTD: c++17 GCC: 13 - SWIGLANG: perl5 CPPSTD: c++17 GCC: 13 - SWIGLANG: php CPPSTD: c++17 CSTD: gnu17 GCC: 13 - SWIGLANG: python CPPSTD: c++17 GCC: 13 - SWIGLANG: r CPPSTD: c++17 GCC: 13 os: ubuntu-24.04 - SWIGLANG: ruby CPPSTD: c++17 GCC: 13 - SWIGLANG: scilab CPPSTD: c++17 GCC: 13 - SWIGLANG: tcl CPPSTD: c++17 GCC: 13 # c++20 testing (using gcc13) - SWIGLANG: c CPPSTD: c++20 GCC: 13 os: ubuntu-22.04 - SWIGLANG: python CPPSTD: c++20 GCC: 13 os: ubuntu-22.04 - SWIGLANG: javascript ENGINE: jsc CPPSTD: c++20 VER: '4.1' GCC: 13 os: ubuntu-22.04 - SWIGLANG: javascript ENGINE: napi VER: '22' CPPSTD: c++20 GCC: 13 os: ubuntu-22.04 - SWIGLANG: javascript ENGINE: node VER: '20' CPPSTD: c++20 GCC: 13 os: ubuntu-22.04 - SWIGLANG: javascript ENGINE: v8 CSTD: c++14 CPPSTD: c++14 VER: '7.8' # oldest we can easily test os: ubuntu-22.04 - SWIGLANG: javascript ENGINE: v8 CSTD: c++14 CPPSTD: c++14 VER: '10.2' os: ubuntu-24.04 - SWIGLANG: ocaml CPPSTD: c++17 GCC: 13 os: ubuntu-22.04 continue-on-error: true # Run all of them, as opposed to aborting when one fails fail-fast: false env: SWIGLANG: ${{ matrix.SWIGLANG }} PY2: ${{ matrix.PY2 }} VER: ${{ matrix.VER }} ENGINE: ${{ matrix.ENGINE }} SWIG_FEATURES: ${{ matrix.SWIG_FEATURES }} GCC: ${{ matrix.GCC }} CSTD: ${{ matrix.CSTD }} CPPSTD: ${{ matrix.CPPSTD }} CPPFLAGS: ${{ matrix.CPPFLAGS }} PY_ABI_VER: ${{ matrix.PY_ABI_VER }} steps: - name: Machine Info run: | echo "nproc..." nproc --all echo "uname..." uname --all echo "meminfo..." cat /proc/meminfo echo "lsb-release..." cat /etc/lsb-release - name: Checkout uses: actions/checkout@v4 with: show-progress: false submodules: recursive - name: Install CCache uses: hendrikmuhs/ccache-action@v1 with: key: ${{ matrix.os || 'ubuntu-22.04' }}-${{ matrix.compiler || 'gcc' }}${{ matrix.GCC }} # Uncomment to debug via ssh, see https://github.com/mxschmitt/action-tmate # - name: Setup tmate session # uses: mxschmitt/action-tmate@v3 - name: Install Dependencies run: | set -x export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" echo PATH="$PATH" >> $GITHUB_ENV source $GITHUB_WORKSPACE/Tools/GHA-linux-install.sh echo WITHLANG="$WITHLANG" >> $GITHUB_ENV case $(uname) in Linux) cpu_count=$(nproc) ;; Darwin) cpu_count=$(sysctl -n hw.ncpu) ;; *) cpu_count=1 ;; esac if [[ $cpu_count != 1 ]]; then echo SWIGJOBS=-j$cpu_count >> $GITHUB_ENV fi if test '${{ matrix.compiler }}' = 'clang'; then CC="clang" CXX="clang++" CFLAGS="$CFLAGS -fPIE" CXXFLAGS="$CXXFLAGS -fPIE" elif test -n "$GCC"; then CC="gcc-$GCC" CXX="g++-$GCC" else CC="gcc" CXX="g++" fi export CC CXX echo CC="$CC" >> $GITHUB_ENV echo CXX="$CXX" >> $GITHUB_ENV ls -la $(which $CC) $(which $CXX) $CC --version $CXX --version - name: Configure run: | source $GITHUB_WORKSPACE/Tools/CI-linux-environment.sh set -x if [[ -z "$CSTD" ]]; then case "$CPPSTD" in c++11) export CSTD=c11 ;; c++14) export CSTD=c11 ;; c++17) export CSTD=c17 ;; c++20) export CSTD=c17 ;; esac echo CSTD="$CSTD" >> $GITHUB_ENV fi if test -z "$CPPSTD"; then CONFIGOPTS+=("--disable-cpp11-testing"); fi if test -n "$CPPSTD"; then CONFIGOPTS+=("CXXFLAGS=-std=$CPPSTD $CXXFLAGS"); fi if test -n "$CSTD"; then CONFIGOPTS+=("CFLAGS=-std=$CSTD $CFLAGS"); fi if test -n "$SWIGLANG"; then CONFIGOPTS+=(--without-alllang --with-$WITHLANG); fi if test "$PY2" = "2"; then CONFIGOPTS+=(--with-python=python2 --without-python3); fi echo "${CONFIGOPTS[@]}" ./autogen.sh && mkdir -p build/build && cd build/build && ../../configure "${CONFIGOPTS[@]}" - name: Build working-directory: build/build run: | set -x make -s $SWIGJOBS ./swig -version && ./swig -pcreversion - name: Test working-directory: build/build run: | source $GITHUB_WORKSPACE/Tools/CI-linux-environment.sh set -x if test -z "$SWIGLANG"; then make $SWIGJOBS check-ccache make $SWIGJOBS check-errors-test-suite else case "$SWIGLANG" in ocaml) # `make check-ocaml-test-suite` fails with parallel make with: # # File "swig.ml", line 1: # Error: Could not find the .cmi file for interface swig.mli. # # Apparently we ought to be using `ocamldep` to generate make # dependencies. unset SWIGJOBS ;; scilab) case $VER in ""|6.*|2023.*|2024.0.*|2024.1.*) # Some older versions of scilab sporadically fail with: # terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error' # #2942 says that it was probably introduced in 6.x (we've # seen it with 6.1.0.0, but haven't with 5.x); it also says # "this issue was fixed in Scilab 2024.1.0" but we are # still seeing sporadic failures with that version. unset SWIGJOBS ;; esac ;; esac # Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic. cflags="$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cflags --std=$CSTD --compiler=$CC)" cxxflags="$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cxxflags --std=$CPPSTD --compiler=$CC)" make check-$SWIGLANG-version make check-$SWIGLANG-enabled make $SWIGJOBS check-$SWIGLANG-examples CFLAGS="$cflags" CXXFLAGS="$cxxflags" PY_ABI_VER="$PY_ABI_VER" make $SWIGJOBS check-$SWIGLANG-test-suite CFLAGS="$cflags" CXXFLAGS="$cxxflags" PY_ABI_VER="$PY_ABI_VER" fi - name: Install working-directory: build/build run: | set -x if test -z "$SWIGLANG"; then sudo make install && swig -version && ccache-swig -V; fi - name: Clean working-directory: build/build run: | set -x make check-maintainer-clean && ../../configure swig-4.4.1/.github/workflows/windows-cmake.yml000066400000000000000000000042051511462406000213610ustar00rootroot00000000000000name: windows-cmake on: push: paths-ignore: - 'CHANGES*' - 'Doc/**' - 'appveyor.yml' pull_request: branches: master paths-ignore: - 'CHANGES*' - 'Doc/**' - 'appveyor.yml' permissions: contents: read jobs: cmake: runs-on: ${{ matrix.os }} name: CMake VS ${{ matrix.VER }} strategy: matrix: include: - VER: '17 2022' os: 'windows-2025' env: BUILD_SYS: Visual Studio ${{ matrix.VER }} steps: - name: Machine Info shell: powershell run: | systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version" - name: Checkout uses: actions/checkout@v4 with: show-progress: false - name: Install CCache uses: hendrikmuhs/ccache-action@v1 with: key: ${{ matrix.os }} - name: Install NuGet Packages shell: powershell run: | nuget install PCRE2 -OutputDirectory C:\Tools nuget install Bison -OutputDirectory C:\Tools # https://cygwin.com/cygwin-ug-net/cygpath.html - name: Prepare Environment shell: bash run: | cat << EOF >> $GITHUB_ENV PCRE2_PATH=$(cygpath -w "$(ls -d /C/Tools/PCRE2*)") EOF BISON_PATH=$(cygpath -w "$(ls -d /C/Tools/Bison*)/bin") echo "$BISON_PATH" >> $GITHUB_PATH - name: Configure shell: powershell run: | cmake --version cmake -G "$env:BUILD_SYS" -A x64 ` -DCMAKE_INSTALL_PREFIX="C:\Tools\swig" ` -DCMAKE_C_FLAGS="/W3 /EHsc /DPCRE2_STATIC" ` -DCMAKE_CXX_FLAGS="/W3 /EHsc /DPCRE2_STATIC" ` -DPCRE2_INCLUDE_DIR="$env:PCRE2_PATH\include" ` -DPCRE2_LIBRARY="$env:PCRE2_PATH\lib\pcre2-8-static.lib" ` -DLINK_FLAGS="/NODEFAULTLIB:MSVCRT" -S . -B . - name: Build shell: powershell run: | cmake --build . --config Release - name: Test shell: powershell run: | ctest --output-on-failure -V -C Release - name: Install shell: powershell run: | cmake --install . C:\Tools\swig\bin\swig.exe -version swig-4.4.1/.github/workflows/windows.yml000066400000000000000000000247761511462406000203220ustar00rootroot00000000000000name: windows on: push: paths-ignore: - 'CHANGES*' - 'Doc/**' - 'appveyor.yml' pull_request: branches: master paths-ignore: - 'CHANGES*' - 'Doc/**' - 'appveyor.yml' permissions: contents: read jobs: win_ci: # When continue-on-error is true for an individual build, # that build can fail (it'll show red), # but it won't fail the overall tests continue-on-error: ${{ matrix.continue-on-error || false }} # https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md runs-on: ${{ matrix.os || 'windows-2025' }} # The name of the test follow the tested language name: > ${{ matrix.SWIGLANG }} ${{ matrix.VER }} ${{ matrix.SWIG_FEATURES }} ${{ matrix.COMPILER || 'msvc' }} ${{ matrix.os }} ${{ matrix.continue-on-error && '(can fail)' }} strategy: matrix: include: - SWIGLANG: csharp INSTALL: 'true' - SWIGLANG: csharp INSTALL: 'true' COMPILER: gcc - SWIGLANG: java VER: 8 - SWIGLANG: java VER: 17 - SWIGLANG: java VER: 21 - SWIGLANG: java COMPILER: gcc VER: 8 - SWIGLANG: java COMPILER: gcc VER: 11 - SWIGLANG: python VER: '3.9' - SWIGLANG: python VER: '3.10' SWIG_FEATURES: -builtin - SWIGLANG: python VER: '3.13' - SWIGLANG: python COMPILER: gcc - SWIGLANG: ruby COMPILER: gcc - SWIGLANG: ruby VER: '3.2' COMPILER: gcc - SWIGLANG: ruby VER: '3.3' COMPILER: gcc # Run all of them, as opposed to aborting when one fails fail-fast: false env: CFLAGS: '-O2' CXXFLAGS: '-O2' CCCL_OPTIONS: '--cccl-muffle /W3 /EHsc' PCRE2_CCCL_LD: '-lpcre2-8-static --cccl-link /NODEFAULTLIB:MSVCRT' CHECK_OPTIONS: 'CSHARPOPTIONS=-platform:x64' SWIGLANG: ${{ matrix.SWIGLANG }} VER: ${{ matrix.VER }} SWIG_FEATURES: ${{ matrix.SWIG_FEATURES }} COMPILER: ${{ matrix.COMPILER }} OS: ${{ matrix.os }} INSTALL: ${{ matrix.INSTALL }} # cl.exe: # https://learn.microsoft.com//cpp/build/reference/compiler-options # /EHc extern "C" defaults to nothrow. # /EHs Enable C++ exception handling (no SEH exceptions). # /W3 Warning level. # /WX Treat warnings as errors. # https://learn.microsoft.com//cpp/build/reference/linker-options # cl.exe pass linker: # /VERBOSE:LIB Outputs progress messages during the link process. # /NODEFAULTLIB:lib Ignore library 'lib' steps: - name: Machine Info shell: powershell run: | systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version" - name: Checkout uses: actions/checkout@v4 with: show-progress: false - name: Install CCache uses: hendrikmuhs/ccache-action@v1 with: key: ${{ matrix.os || 'windows-2025' }}-${{ matrix.COMPILER || 'msvc' }} - name: Install NuGet Packages if: ${{ env.COMPILER == '' }} shell: powershell run: | # 'nuget build for .NET: https://www.nuget.org/packages' nuget install PCRE2 -OutputDirectory C:\Tools nuget install boost -OutputDirectory C:\Tools # Set MSVC compilers path and environment variables. - name: Setup MSVC if: ${{ env.COMPILER == '' || env.SWIGLANG == 'csharp' }} uses: TheMrMilchmann/setup-msvc-dev@v3 with: arch: x64 - name: Prepare Environment shell: bash run: | uname --all if [[ "$COMPILER" = "gcc" ]]; then # MinGW-w64 variant to use mingw_variant=mingw-w64-x86_64 mingw_dir=mingw64 case "$SWIGLANG" in python) MORE_MSYS_PKGS+=" $mingw_variant-python" # MinGW-w64 using MSVCRT runtime seems to have an issue with finding # the proper STL library (iostream classes) on runtime, # As a workaround we use static link. # Once we switch to MinGW-w64 with UCRT runtime, the issue will be solved. # See: https://www.msys2.org/docs/environments/#msvcrt-vs-ucrt if [[ "$mingw_variant" = "mingw-w64-x86_64" ]]; then echo "EXAMPLE_LIBS=-static-libstdc++ -static-libgcc" >> $GITHUB_ENV fi ;; ruby) mingw_variant=mingw-w64-ucrt-x86_64 MORE_MSYS_PKGS+=" $mingw_variant-gcc" # We need the MinGW-w64 using Universal CRT mingw_dir=ucrt64 if [[ -n "$VER" ]]; then ruby_dir=$(ls -d /c/hostedtoolcache/windows/Ruby/$VER*)/x64/bin RUBYDIR=$(cygpath -w $ruby_dir) echo "$RUBYDIR" >> $GITHUB_PATH else MORE_MSYS_PKGS+=" $mingw_variant-ruby" fi ;; perl) MORE_MSYS_PKGS+=" $mingw_variant-perl" ;; esac # MinGW-w64 packages to install with MSYS2 for n in binutils make autotools pcre2 boost; do MORE_MSYS_PKGS+=" $mingw_variant-$n" done # MinGW-w64 pcre2 echo "PCRE2_CFLAGS=-I/$mingw_dir/include -DPCRE2_STATIC" >> $GITHUB_ENV echo "PCRE2_LIBS=-L/$mingw_dir/lib -lpcre2-8" >> $GITHUB_ENV echo "MORE_MSYS_PKGS=base-devel $MORE_MSYS_PKGS" >> $GITHUB_ENV echo "BOOST_PATH=/c/msys64/$mingw_dir" >> $GITHUB_ENV # gcc compiler location echo "MINGW_CC=/$mingw_dir/bin" >> $GITHUB_ENV else # COMPILER: cccl wrapping MSVC curl --retry 15 -s -L https://github.com/swig/cccl/raw/cccl-1.4/cccl -o /usr/bin/cccl chmod +x /usr/bin/cccl /usr/bin/cccl --version cp -p /usr/bin/cccl /c/msys64/usr/bin/cccl # Using pcre2 installed with NuGet PCRE2_PATH=$(ls -d /c/tools/PCRE2*) echo "PCRE2_CFLAGS=-I$PCRE2_PATH/include -DPCRE2_STATIC" >> $GITHUB_ENV echo "PCRE2_LIBS=-L$PCRE2_PATH/lib $PCRE2_CCCL_LD" >> $GITHUB_ENV echo "CXX=/usr/bin/cccl" >> $GITHUB_ENV echo "CC=/usr/bin/cccl" >> $GITHUB_ENV echo "BOOST_PATH=$(ls -d /c/tools/boost*)/lib/native" >> $GITHUB_ENV if [[ -n "$VER" ]]; then case "$SWIGLANG" in python) PYTHONDIR_UNIX=$(ls -d /c/hostedtoolcache/windows/Python/$VER*)/x64 PYTHONDIR=$(cygpath -w $PYTHONDIR_UNIX) echo "$PYTHONDIR\\Script" >> $GITHUB_PATH echo "$PYTHONDIR" >> $GITHUB_PATH ;; ruby) RUBYDIR_UNIX=$(ls -d /c/hostedtoolcache/windows/Ruby/$VER*)/x64 RUBYDIR=$(cygpath -w $RUBYDIR_UNIX) echo "$RUBYDIR\\bin" >> $GITHUB_PATH ;; esac fi fi # COMPILER # Java must use VER! if [[ "$SWIGLANG" = "java" ]]; then declare -n java_path="JAVA_HOME_${VER}_X64" echo "JAVA_HOME=$java_path" >> $GITHUB_ENV fi echo "SWIGJOBS=-j$NUMBER_OF_PROCESSORS" >> $GITHUB_ENV echo 'C:\msys64\usr\bin' >> $GITHUB_PATH - name: Install MSYS2 Packages shell: cmd run: | rem 'MSYS2 uses MinGW-w64 https://packages.msys2.org/' pacman -Syu --noconfirm --needed if %ErrorLevel% NEQ 0 (exit 1) pacman -Syu --noconfirm --needed autoconf automake bison %MORE_MSYS_PKGS% if %ErrorLevel% NEQ 0 (exit 1) - name: Autoconf shell: bash run: | uname --all if [[ -z "$COMPILER" ]]; then which cl.exe cl.exe /? 2>&1 | head -n1 else # Use MinGW-w64 compiler # We can not use GITHUB_PATH, as bash insert /usr/bin export PATH="$MINGW_CC:$PATH" which gcc gcc --version | head -n1 which g++ g++ --version | head -n1 fi case "$SWIGLANG" in csharp) which csc.exe csc.exe /? | head -n1 ;; python) which python.exe python -V ;; ruby) which ruby.exe ruby -v ;; perl) which perl.exe perl -v | head -n3 ;; esac make --version | head -n2 ./autogen.sh - name: Configure shell: bash run: | if [[ "$COMPILER" = "gcc" ]]; then # Use MinGW-w64 compiler export PATH="$MINGW_CC:$PATH" ./configure --disable-dependency-tracking --with-boost="$BOOST_PATH" --with-csharp-compiler="csc.exe" else # cccl wrapping MSVC ./configure --disable-dependency-tracking --with-boost="$BOOST_PATH" --with-csharp-compiler="csc.exe" --disable-ccache fi - name: Build shell: bash run: | if [[ "$COMPILER" = "gcc" ]]; then # Use MinGW-w64 compiler export PATH="$MINGW_CC:$PATH" fi make -s $SWIGJOBS # Test the Windows swig have a proper SWIG library path - name: Test swiglib shell: bash run: | # path is based on executable location if ! [[ "$(./swig.exe -swiglib)" = "$(cygpath -w "$PWD")\\Lib" ]]; then exit 1 fi - name: Test shell: bash run: | if [[ "$COMPILER" = "gcc" ]]; then # Use MinGW-w64 compiler export PATH="$MINGW_CC:$PATH" fi ./swig.exe -version make check-$SWIGLANG-version make check-$SWIGLANG-enabled make -k check-$SWIGLANG-examples $SWIGJOBS $CHECK_OPTIONS make -k check-$SWIGLANG-test-suite $SWIGJOBS $CHECK_OPTIONS - name: Install if: ${{ env.INSTALL == 'true' }} shell: bash run: | make -s install > /dev/null which swig.exe swig.exe -version # TODO: Make install of ccache-swig do not work on Windows #if [[ "$COMPILER" = "gcc" ]]; then # which ccache-swig.exe # ccache-swig.exe -V #fi # The test by itself is not related to the installation. # We just want to save testing time :-) - name: Clean if: ${{ env.INSTALL == 'true' }} shell: bash run: | make check-maintainer-clean swig-4.4.1/ANNOUNCE000066400000000000000000000023171511462406000136240ustar00rootroot00000000000000*** ANNOUNCE: SWIG 4.4.1 (7 Dec 2025) *** https://www.swig.org We're pleased to announce SWIG-4.4.1, the latest SWIG release. What is SWIG? ============= SWIG is a software development tool that reads C/C++ header files and generates the wrapper code needed to make C and C++ code accessible from other programming languages including Perl, Python, Tcl, Ruby, PHP, C#, Go, Java, Javascript, Lua, Scheme (Guile), D, Ocaml, Octave, R, Scilab. SWIG can also export its parse tree in the form of XML. Major applications of SWIG include generation of scripting language extension modules, rapid prototyping, testing, and user interface development for large C/C++ systems. Release Notes ============= Detailed release notes are available with the release and are also published on the SWIG web site at https://swig.org/release.html. Availability ============ The release is available for download on Sourceforge at https://prdownloads.sourceforge.net/swig/swig-4.4.1.tar.gz A Windows version is also available at https://prdownloads.sourceforge.net/swig/swigwin-4.4.1.zip Please report problems with this release to the swig-devel mailing list, details at https://www.swig.org/mail.html. --- The SWIG Developers swig-4.4.1/CCache/000077500000000000000000000000001511462406000135765ustar00rootroot00000000000000swig-4.4.1/CCache/COPYING000066400000000000000000000430761511462406000146430ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. swig-4.4.1/CCache/Makefile.in000066400000000000000000000053221511462406000156450ustar00rootroot00000000000000datarootdir = @datarootdir@ srcdir=@srcdir@ VPATH=@srcdir@ prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ mandir=@mandir@ INSTALLCMD=@INSTALL@ PACKAGE_NAME=@PACKAGE_NAME@ PROGRAM_NAME=@PROGRAM_NAME@ # Soft link test can be skipped on systems that don't support soft linking NOSOFTLINKSTEST= CC=@CC@ CFLAGS=@CFLAGS@ -I. SWIG=swig SWIG_LIB=../$(srcdir)/../Lib EXEEXT=@EXEEXT@ LIBS= @LIBS@ OBJS= ccache.o mdfour.o hash.o execute.o util.o args.o stats.o \ cleanup.o snprintf.o unify.o HEADERS = ccache.h mdfour.h config.h config_win32.h all: $(PACKAGE_NAME)$(EXEEXT) # Regenerate Makefile if Makefile.in or config.status have changed. Makefile: $(srcdir)/Makefile.in ./config.status $(SHELL) ./config.status # Note that HTML documentation is actually generated and used from the main SWIG documentation Makefile docs: $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/$(PACKAGE_NAME)-man.html $(PACKAGE_NAME)$(EXEEXT): $(OBJS) $(HEADERS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(srcdir)/$(PACKAGE_NAME).1: $(srcdir)/ccache.yo -yodl2man -o $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/ccache.yo $(srcdir)/web/$(PACKAGE_NAME)-man.html: $(srcdir)/ccache.yo yodl2html -o $(srcdir)/web/$(PACKAGE_NAME)-man.html $(srcdir)/ccache.yo install: $(PACKAGE_NAME)$(EXEEXT) @echo "Installing $(PACKAGE_NAME)" @echo "Installing $(DESTDIR)${bindir}/$(PROGRAM_NAME)$(EXEEXT)" ${INSTALLCMD} -d $(DESTDIR)${bindir} ${INSTALLCMD} -m 755 $(PACKAGE_NAME)$(EXEEXT) $(DESTDIR)${bindir}/$(PROGRAM_NAME)$(EXEEXT) install-docs: $(srcdir)/$(PACKAGE_NAME).1 @echo "Installing $(DESTDIR)${mandir}/man1/$(PROGRAM_NAME).1" ${INSTALLCMD} -d $(DESTDIR)${mandir}/man1 ${INSTALLCMD} -m 644 $(srcdir)/$(PACKAGE_NAME).1 $(DESTDIR)${mandir}/man1/$(PROGRAM_NAME).1 uninstall: $(PACKAGE_NAME)$(EXEEXT) rm -f $(DESTDIR)${bindir}/$(PROGRAM_NAME)$(EXEEXT) uninstall-docs: $(srcdir)/$(PACKAGE_NAME).1 rm -f $(DESTDIR)${mandir}/man1/$(PROGRAM_NAME).1 clean: clean-docs /bin/rm -f $(OBJS) *~ $(PACKAGE_NAME)$(EXEEXT) clean-docs: rm -f $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/$(PACKAGE_NAME)-man.html test: test.sh SWIG_LIB='$(SWIG_LIB)' PATH=../..:$$PATH SWIG='$(SWIG)' CC='$(CC)' NOSOFTLINKSTEST='$(NOSOFTLINKSTEST)' CCACHE='../$(PACKAGE_NAME)' CCACHE_PROG=$(PROGRAM_NAME) $(srcdir)/test.sh check: test distclean: clean /bin/rm -f Makefile config.h config.sub config.log build-stamp config.status ccache_swig_config.h config_win32.h /bin/rm -rf autom4te.cache maintainer-clean: distclean /bin/rm -f $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/$(PACKAGE_NAME)-man.html # FIXME: To fix this, test.sh needs to be able to take ccache from the # installed prefix, not from the source dir. installcheck: @echo "WARNING! This is not really \"installcheck\" yet." $(MAKE) check swig-4.4.1/CCache/README000066400000000000000000000012551511462406000144610ustar00rootroot00000000000000This is a re-implementation of "compilercache" in C The original compilercache scripts were by Erik Thiele (erikyyy@erikyyy.de) and I would like to thank him for an excellent piece of work. See http://www.erikyyy.de/compilercache/ for the original shell scripts. I wrote ccache because I wanted to get a bit more speed out of a compiler cache and I wanted to remove some of the limitations of the shell-script version. Please see the manual page and documentation at http://ccache.samba.org/ INSTALLATION ------------ Please run: ./configure make make install then read the ccache manual page ----------- Andrew Tridgell http://samba.org/~tridge/ bugs@ccache.samba.org swig-4.4.1/CCache/README.swig000066400000000000000000000007171511462406000154330ustar00rootroot00000000000000This directory contains a version of ccache. The initial version was based on ccache-2.4 plus debian patches 01-02, 04-14, see the debian/patches subdirectory. The ccache-win32-2.4 modifications to ccache-2.4 have also been merged in. Changes have been made to support caching the output from SWIG. The ability to cache c/c++ compiler output has been retained. Additional features added are the CCACHE_VERBOSE and CCACHE_SWIG environment variables, see docs. swig-4.4.1/CCache/args.c000066400000000000000000000045401511462406000147010ustar00rootroot00000000000000/* convenient routines for argument list handling Copyright (C) Andrew Tridgell 2002 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ccache.h" ARGS *args_init(int init_argc, char **init_args) { ARGS *args; int i; args = (ARGS *)x_malloc(sizeof(ARGS)); args->argc = 0; args->argv = (char **)x_malloc(sizeof(char *)); args->argv[0] = NULL; for (i=0;iargv = (char**)x_realloc(args->argv, (args->argc + 2) * sizeof(char *)); args->argv[args->argc] = x_strdup(s); args->argc++; args->argv[args->argc] = NULL; } /* pop the last element off the args list */ void args_pop(ARGS *args, int n) { while (n--) { args->argc--; free(args->argv[args->argc]); args->argv[args->argc] = NULL; } } /* remove the first element of the argument list */ void args_remove_first(ARGS *args) { free(args->argv[0]); memmove(&args->argv[0], &args->argv[1], args->argc * sizeof(args->argv[0])); args->argc--; } /* add an argument into the front of the argument list */ void args_add_prefix(ARGS *args, const char *s) { args->argv = (char**)x_realloc(args->argv, (args->argc + 2) * sizeof(char *)); memmove(&args->argv[1], &args->argv[0], (args->argc+1) * sizeof(args->argv[0])); args->argv[0] = x_strdup(s); args->argc++; } /* strip any arguments beginning with the specified prefix */ void args_strip(ARGS *args, const char *prefix) { int i; for (i=0; iargc; ) { if (strncmp(args->argv[i], prefix, strlen(prefix)) == 0) { free(args->argv[i]); memmove(&args->argv[i], &args->argv[i+1], args->argc * sizeof(args->argv[i])); args->argc--; } else { i++; } } } swig-4.4.1/CCache/ccache.c000066400000000000000000001040271511462406000151540ustar00rootroot00000000000000/* a re-implementation of the compilercache scripts in C The idea is based on the shell-script compilercache by Erik Thiele Copyright (C) Andrew Tridgell 2002 Copyright (C) Martin Pool 2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ccache.h" /* verbose mode */ int ccache_verbose = 0; /* the base cache directory */ char *cache_dir = NULL; /* the directory for temporary files */ static char *temp_dir = NULL; /* the debug logfile name, if set */ char *cache_logfile = NULL; /* the argument list after processing */ static ARGS *stripped_args; /* the original argument list */ static ARGS *orig_args; /* the output filename being compiled to */ static char *output_file; /* the source file */ static char *input_file; /* the name of the file containing the cached object code */ static char *hashname; /* the extension of the file after pre-processing */ static const char *i_extension; /* the name of the temporary pre-processor file */ static char *i_tmpfile; /* are we compiling a .i or .ii file directly? */ static int direct_i_file; /* the name of the cpp stderr file */ static char *cpp_stderr; /* the name of the statistics file */ char *stats_file = NULL; /* can we safely use the unification hashing backend? */ static int enable_unify; /* should we strip -c when running the preprocessor only? */ static int strip_c_option; /* customisation for using the SWIG compiler */ static int swig; /* a list of supported file extensions, and the equivalent extension for code that has been through the pre-processor */ static struct { char *extension; char *i_extension; } extensions[] = { {"c", "i"}, {"C", "ii"}, {"m", "mi"}, {"cc", "ii"}, {"CC", "ii"}, {"cpp", "ii"}, {"CPP", "ii"}, {"cxx", "ii"}, {"CXX", "ii"}, {"c++", "ii"}, {"C++", "ii"}, {"i", "i"}, {"ii", "ii"}, {NULL, NULL}}; /* something went badly wrong - just execute the real compiler */ static void failed(void) { char *e; /* delete intermediate pre-processor file if needed */ if (i_tmpfile) { if (!direct_i_file) { unlink(i_tmpfile); } free(i_tmpfile); i_tmpfile = NULL; } /* delete the cpp stderr file if necessary */ if (cpp_stderr) { unlink(cpp_stderr); free(cpp_stderr); cpp_stderr = NULL; } /* strip any local args */ args_strip(orig_args, "--ccache-"); if ((e=getenv("CCACHE_PREFIX"))) { char *p = find_executable(e, MYNAME); if (!p) { cc_log("could not find executable (%s)\n", e); perror(e); exit(1); } args_add_prefix(orig_args, p); free(p); } if (ccache_verbose) { display_execute_args(orig_args->argv); } if (swig) { putenv("CCACHE_OUTFILES"); } #ifndef _WIN32 execv(orig_args->argv[0], orig_args->argv); cc_log("execv returned (%s)!\n", strerror(errno)); perror(orig_args->argv[0]); exit(1); #else /* execv on Windows causes the 'non-regular' testcase to fail, so use Win32 API instead */ { PROCESS_INFORMATION pinfo; STARTUPINFO sinfo; BOOL ret; DWORD exitcode; char *args; ZeroMemory(&pinfo, sizeof(PROCESS_INFORMATION)); ZeroMemory(&sinfo, sizeof(STARTUPINFO)); sinfo.cb = sizeof(STARTUPINFO); args = argvtos(orig_args->argv); ret = CreateProcessA(orig_args->argv[0], args, NULL, NULL, TRUE, 0, NULL, NULL, &sinfo, &pinfo); if (!ret) { exitcode = 1; cc_log("CreateProcessA failed starting %s\n", orig_args->argv[0]); perror_win32(orig_args->argv[0]); } else { WaitForSingleObject(pinfo.hProcess, INFINITE); GetExitCodeProcess(pinfo.hProcess, &exitcode); CloseHandle(pinfo.hProcess); CloseHandle(pinfo.hThread); } free(args); exit(exitcode); } #endif } /* return a string to be used to distinguish temporary files this also tries to cope with NFS by adding the local hostname */ static const char *tmp_string(void) { static char *ret; if (!ret) { char hostname[200]; strcpy(hostname, "unknown"); #if HAVE_GETHOSTNAME gethostname(hostname, sizeof(hostname)-1); #endif hostname[sizeof(hostname)-1] = 0; if (asprintf(&ret, "%s.%u", hostname, (unsigned)getpid()) == -1) { fatal("could not allocate tmp_string"); } } return ret; } /* update cached file sizes and count helper function for to_cache() */ static void to_cache_stats_helper(struct stat *pstat, char *cached_filename, char *tmp_outfiles, int *files_size, int *cached_files_count) { #if ENABLE_ZLIB /* do an extra stat on the cache file for the size statistics */ if (stat(cached_filename, pstat) != 0) { cc_log("failed to stat cache files - %s\n", strerror(errno)); stats_update(STATS_ERROR); if (tmp_outfiles) { unlink(tmp_outfiles); } failed(); } #else (void)cached_filename; (void)tmp_outfiles; #endif (*files_size) += file_size(pstat); (*cached_files_count)++; } /* run the real compiler and put the result in cache */ static void to_cache(ARGS *args) { char *path_stderr; char *tmp_stdout, *tmp_stderr, *tmp_outfiles; struct stat st1; int status; int cached_files_count = 0; int files_size = 0; x_asprintf(&tmp_stdout, "%s/tmp.stdout.%s", temp_dir, tmp_string()); x_asprintf(&tmp_stderr, "%s/tmp.stderr.%s", temp_dir, tmp_string()); x_asprintf(&tmp_outfiles, "%s/tmp.outfiles.%s", temp_dir, tmp_string()); if (strip_c_option && !swig) { args_add(stripped_args, "-c"); } if (output_file) { args_add(args, "-o"); args_add(args, output_file); } /* Turn off DEPENDENCIES_OUTPUT when running cc1, because * otherwise it will emit a line like * * tmp.stdout.vexed.732.o: /home/mbp/.ccache/tmp.stdout.vexed.732.i * * unsetenv() is on BSD and Linux but not portable. */ putenv("DEPENDENCIES_OUTPUT"); /* Give SWIG a filename for it to create and populate with a list of files that it generates */ if (swig) { char *ccache_outfiles; x_asprintf(&ccache_outfiles, "CCACHE_OUTFILES=%s", tmp_outfiles); unlink(tmp_outfiles); if (getenv("CCACHE_OUTFILES") || putenv(ccache_outfiles) == -1) { cc_log("CCACHE_OUTFILES env variable already set or could not be set\n"); stats_update(STATS_ERROR); failed(); } } if (getenv("CCACHE_CPP2")) { args_add(args, input_file); } else { if (swig) { args_add(args, "-nopreprocess"); } args_add(args, i_tmpfile); } status = execute(args->argv, tmp_stdout, tmp_stderr); args_pop(args, 3); if (stat(tmp_stdout, &st1) != 0 || st1.st_size != 0) { cc_log("compiler produced stdout for %s\n", input_file); stats_update(STATS_STDOUT); unlink(tmp_stdout); unlink(tmp_stderr); unlink(tmp_outfiles); if (!swig) unlink(output_file); failed(); } unlink(tmp_stdout); if (status != 0) { int fd; cc_log("compile of %s gave status = %d\n", input_file, status); stats_update(STATS_STATUS); fd = open(tmp_stderr, O_RDONLY | O_BINARY); if (fd != -1) { if (cpp_stderr) { /* we might have some stderr from cpp */ int fd2 = open(cpp_stderr, O_RDONLY | O_BINARY); if (fd2 != -1) { copy_fd(fd2, 2); close(fd2); unlink(cpp_stderr); cpp_stderr = NULL; } } /* we can use a quick method of getting the failed output */ copy_fd(fd, 2); close(fd); unlink(tmp_stderr); if (i_tmpfile && !direct_i_file) { unlink(i_tmpfile); } exit(status); } unlink(tmp_stderr); unlink(tmp_outfiles); if (!swig) unlink(output_file); failed(); } else { int hardlink = (getenv("CCACHE_NOCOMPRESS") != 0) && (getenv("CCACHE_HARDLINK") != 0); if (swig) { /* read the list of generated files and copy each of them into the cache */ FILE *file; file = fopen(tmp_outfiles, "r"); if (file) { char out_filename[FILENAME_MAX + 1]; char out_filename_cache[FILENAME_MAX + 1]; while (fgets(out_filename, FILENAME_MAX, file)) { char *linefeed = strchr(out_filename, '\n'); if (linefeed) { char *potential_cr = linefeed - 1; if (potential_cr >= out_filename && *potential_cr == '\r') *potential_cr = 0; *linefeed = 0; if (cached_files_count == 0) { strcpy(out_filename_cache, hashname); } else { sprintf(out_filename_cache, "%s.%d", hashname, cached_files_count); } if (commit_to_cache(out_filename, out_filename_cache, hardlink) != 0) { fclose(file); unlink(tmp_outfiles); failed(); } to_cache_stats_helper(&st1, out_filename_cache, tmp_outfiles, &files_size, &cached_files_count); } else { cached_files_count = 0; break; } } fclose(file); if (cached_files_count == 0) { cc_log("failed to copy output files to cache - internal error\n"); stats_update(STATS_ERROR); unlink(tmp_outfiles); failed(); } /* also copy the (uncompressed) file containing the list of generated files into the cache */ sprintf(out_filename_cache, "%s.outfiles", hashname); if (stat(tmp_outfiles, &st1) != 0 || safe_rename(tmp_outfiles, out_filename_cache) != 0) { cc_log("failed to copy outfiles file to cache - %s\n", strerror(errno)); stats_update(STATS_ERROR); unlink(tmp_outfiles); failed(); } to_cache_stats_helper(&st1, out_filename_cache, tmp_outfiles, &files_size, &cached_files_count); unlink(tmp_outfiles); } else { cc_log("failed to open temp outfiles file - %s\n", strerror(errno)); stats_update(STATS_ERROR); failed(); } } else { if (commit_to_cache(output_file, hashname, hardlink) != 0) { failed(); } to_cache_stats_helper(&st1, hashname, 0, &files_size, &cached_files_count); } } x_asprintf(&path_stderr, "%s.stderr", hashname); if (stat(tmp_stderr, &st1) != 0 || move_file(tmp_stderr, path_stderr) != 0) { cc_log("failed to rename tmp files - %s\n", strerror(errno)); stats_update(STATS_ERROR); failed(); } to_cache_stats_helper(&st1, path_stderr, 0, &files_size, &cached_files_count); cc_log("Placed %d files for %s into cache\n", cached_files_count, input_file); stats_tocache(files_size, cached_files_count); free(tmp_stderr); free(tmp_stdout); free(tmp_outfiles); free(path_stderr); } /* find the hash for a command. The hash includes all argument lists, plus the output from running the compiler with -E */ static void find_hash(ARGS *args) { int i; char *path_stdout, *path_stderr; char *hash_dir; char *s; struct stat st; int status; int nlevels = 2; char *input_base; char *tmp; if ((s = getenv("CCACHE_NLEVELS"))) { nlevels = atoi(s); if (nlevels < 1) nlevels = 1; if (nlevels > 8) nlevels = 8; } hash_start(); /* when we are doing the unifying tricks we need to include the input file name in the hash to get the warnings right */ if (enable_unify || swig) { hash_string(input_file); } if (swig) { if (output_file) { hash_string(output_file); } } else { /* we have to hash the extension, as a .i file isn't treated the same by the compiler as a .ii file */ hash_string(i_extension); } /* first the arguments */ for (i=1;iargc;i++) { /* some arguments don't contribute to the hash. The theory is that these arguments will change the output of -E if they are going to have any effect at all, or they only affect linking */ if (i < args->argc-1) { if (strcmp(args->argv[i], "-I") == 0 || strcmp(args->argv[i], "-include") == 0 || strcmp(args->argv[i], "-L") == 0 || strcmp(args->argv[i], "-D") == 0 || strcmp(args->argv[i], "-idirafter") == 0 || strcmp(args->argv[i], "-isystem") == 0) { i++; continue; } } if (strncmp(args->argv[i], "-I", 2) == 0 || strncmp(args->argv[i], "-L", 2) == 0 || strncmp(args->argv[i], "-D", 2) == 0 || strncmp(args->argv[i], "-idirafter", 10) == 0 || strncmp(args->argv[i], "-isystem", 8) == 0) { continue; } if (strncmp(args->argv[i], "--specs=", 8) == 0 && stat(args->argv[i]+8, &st) == 0) { /* if given a explicit specs file, then hash that file, but don't include the path to it in the hash */ hash_file(args->argv[i]+8); continue; } /* all other arguments are included in the hash */ hash_string(args->argv[i]); } /* the compiler driver size and date. This is a simple minded way to try and detect compiler upgrades. It is not 100% reliable */ if (stat(args->argv[0], &st) != 0) { cc_log("Couldn't stat the compiler!? (argv[0]='%s')\n", args->argv[0]); stats_update(STATS_COMPILER); failed(); } /* also include the hash of the compiler name - as some compilers use hard links and behave differently depending on the real name */ if (st.st_nlink > 1) { char *path = str_basename(args->argv[0]); hash_string(path); free(path); } hash_int(st.st_size); hash_int(st.st_mtime); /* possibly hash the current working directory */ if (getenv("CCACHE_HASHDIR")) { char *cwd = gnu_getcwd(); if (cwd) { hash_string(cwd); free(cwd); } } /* ~/hello.c -> tmp.hello.123.i limit the basename to 10 characters in order to cope with filesystem with small maximum filename length limits */ input_base = str_basename(input_file); tmp = strchr(input_base, '.'); if (tmp != NULL) { *tmp = 0; } if (strlen(input_base) > 10) { input_base[10] = 0; } /* now the run */ x_asprintf(&path_stdout, "%s/%s.tmp.%s.%s", temp_dir, input_base, tmp_string(), i_extension); x_asprintf(&path_stderr, "%s/tmp.cpp_stderr.%s", temp_dir, tmp_string()); free(input_base); if (!direct_i_file) { /* run cpp on the input file to obtain the .i */ args_add(args, "-E"); args_add(args, input_file); status = execute(args->argv, path_stdout, path_stderr); args_pop(args, 2); } else { /* we are compiling a .i or .ii file - that means we can skip the cpp stage and directly form the correct i_tmpfile */ path_stdout = x_strdup(input_file); if (create_empty_file(path_stderr) != 0) { cc_log("failed to create empty stderr file\n"); stats_update(STATS_ERROR); failed(); } status = 0; } if (status != 0) { if (!direct_i_file) { unlink(path_stdout); } unlink(path_stderr); cc_log("the preprocessor gave %d\n", status); stats_update(STATS_PREPROCESSOR); failed(); } /* if the compilation is with -g then we have to include the whole of the preprocessor output, which means we are sensitive to line number information. Otherwise we can discard line number info, which makes us less sensitive to reformatting changes Note! I have now disabled the unification code by default as it gives the wrong line numbers for warnings. Pity. */ if (!enable_unify) { hash_file(path_stdout); } else { if (unify_hash(path_stdout) != 0) { stats_update(STATS_ERROR); failed(); } } hash_file(path_stderr); i_tmpfile = path_stdout; if (!getenv("CCACHE_CPP2")) { /* if we are using the CPP trick then we need to remember this stderr data and output it just before the main stderr from the compiler pass */ cpp_stderr = path_stderr; } else { unlink(path_stderr); free(path_stderr); } /* we use a N level subdir for the cache path to reduce the impact on filesystems which are slow for large directories */ s = hash_result(); x_asprintf(&hash_dir, "%s/%c", cache_dir, s[0]); x_asprintf(&stats_file, "%s/stats", hash_dir); for (i=1; i= out_filename && *potential_cr == '\r') *potential_cr = 0; *linefeed = 0; if (retrieved_files_count == 0) { strcpy(out_filename_cache, hashname); } else { sprintf(out_filename_cache, "%s.%d", hashname, retrieved_files_count); } passfail = retrieve_from_cache(out_filename_cache, out_filename, hardlink); if (passfail == -1) { break; } retrieved_files_count++; } else { cc_log("failed to copy output files from cache - internal error\n"); stats_update(STATS_ERROR); passfail = -1; break; } } if (retrieved_files_count == 0) { cc_log("failed to copy output files from cache - internal error\n"); stats_update(STATS_ERROR); passfail = -1; } fclose(file); } else { cc_log("failed to open cached outfiles file - %s\n", strerror(errno)); stats_update(STATS_ERROR); } } else { passfail = retrieve_from_cache(hashname, output_file, hardlink); } if (passfail == -1) { close(fd_stderr); unlink(stderr_file); free(stderr_file); return; } free(stderr_file); } /* get rid of the intermediate preprocessor file */ if (i_tmpfile) { if (!direct_i_file) { unlink(i_tmpfile); } free(i_tmpfile); i_tmpfile = NULL; } /* send the cpp stderr, if applicable */ if (cpp_stderr) { fd_cpp_stderr = open(cpp_stderr, O_RDONLY | O_BINARY); if (fd_cpp_stderr != -1) { copy_fd(fd_cpp_stderr, 2); close(fd_cpp_stderr); unlink(cpp_stderr); free(cpp_stderr); cpp_stderr = NULL; } } /* send the stderr */ copy_fd(fd_stderr, 2); close(fd_stderr); /* and exit with the right status code */ if (first) { cc_log("got cached result for %s\n", input_file); stats_update(STATS_CACHED); } exit(0); } /* find the real compiler. We just search the PATH to find a executable of the same name that isn't a link to ourselves */ static void find_compiler(int argc, char **argv) { char *base; char *path; orig_args = args_init(argc, argv); base = str_basename(argv[0]); /* we might be being invoked like "ccache gcc -c foo.c" */ if (strcmp(base, MYNAME) == 0) { args_remove_first(orig_args); free(base); if (strchr(argv[1],'/') #ifdef _WIN32 || strchr(argv[1],'\\') #endif ) { /* a full path was given */ return; } base = str_basename(argv[1]); } /* support user override of the compiler */ if ((path=getenv("CCACHE_CC"))) { free(base); base = x_strdup(path); } orig_args->argv[0] = find_executable(base, MYNAME); /* can't find the compiler! */ if (!orig_args->argv[0]) { stats_update(STATS_COMPILER); cc_log("could not find compiler (%s)\n", base); perror(base); free(base); exit(1); } free(base); } /* check a filename for C/C++ extension. Return the pre-processor extension */ static const char *check_extension(const char *fname, int *direct_i) { int i; const char *p; if (direct_i) { *direct_i = 0; } if (swig) return "ii"; /* any file extension is acceptable as input for SWIG */ p = strrchr(fname, '.'); if (!p) return NULL; p++; for (i=0; extensions[i].extension; i++) { if (strcmp(p, extensions[i].extension) == 0) { if (direct_i && strcmp(p, extensions[i].i_extension) == 0) { *direct_i = 1; } p = getenv("CCACHE_EXTENSION"); if (p) return p; return extensions[i].i_extension; } } return NULL; } /* process the compiler options to form the correct set of options for obtaining the preprocessor output */ static void process_args(int argc, char **argv) { int i; int found_c_opt = 0; int found_S_opt = 0; struct stat st; char *e; /* is gcc being asked to output dependencies? */ int generating_dependencies = 0; /* is the dependency makefile name overridden with -MF? */ int dependency_filename_specified = 0; /* is the dependency makefile target name specified with -MQ or -MF? */ int dependency_target_specified = 0; stripped_args = args_init(0, NULL); args_add(stripped_args, argv[0]); /* -c not required for SWIG */ if (swig) { found_c_opt = 1; } for (i=1; iargv[0]); if (strstr(basename, "swig") || getenv("CCACHE_SWIG")) { swig = 1; } free(basename); } /* the main ccache driver function */ static void ccache(int argc, char *argv[]) { /* find the real compiler */ find_compiler(argc, argv); /* use the real compiler if HOME is not set */ if (!cache_dir) { cc_log("Unable to determine home directory\n"); cc_log("ccache is disabled\n"); failed(); } /* we might be disabled */ if (getenv("CCACHE_DISABLE")) { cc_log("ccache is disabled\n"); failed(); } if (getenv("CCACHE_STRIPC")) { strip_c_option = 1; } if (getenv("CCACHE_UNIFY")) { enable_unify = 1; } detect_swig(); /* process argument list, returning a new set of arguments for pre-processing */ process_args(orig_args->argc, orig_args->argv); /* run with -E to find the hash */ find_hash(stripped_args); /* if we can return from cache at this point then do */ from_cache(1); if (getenv("CCACHE_READONLY")) { cc_log("read-only set - doing real compile\n"); failed(); } /* run real compiler, sending output to cache */ to_cache(stripped_args); /* return from cache */ from_cache(0); /* oh oh! */ cc_log("secondary from_cache failed!\n"); stats_update(STATS_ERROR); failed(); } static void usage(void) { printf("%s, a compiler cache including support for SWIG. Version %s\n", MYNAME, CCACHE_VERSION); printf("Copyright Andrew Tridgell, 2002\n\n"); printf("Usage:\n"); printf("\t" MYNAME " [options]\n"); printf("\t" MYNAME " compiler [compile options]\n"); printf("\tcompiler [compile options] (via symbolic link)\n"); printf("\nOptions:\n"); printf("-s show statistics summary\n"); printf("-z zero statistics\n"); printf("-c run a cache cleanup\n"); printf("-C clear the cache completely\n"); printf("-F set maximum files in cache\n"); printf("-M set maximum size of cache (use G, M or K)\n"); printf("-h this help page\n"); printf("-V print version number\n"); } static void check_cache_dir(void) { if (!cache_dir) { fatal("Unable to determine home directory"); } } /* the main program when not doing a compile */ static int ccache_main(int argc, char *argv[]) { int c; size_t v; while ((c = getopt(argc, argv, "hszcCF:M:V")) != -1) { switch (c) { case 'V': printf("%s version %s\n", MYNAME, CCACHE_VERSION); printf("Copyright Andrew Tridgell 2002\n"); printf("Released under the GNU GPL v2 or later\n"); exit(0); case 'h': usage(); exit(0); case 's': check_cache_dir(); stats_summary(); break; case 'c': check_cache_dir(); cleanup_all(cache_dir); printf("Cleaned cache\n"); break; case 'C': check_cache_dir(); wipe_all(cache_dir); printf("Cleared cache\n"); break; case 'z': check_cache_dir(); stats_zero(); printf("Statistics cleared\n"); break; case 'F': check_cache_dir(); v = atoi(optarg); if (stats_set_limits(v, -1) == 0) { printf("Set cache file limit to %u\n", (unsigned)v); } else { printf("Could not set cache file limit.\n"); exit(1); } break; case 'M': check_cache_dir(); v = value_units(optarg); if (stats_set_limits(-1, v) == 0) { printf("Set cache size limit to %uk\n", (unsigned)v); } else { printf("Could not set cache size limit.\n"); exit(1); } break; default: usage(); exit(1); } } return 0; } /* Make a copy of stderr that will not be cached, so things like distcc can send networking errors to it. */ static void setup_uncached_err(void) { char *buf; int uncached_fd; uncached_fd = dup(2); if (uncached_fd == -1) { cc_log("dup(2) failed\n"); stats_update(STATS_ERROR); failed(); } /* leak a pointer to the environment */ x_asprintf(&buf, "UNCACHED_ERR_FD=%d", uncached_fd); if (putenv(buf) == -1) { cc_log("putenv failed\n"); close(uncached_fd); stats_update(STATS_ERROR); failed(); } } int main(int argc, char *argv[]) { char *p; cache_dir = getenv("CCACHE_DIR"); if (!cache_dir) { const char *home_directory = get_home_directory(); if (home_directory) { x_asprintf(&cache_dir, "%s/.ccache", home_directory); } } cache_logfile = getenv("CCACHE_LOGFILE"); if (getenv("CCACHE_VERBOSE")) { ccache_verbose = 1; } setup_uncached_err(); /* the user might have set CCACHE_UMASK */ p = getenv("CCACHE_UMASK"); if (p) { mode_t mask; errno = 0; mask = strtol(p, NULL, 8); if (errno == 0) { umask(mask); } } /* check if we are being invoked as "ccache" */ if (strlen(argv[0]) >= strlen(MYNAME) && strcmp(argv[0] + strlen(argv[0]) - strlen(MYNAME), MYNAME) == 0) { if (argc < 2) { usage(); exit(1); } /* if the first argument isn't an option, then assume we are being passed a compiler name and options */ if (argv[1][0] == '-') { return ccache_main(argc, argv); } } /* make sure the cache dir exists */ if (cache_dir && (create_dir(cache_dir) != 0)) { fprintf(stderr,"ccache: failed to create %s (%s)\n", cache_dir, strerror(errno)); exit(1); } temp_dir = getenv("CCACHE_TEMPDIR"); if (!temp_dir) { x_asprintf(&temp_dir, "%s/temp", cache_dir); /* make sure temp dir exists if not supplied by user */ if (temp_dir && create_dir(temp_dir) != 0) { fprintf(stderr,"ccache: failed to create %s (%s)\n", temp_dir, strerror(errno)); exit(1); } } if (!getenv("CCACHE_READONLY")) { if (create_cachedirtag(cache_dir) != 0) { fprintf(stderr,"ccache: failed to create %s/CACHEDIR.TAG (%s)\n", cache_dir, strerror(errno)); exit(1); } } ccache(argc, argv); return 1; } swig-4.4.1/CCache/ccache.h000066400000000000000000000110321511462406000151520ustar00rootroot00000000000000#include "ccache_swig_config.h" #define CCACHE_VERSION SWIG_VERSION #ifndef _WIN32 #include "config.h" #else #include #include "config_win32.h" #endif #include #include #include #include #include #include #ifndef _WIN32 #include #include #else #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0500 #endif #include #include #endif #include #include #include #include #include #include #include #include #include #ifdef HAVE_PWD_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef ENABLE_ZLIB #include #endif #define STATUS_NOTFOUND 3 #define STATUS_FATAL 4 #define STATUS_NOCACHE 5 #define MYNAME PROGRAM_NAME #define LIMIT_MULTIPLE 0.8 /* default maximum cache size */ #ifndef DEFAULT_MAXSIZE #define DEFAULT_MAXSIZE (1000*1000) #endif /* file copy mode */ #ifdef ENABLE_ZLIB #define COPY_UNCOMPRESSED 0 #define COPY_FROM_CACHE 1 #define COPY_TO_CACHE 2 #endif enum stats { STATS_NONE=0, STATS_STDOUT, STATS_STATUS, STATS_ERROR, STATS_TOCACHE, STATS_PREPROCESSOR, STATS_COMPILER, STATS_MISSING, STATS_CACHED, STATS_ARGS, STATS_LINK, STATS_NUMFILES, STATS_TOTALSIZE, STATS_MAXFILES, STATS_MAXSIZE, STATS_NOTC, STATS_DEVICE, STATS_NOINPUT, STATS_ENVIRONMMENT, STATS_MULTIPLE, STATS_CONFTEST, STATS_UNSUPPORTED, STATS_OUTSTDOUT, STATS_END }; typedef unsigned uint32; #include "mdfour.h" void hash_start(void); void hash_string(const char *s); void hash_int(int x); void hash_file(const char *fname); char *hash_result(void); void hash_buffer(const char *s, int len); void cc_log(const char *format, ...); void fatal(const char *msg); void copy_fd(int fd_in, int fd_out); int safe_rename(const char* oldpath, const char* newpath); int move_file(const char *src, const char *dest); int test_if_compressed(const char *filename); int commit_to_cache(const char *src, const char *dest, int hardlink); int retrieve_from_cache(const char *src, const char *dest, int hardlink); int create_dir(const char *dir); int create_cachedirtag(const char *dir); void x_asprintf(char **ptr, const char *format, ...); char *x_strdup(const char *s); void *x_realloc(void *ptr, size_t size); void *x_malloc(size_t size); void traverse(const char *dir, void (*fn)(const char *, struct stat *)); char *str_basename(const char *s); char *dirname(char *s); int lock_fd(int fd); size_t file_size(struct stat *st); int safe_open(const char *fname); char *x_realpath(const char *path); char *gnu_getcwd(void); int create_empty_file(const char *fname); const char *get_home_directory(void); int x_utimes(const char *filename); #ifdef _WIN32 void perror_win32(LPTSTR pszFunction); #endif void stats_update(enum stats stat); void stats_zero(void); void stats_summary(void); void stats_tocache(size_t size, size_t numfiles); void stats_read(const char *stats_file, unsigned counters[STATS_END]); int stats_set_limits(long maxfiles, long maxsize); size_t value_units(const char *s); void display_size(unsigned v); void stats_set_sizes(const char *dir, size_t num_files, size_t total_size); int unify_hash(const char *fname); #ifndef HAVE_VASPRINTF int vasprintf(char **, const char *, va_list ); #endif #ifndef HAVE_ASPRINTF int asprintf(char **ptr, const char *format, ...); #endif #ifndef HAVE_SNPRINTF int snprintf(char *,size_t ,const char *, ...); #endif void cleanup_dir(const char *dir, size_t maxfiles, size_t maxsize, size_t minfiles); void cleanup_all(const char *dir); void wipe_all(const char *dir); #ifdef _WIN32 char *argvtos(char **argv); #endif int execute(char **argv, const char *path_stdout, const char *path_stderr); char *find_executable(const char *name, const char *exclude_name); void display_execute_args(char **argv); typedef struct { char **argv; int argc; } ARGS; ARGS *args_init(int , char **); void args_add(ARGS *args, const char *s); void args_add_prefix(ARGS *args, const char *s); void args_pop(ARGS *args, int n); void args_strip(ARGS *args, const char *prefix); void args_remove_first(ARGS *args); extern int ccache_verbose; #if HAVE_COMPAR_FN_T #define COMPAR_FN_T __compar_fn_t #else typedef int (*COMPAR_FN_T)(const void *, const void *); #endif /* work with silly DOS binary open */ #ifndef O_BINARY #define O_BINARY 0 #endif /* mkstemp() on some versions of cygwin don't handle binary files, so override */ /* Seems okay in Cygwin 1.7.0 #ifdef __CYGWIN__ #undef HAVE_MKSTEMP #endif */ swig-4.4.1/CCache/ccache.yo000066400000000000000000000420311511462406000153550ustar00rootroot00000000000000whenman( COMMENT(html output not great if included when using html2doc) manpage(ccache-swig)(1)()()() ) whenhtml(htmlcommand( ccache-swig(1) manpage

Using SWIG with ccache - ccache-swig(1) manpage

)) manpagename(ccache-swig)(a fast compiler cache) whenhtml(htmlcommand( ccache-swig - a fast compiler cache )) manpagesynopsis() ccache-swig [OPTION] ccache-swig [COMPILER OPTIONS] [COMPILER OPTIONS] manpagedescription() ccache-swig is a compiler cache. It speeds up re-compilation of C/C++/SWIG code by caching previous compiles and detecting when the same compile is being done again. ccache-swig is ccache plus support for SWIG. ccache and ccache-swig are used interchangeably in this document. manpagesection(OPTIONS SUMMARY) Here is a summary of the options to ccache-swig. verb( -s show statistics summary -z zero statistics -c run a cache cleanup -C clear the cache completely -F set maximum files in cache -M set maximum size of cache (use G, M or K) -h this help page -V print version number ) manpageoptions() These options only apply when you invoke ccache as "ccache-swig". When invoked as a compiler none of these options apply. In that case your normal compiler options apply and you should refer to your compilers documentation. startdit() dit(bf(-h)) Print a options summary page dit(bf(-s)) Print the current statistics summary for the cache. The statistics are stored spread across the subdirectories of the cache. Using "ccache-swig -s" adds up the statistics across all subdirectories and prints the totals. dit(bf(-z)) Zero the cache statistics. dit(bf(-V)) Print the ccache version number dit(bf(-c)) Clean the cache and re-calculate the cache file count and size totals. Normally the -c option should not be necessary as ccache keeps the cache below the specified limits at runtime and keeps statistics up to date on each compile. This option is mostly useful if you manually modify the cache contents or believe that the cache size statistics may be inaccurate. dit(bf(-C)) Clear the entire cache, removing all cached files. dit(bf(-F )) This sets the maximum number of files allowed in the cache. The value is stored inside the cache directory and applies to all future compiles. Due to the way the value is stored the actual value used is always rounded down to the nearest multiple of 16. dit(bf(-M )) This sets the maximum cache size. You can specify a value in gigabytes, megabytes or kilobytes by appending a G, M or K to the value. The default is gigabytes. The actual value stored is rounded down to the nearest multiple of 16 kilobytes. enddit() manpagesection(INSTALLATION) There are two ways to use ccache. You can either prefix your compile commands with "ccache-swig" or you can create a symbolic link between ccache-swig and the names of your compilers. The first method is most convenient if you just want to try out ccache or wish to use it for some specific projects. The second method is most useful for when you wish to use ccache for all your compiles. To install for usage by the first method just copy ccache-swig to somewhere in your path. To install for the second method do something like this: verb( cp ccache-swig /usr/local/bin/ ln -s /usr/local/bin/ccache-swig /usr/local/bin/gcc ln -s /usr/local/bin/ccache-swig /usr/local/bin/g++ ln -s /usr/local/bin/ccache-swig /usr/local/bin/cc ln -s /usr/local/bin/ccache-swig /usr/local/bin/swig ) This will work as long as /usr/local/bin comes before the path to gcc (which is usually in /usr/bin). After installing you may wish to run "which gcc" to make sure that the correct link is being used. Note! Do not use a hard link, use a symbolic link. A hardlink will cause "interesting" problems. manpagesection(EXTRA OPTIONS) When run as a compiler front end ccache usually just takes the same command line options as the compiler you are using. The only exception to this is the option '--ccache-skip'. That option can be used to tell ccache that the next option is definitely not a input filename, and should be passed along to the compiler as-is. The reason this can be important is that ccache does need to parse the command line and determine what is an input filename and what is a compiler option, as it needs the input filename to determine the name of the resulting object file (among other things). The heuristic ccache uses in this parse is that any string on the command line that exists as a file is treated as an input file name (usually a C file). By using --ccache-skip you can force an option to not be treated as an input file name and instead be passed along to the compiler as a command line option. manpagesection(ENVIRONMENT VARIABLES) ccache uses a number of environment variables to control operation. In most cases you won't need any of these as the defaults will be fine. startdit() dit(bf(CCACHE_DIR)) the CCACHE_DIR environment variable specifies where ccache will keep its cached compiler output. The default is "$HOME/.ccache". dit(bf(CCACHE_TEMPDIR)) the CCACHE_TEMPDIR environment variable specifies where ccache will put temporary files. The default is the same as CCACHE_DIR. Note that the CCACHE_TEMPDIR path must be on the same filesystem as the CCACHE_DIR path, so that renames of files between the two directories can work. dit(bf(CCACHE_LOGFILE)) If you set the CCACHE_LOGFILE environment variable then ccache will write some log information on cache hits and misses in that file. This is useful for tracking down problems. dit(bf(CCACHE_VERBOSE)) If you set the CCACHE_VERBOSE environment variable then ccache will display on stdout all the compiler invocations that it makes. This can useful for debugging unexpected problems. dit(bf(CCACHE_PATH)) You can optionally set CCACHE_PATH to a colon separated path where ccache will look for the real compilers. If you don't do this then ccache will look for the first executable matching the compiler name in the normal PATH that isn't a symbolic link to ccache itself. dit(bf(CCACHE_CC)) You can optionally set CCACHE_CC to force the name of the compiler to use. If you don't do this then ccache works it out from the command line. dit(bf(CCACHE_PREFIX)) This option adds a prefix to the command line that ccache runs when invoking the compiler. Also see the section below on using ccache with distcc. dit(bf(CCACHE_DISABLE)) If you set the environment variable CCACHE_DISABLE then ccache will just call the real compiler, bypassing the cache completely. dit(bf(CCACHE_READONLY)) the CCACHE_READONLY environment variable tells ccache to attempt to use existing cached object files, but not to try to add anything new to the cache. If you are using this because your CCACHE_DIR is read-only, then you may find that you also need to set CCACHE_TEMPDIR as otherwise ccache will fail to create the temporary files. dit(bf(CCACHE_CPP2)) If you set the environment variable CCACHE_CPP2 then ccache will not use the optimisation of avoiding the 2nd call to the pre-processor by compiling the pre-processed output that was used for finding the hash in the case of a cache miss. This is primarily a debugging option, although it is possible that some unusual compilers will have problems with the intermediate filename extensions used in this optimisation, in which case this option could allow ccache to be used. dit(bf(CCACHE_NOCOMPRESS)) If you set the environment variable CCACHE_NOCOMPRESS then there is no compression used on files that go into the cache. However, this setting has no effect on how files are retrieved from the cache, compressed results will still be usable. dit(bf(CCACHE_NOSTATS)) If you set the environment variable CCACHE_NOSTATS then ccache will not update the statistics files on each compile. dit(bf(CCACHE_NLEVELS)) The environment variable CCACHE_NLEVELS allows you to choose the number of levels of hash in the cache directory. The default is 2. The minimum is 1 and the maximum is 8. dit(bf(CCACHE_HARDLINK)) If you set the environment variable CCACHE_HARDLINK then ccache will attempt to use hard links from the cache directory when creating the compiler output rather than using a file copy. Using hard links is faster, but can confuse programs like 'make' that rely on modification times. Hard links are never made for compressed cache files. dit(bf(CCACHE_RECACHE)) This forces ccache to not use any cached results, even if it finds them. New results are still cached, but existing cache entries are ignored. dit(bf(CCACHE_UMASK)) This sets the umask for ccache and all child processes (such as the compiler). This is mostly useful when you wish to share your cache with other users. Note that this also affects the file permissions set on the object files created from your compilations. dit(bf(CCACHE_HASHDIR)) This tells ccache to hash the current working directory when calculating the hash that is used to distinguish two compiles. This prevents a problem with the storage of the current working directory in the debug info of a object file, which can lead ccache to give a cached object file that has the working directory in the debug info set incorrectly. This option is off by default as the incorrect setting of this debug info rarely causes problems. If you strike problems with gdb not using the correct directory then enable this option. dit(bf(CCACHE_UNIFY)) If you set the environment variable CCACHE_UNIFY then ccache will use the C/C++ unifier when hashing the pre-processor output if -g is not used in the compile. The unifier is slower than a normal hash, so setting this environment variable loses a little bit of speed, but it means that ccache can take advantage of not recompiling when the changes to the source code consist of reformatting only. Note that using CCACHE_UNIFY changes the hash, so cached compiles with CCACHE_UNIFY set cannot be used when CCACHE_UNIFY is not set and vice versa. The reason the unifier is off by default is that it can give incorrect line number information in compiler warning messages. dit(bf(CCACHE_EXTENSION)) Normally ccache tries to automatically determine the extension to use for intermediate C pre-processor files based on the type of file being compiled. Unfortunately this sometimes doesn't work, for example when using the aCC compiler on HP-UX. On systems like this you can use the CCACHE_EXTENSION option to override the default. On HP-UX set this environment variable to "i" if you use the aCC compiler. dit(bf(CCACHE_STRIPC)) If you set the environment variable CCACHE_STRIPC then ccache will strip the -c option when invoking the preprocessor. This option is primarily for the Sun Workshop C++ compiler as without this option an unwarranted warning is displayed: CC: Warning: "-E" redefines product from "object" to "source (stdout)" when -E and -c is used together. dit(bf(CCACHE_SWIG)) When using SWIG as the compiler and it does not have 'swig' in the executable name, then the CCACHE_SWIG environment variable needs to be set in order for ccache to work correctly with SWIG. The use of CCACHE_CPP2 is also recommended for SWIG due to some preprocessor quirks, however, use of CCACHE_CPP2 can often be skipped -- check your generated code with and without this option set. Known problems are using preprocessor directives within %inline blocks and the use of '#pragma SWIG'. enddit() manpagesection(CACHE SIZE MANAGEMENT) By default ccache has a one gigabyte limit on the cache size and no maximum number of files. You can set a different limit using the "ccache -M" and "ccache -F" options, which set the size and number of files limits. When these limits are reached ccache will reduce the cache to 20% below the numbers you specified in order to avoid doing the cache clean operation too often. manpagesection(CACHE COMPRESSION) By default on most platforms ccache will compress all files it puts into the cache using the zlib compression. While this involves a negligible performance slowdown, it significantly increases the number of files that fit in the cache. You can turn off compression setting the CCACHE_NOCOMPRESS environment variable. manpagesection(HOW IT WORKS) The basic idea is to detect when you are compiling exactly the same code a 2nd time and use the previously compiled output. You detect that it is the same code by forming a hash of: itemization( it() the pre-processor output from running the compiler with -E it() the command line options it() the real compilers size and modification time it() any stderr output generated by the compiler ) These are hashed using md4 (a strong hash) and a cache file is formed based on that hash result. When the same compilation is done a second time ccache is able to supply the correct compiler output (including all warnings etc) from the cache. ccache has been carefully written to always produce exactly the same compiler output that you would get without the cache. If you ever discover a case where ccache changes the output of your compiler then please let me know. manpagesection(USING CCACHE WITH DISTCC) distcc is a very useful program for distributing compilation across a range of compiler servers. It is often useful to combine distcc with ccache, so that compiles that are done are sped up by distcc, but that ccache avoids the compile completely where possible. To use distcc with ccache I recommend using the CCACHE_PREFIX option. You just need to set the environment variable CCACHE_PREFIX to 'distcc' and ccache will prefix the command line used with the compiler with the command 'distcc'. manpagesection(SHARING A CACHE) A group of developers can increase the cache hit rate by sharing a cache directory. The hard links however cause unwanted side effects, as all links to a cached file share the file's modification timestamp. This results in false dependencies to be triggered by timestamp-based build systems whenever another user links to an existing file. Typically, users will see that their libraries and binaries are relinked without reason. To share a cache without side effects, the following conditions need to be met: itemization( it() Use the same bf(CCACHE_DIR) environment variable setting it() Unset the bf(CCACHE_HARDLINK) environment variable it() Make sure everyone sets the CCACHE_UMASK environment variable to 002, this ensures that cached files are accessible to everyone in the group. it() Make sure that all users have write permission in the entire cache directory (and that you trust all users of the shared cache). it() Make sure that the setgid bit is set on all directories in the cache. This tells the filesystem to inherit group ownership for new directories. The command "chmod g+s `find $CCACHE_DIR -type d`" might be useful for this. it() Set bf(CCACHE_NOCOMPRESS) for all users, if there are users with versions of ccache that do not support compression. ) manpagesection(HISTORY) ccache was inspired by the compilercache shell script script written by Erik Thiele and I would like to thank him for an excellent piece of work. See url(http://www.erikyyy.de/compilercache/)(http://www.erikyyy.de/compilercache/) for the Erik's scripts. ccache-swig is a port of the original ccache with support added for use with SWIG. I wrote ccache because I wanted to get a bit more speed out of a compiler cache and I wanted to remove some of the limitations of the shell-script version. manpagesection(DIFFERENCES FROM COMPILERCACHE) The biggest differences between Erik's compilercache script and ccache are: itemization( it() ccache is written in C, which makes it a bit faster (calling out to external programs is mostly what slowed down the scripts). it() ccache can automatically find the real compiler it() ccache keeps statistics on hits/misses it() ccache can do automatic cache management it() ccache can cache compiler output that includes warnings. In many cases this gives ccache a much higher cache hit rate. it() ccache can handle a much wider ranger of compiler options it() ccache avoids a double call to cpp on a cache miss ) manpagesection(CREDITS) Thanks to the following people for their contributions to ccache itemization( it() Erik Thiele for the original compilercache script it() Luciano Rocha for the idea of compiling the pre-processor output to avoid a 2nd cpp pass it() Paul Russell for many suggestions and the debian packaging ) manpageauthor() ccache was written by Andrew Tridgell url(http://samba.org/~tridge/)(http://samba.org/~tridge/). ccache was adapted to create ccache-swig for use with SWIG by William Fulton. If you wish to report a problem or make a suggestion then please email the SWIG developers on the swig-devel mailing list, see url(https://www.swig.org/mail.html)(https://www.swig.org/mail.html) ccache is released under the GNU General Public License version 2 or later. Please see the file COPYING for license details. whenhtml(htmlcommand( )) swig-4.4.1/CCache/ccache_swig_config.h.in000066400000000000000000000000511511462406000201340ustar00rootroot00000000000000#define SWIG_VERSION "@PACKAGE_VERSION@" swig-4.4.1/CCache/cleanup.c000066400000000000000000000120511511462406000153700ustar00rootroot00000000000000/* Copyright (C) Andrew Tridgell 2002 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* functions to cleanup the cache directory when it gets too large */ #include "ccache.h" static struct files { char *fname; time_t mtime; size_t size; } **files; static unsigned allocated; static unsigned num_files; static size_t total_size; static size_t total_files; static size_t size_threshold; static size_t files_threshold; /* file comparison function to try to delete the oldest files first */ static int files_compare(struct files **f1, struct files **f2) { if ((*f2)->mtime == (*f1)->mtime) { return strcmp((*f2)->fname, (*f1)->fname); } if ((*f2)->mtime > (*f1)->mtime) { return -1; } return 1; } /* this builds the list of files in the cache */ static void traverse_fn(const char *fname, struct stat *st) { char *p; if (!S_ISREG(st->st_mode)) return; p = str_basename(fname); if (strcmp(p, "stats") == 0) { free(p); return; } free(p); if (num_files == allocated) { allocated = 10000 + num_files*2; files = (struct files **)x_realloc(files, sizeof(struct files *)*allocated); } files[num_files] = (struct files *)x_malloc(sizeof(struct files)); files[num_files]->fname = x_strdup(fname); files[num_files]->mtime = st->st_mtime; files[num_files]->size = file_size(st) / 1024; total_size += files[num_files]->size; num_files++; } /* sort the files we've found and delete the oldest ones until we are below the thresholds */ static void sort_and_clean(size_t minfiles) { unsigned i; size_t adjusted_minfiles = minfiles; if (num_files > 1) { /* sort in ascending data order */ qsort(files, num_files, sizeof(struct files *), (COMPAR_FN_T)files_compare); } /* ensure newly cached files (minfiles) are kept - instead of matching the filenames of those newly cached, a faster and simpler approach assumes these are the most recent in the cache and if any other cached files have an identical time stamp, they will also be kept - this approach would not be needed if the cleanup was done at exit. */ if (minfiles != 0 && minfiles < num_files) { unsigned minfiles_index = num_files - minfiles; time_t minfiles_time = files[minfiles_index]->mtime; for (i=1; i<=minfiles_index; i++) { if (files[minfiles_index-i]->mtime == minfiles_time) adjusted_minfiles++; else break; } } /* delete enough files to bring us below the threshold */ for (i=0;ifname) != 0 && errno != ENOENT) { fprintf(stderr, "unlink %s - %s\n", files[i]->fname, strerror(errno)); continue; } total_size -= files[i]->size; } total_files = num_files - i; } /* cleanup in one cache subdir */ void cleanup_dir(const char *dir, size_t maxfiles, size_t maxsize, size_t minfiles) { unsigned i; size_threshold = maxsize * LIMIT_MULTIPLE; files_threshold = maxfiles * LIMIT_MULTIPLE; num_files = 0; total_size = 0; /* build a list of files */ traverse(dir, traverse_fn); /* clean the cache */ sort_and_clean(minfiles); stats_set_sizes(dir, total_files, total_size); /* free it up */ for (i=0;ifname); free(files[i]); files[i] = NULL; } if (files) free(files); allocated = 0; files = NULL; num_files = 0; total_size = 0; } /* cleanup in all cache subdirs */ void cleanup_all(const char *dir) { unsigned counters[STATS_END]; char *dname, *sfile; int i; for (i=0;i<=0xF;i++) { x_asprintf(&dname, "%s/%1x", dir, i); x_asprintf(&sfile, "%s/%1x/stats", dir, i); memset(counters, 0, sizeof(counters)); stats_read(sfile, counters); cleanup_dir(dname, counters[STATS_MAXFILES], counters[STATS_MAXSIZE], 0); free(dname); free(sfile); } } /* traverse function for wiping files */ static void wipe_fn(const char *fname, struct stat *st) { char *p; if (!S_ISREG(st->st_mode)) return; p = str_basename(fname); if (strcmp(p, "stats") == 0) { free(p); return; } free(p); unlink(fname); } /* wipe all cached files in all subdirs */ void wipe_all(const char *dir) { char *dname; int i; for (i=0;i<=0xF;i++) { x_asprintf(&dname, "%s/%1x", dir, i); traverse(dir, wipe_fn); free(dname); } /* and fix the counters */ cleanup_all(dir); } swig-4.4.1/CCache/config_win32.h.in000066400000000000000000000001141511462406000166370ustar00rootroot00000000000000#if !defined(PROGRAM_NAME) #define PROGRAM_NAME "@PROGRAM_NAME@.exe" #endif swig-4.4.1/CCache/configure.ac000066400000000000000000000056231511462406000160720ustar00rootroot00000000000000dnl Process this file with autoconf to produce a configure script. AC_INIT([ccache-swig],[0.0]) # Get version from SWIG in ccache_swig_config.h.in AC_PREREQ([2.60]) AC_CONFIG_SRCDIR([ccache.h]) AC_MSG_NOTICE([Configuring ccache]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([config_win32.h]) dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_ARG_PROGRAM # for program_transform_name AC_SUBST(PROGRAM_NAME) if test "x$program_prefix" != "xNONE" -a "x$program_prefix" != "x" then PROGRAM_NAME="$program_prefix$PACKAGE_NAME" else PROGRAM_NAME="$PACKAGE_NAME" fi if test "x$program_suffix" != "xNONE" -a "x$program_suffix" != "x" then PROGRAM_NAME="$PROGRAM_NAME$program_suffix" fi AC_DEFINE_UNQUOTED(PROGRAM_NAME, "$PROGRAM_NAME", [Define my program name]) AC_DEFINE([_GNU_SOURCE], 1, [Define _GNU_SOURCE so that we get all necessary prototypes]) # If GCC, turn on warnings. if test "x$GCC" = "xyes" then CFLAGS="$CFLAGS -Wall -W" else CFLAGS="$CFLAGS -O" fi AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h sys/time.h) AC_CHECK_FUNCS(realpath snprintf vsnprintf vasprintf asprintf mkstemp) AC_CHECK_FUNCS(gethostname getpwuid) AC_CHECK_FUNCS(utimes) AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); } ]])],[ccache_cv_COMPAR_FN_T=yes],[ccache_cv_COMPAR_FN_T=no])]) if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then AC_DEFINE(HAVE_COMPAR_FN_T, 1, [ ]) fi dnl Note: This could be replaced by AC_FUNC_SNPRINTF() in the autoconf macro archive AC_CACHE_CHECK([for C99 vsnprintf],ccache_cv_HAVE_C99_VSNPRINTF,[ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include #include #include void foo(const char *format, ...) { va_list ap; int len; char buf[5]; va_start(ap, format); len = vsnprintf(0, 0, format, ap); va_end(ap); if (len != 5) exit(1); if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); exit(0); } int main(void) { foo("hello"); } ]])],[ccache_cv_HAVE_C99_VSNPRINTF=yes],[ccache_cv_HAVE_C99_VSNPRINTF=no],[ccache_cv_HAVE_C99_VSNPRINTF=cross])]) if test x"$ccache_cv_HAVE_C99_VSNPRINTF" = x"yes"; then AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ]) fi dnl Check for zlib. dnl Note: This could be replaced by CHECK_ZLIB() in the autoconf macro archive AC_ARG_ENABLE([zlib], AS_HELP_STRING([--enable-zlib], [enable zlib support for ccache compression]),, [enable_zlib=yes]) if test x"$enable_zlib" = x"yes"; then AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, gzdopen, [LIBS="-lz $LIBS" AC_DEFINE([ENABLE_ZLIB], 1, [Define to 1 if you would like to have zlib compression for ccache.]) ] )) fi AC_CONFIG_FILES([Makefile]) AC_OUTPUT swig-4.4.1/CCache/debian/000077500000000000000000000000001511462406000150205ustar00rootroot00000000000000swig-4.4.1/CCache/debian/NEWS000066400000000000000000000016421511462406000155220ustar00rootroot00000000000000ccache (2.4-8) unstable; urgency=high zlib compression is now enabled by default in order to increase the amount of object files that can fit in the cache. The impact on performance is supposed to be almost negligible (see http://www.gustaebel.de/lars/ccache/). If you do want to disable it however, simply export the CCACHE_NOCOMPRESS environment variable. Note that a zlib-enabled ccache will still read your existing uncompressed cache. If you want to compress/uncompress your cache, see the manage-cache.sh script under /usr/share/doc/ccache/examples/. -- Francois Marier Sun, 20 May 2007 19:45:07 +1200 ccache (2.4-1) unstable; urgency=low * This release changes the hash input slighly, so you will probably find that you will not get any hits against your existing cache when you upgrade. -- Francois Marier Sat, 11 Jun 2005 13:54:33 -0400 swig-4.4.1/CCache/debian/README.Debian000066400000000000000000000040101511462406000170540ustar00rootroot00000000000000Installing ccache ----------------- The recommended way to use this with Debian is to either create "cc" and "gcc" symlinks to /usr/bin/ccache in your private bin directory (which must be before the real cc and gcc in your path), or use CC="ccache gcc" on the make command line. Another option is to just prepend /usr/lib/ccache in your PATH environment variable, like export PATH="/usr/lib/ccache:$PATH" Note that ccache works with both native and cross compilers. Ignoring whitespace ------------------- If you wish to set up ccache so that it ignores blank lines, have a look at the CCACHE_UNIFY option. However, please note that this option is off by default since the reported line numbers may not match the source files anymore. NFS Issues ---------- (from John Coiner on the ccache mailing list) When CCache creates a hardlinked output file, it calls utime() to update the timestamp on the object, so that Make realizes that the object has changed. On NFS, utime() has no coherency guarantee, AFAIK. When utime() runs on host A, and our parallel implementation of Make is running on host B, sometimes Make doesn't see the new timestamp soon enough -- and neglects to relink the final binary. That's a one-way ticket to Silent Mysterious Failure Town. Instead of relying on the object file timestamp, we create a dummy file with a reliable timestamp: objs/foo.o objs/foo.o.built : if ( ccache gcc -o foo.o -c foo.c ) ; \ then touch objs/foo.o.built ; \ else exit 1; \ fi binary : objs/foo.o.built gcc -o binary objs/foo.o NFS does make a coherency guarantee, that if a file is written and close()d on host A, and subsequently open()ed on host B, that the second open() will reflect all modifications and attributes from the close(). Since Make does open() when checking timestamps, and the dummy file is close()d when it's created, the binary will always relink after the object is recompiled. -- Francois Marier Sun, 20 May 2007 17:35:36 +1200 swig-4.4.1/CCache/debian/changelog000066400000000000000000000163771511462406000167100ustar00rootroot00000000000000ccache (2.4-15) unstable; urgency=low * Add a new patch which improve the consistency of timestamps on cached objects to make sure clean-up is based on least recently used objects. * Patch the set_limit call so that non-writable cache directories return an error when attempting to size the max(files|size) (closes: #332527) -- Francois Marier Sun, 13 Apr 2008 15:07:05 +1200 ccache (2.4-14) unstable; urgency=low * Mention the long options everywhere in the manpage * Merge Gentoo patches: - respect user's LDFLAGS - use utimes() for timestamp if possible -- Francois Marier Sun, 23 Mar 2008 16:30:11 +1300 ccache (2.4-13) unstable; urgency=low * Update CACHEDIR.TAG patch to avoid creating the tag file when the CCACHE_READONLY environment variable is set. (closes: #464356) * Mention the GNU-style long options in the manpage -- Francois Marier Thu, 07 Feb 2008 10:50:42 +1300 ccache (2.4-12) unstable; urgency=low * Add symlink for gcc 4.3 (closes: #463590) * Add support for the CACHEDIR.TAG spec, thanks to Karl Chen. (see http://www.brynosaurus.com/cachedir/) * Fix hyphens in manpage (lintian notice) * Bump Standards-Version up to 3.7.3 (no changes) * Bump debhelper compatibility to 6 -- Francois Marier Sat, 02 Feb 2008 10:37:22 +1300 ccache (2.4-11) unstable; urgency=low * Add the collab-maint repo to debian/control -- Francois Marier Tue, 20 Nov 2007 15:26:37 +1300 ccache (2.4-10) unstable; urgency=low * Document where the patches are from in debian/patches/CREDITS * debian/rules: - Fixed "make distclean" lintian warning - Removed commented-out entries * Set debhelper compatibility to 5 * Add homepage field in debian/control * Add symlinks for MinGW (closes: #445782) * Bump the version to 5 in the debhelper dependency -- Francois Marier Fri, 19 Oct 2007 16:04:37 +1300 ccache (2.4-9) unstable; urgency=low * Add a symlink for gcc 4.2 (closes: #431007) * Fix dependencies when using -o (closes: #217713) -- Francois Marier Sat, 30 Jun 2007 17:58:44 +1200 ccache (2.4-8) unstable; urgency=low * Enable zlib compression of the cache by default (closes: #409848). Thanks to Sami Liedes for suggesting this. * Disable ccache when profiling (closes: #215849). Thanks to Ted Percival for the Patch. * Fix NFS renaming issues and add instructions to the README. Thanks to John Coiner and instructions. * Put all patches in debian/patches and apply them at build time. -- Francois Marier Sun, 20 May 2007 19:42:34 +1200 ccache (2.4-7) unstable; urgency=low * Use the real compiler when HOME is not set (closes: #396350) * Include user script under doc/examples (closes: #392435) Thanks to Behan Webster! * Add support for GNU --long options (closes: #297126) -- Francois Marier Sat, 18 Nov 2006 00:50:59 -0500 ccache (2.4-6) unstable; urgency=low * Include symlinks for gcc 4.1 (closes: #372838) * Update watch file -- Francois Marier Tue, 13 Jun 2006 22:17:37 -0400 ccache (2.4-5) unstable; urgency=low * Document the fact that cross-compiling is supported (closes: #349221) * Bump Standards-Version up to 3.7.2 (no changes) -- Francois Marier Sun, 4 Jun 2006 01:20:07 -0400 ccache (2.4-4) unstable; urgency=low * Mention another way to use ccache in README.Debian (thanks to Benjamin Drieu for the suggestion) (closes: #267632) * Update FSF address * Fix watch file -- Francois Marier Sat, 26 Nov 2005 00:15:13 -0500 ccache (2.4-3) unstable; urgency=low * Actually use the configuration flags in debian/rules * Bump Standards-Version up to 3.6.2 (no changes) -- Francois Marier Sun, 26 Jun 2005 13:33:19 -0400 ccache (2.4-2) unstable; urgency=low * Add gcc and g++ symlinks to /usr/lib/ccache (closes: #313490) * Remove invalid entry from Depends -- Francois Marier Wed, 15 Jun 2005 20:51:03 -0400 ccache (2.4-1) unstable; urgency=low * New maintainer (closes: #312867) * New upstream version: (closes: #273753, #239640) - New CCACHE_READONLY and CCACHE_TEMPDIR options - Fixed handling of hard-linked compilers on AIX - Fixed handling of HOME environment variable (closes: #299880) - Show cache directory in stats output * Fix copyright file * Add 'distcc' to Suggests (closes: #269158) * Add a note about whitespace in README.Debian (closes: #229116) * Update rules to add symmlinks for gcc 3.4 & 4.0 (closes: #261177) * Acknowledge NMUs (closes: #200185, #177129, #174417) -- Francois Marier Sun, 12 Jun 2005 12:05:34 -0400 ccache (2.3-1.1) unstable; urgency=low * Non-maintainer upload during BSP * Re-apply patch for #200185 ccache: Incorrect symlinks in /usr/lib/ccache (Closes: #200185) -- Frank Lichtenheld Fri, 19 Mar 2004 11:14:50 +0100 ccache (2.3-1) unstable; urgency=low * New upstream release: obsoletes existing caches. * Tweak package description in arbitrary way (closes: #181721) -- Paul Russell Mon, 29 Sep 2003 02:53:20 +0200 ccache (2.2-2) unstable; urgency=low * Insert more symlinks in ccache dir (closes: #197468) -- Paul Russell Mon, 16 Jun 2003 10:52:50 +0100 ccache (2.2-1) unstable; urgency=low * New upstream release (closes: #150755) * Insert more symlinks in ccache dir (closes: #144462) -- Paul Russell Mon, 17 Feb 2003 07:19:36 +0100 ccache (2.1.1-2) unstable; urgency=low * Restored /usr/lib/ccache symlinks (closes: #179393) * Fixed manpage typo (closes: #179564) * With thanks to Andreas Rottmann. -- Paul Russell Wed, 5 Feb 2003 10:01:10 +0100 ccache (2.1.1-1) unstable; urgency=low * NMU (with maintainer consent). * New upstream release (closes: #174417, #177129). * debian/control: + Build-Depend on and use dephelper 4 (DH_COMPAT = 4). + Bumped Standards-Version to 3.5.8. + No full stop on short package description (fixes linda warning). * debian/copright: + Make lintian feel comfortable; fixes warnings: - copyright-should-refer-to-common-license-file-for-gpl - copyright-lists-upstream-authors-with-dh_make-boilerplate * Built with g++ 3.2 :-). -- Andreas Rottmann Thu, 16 Jan 2003 11:42:38 +0100 ccache (1.9-1) unstable; urgency=low * New upstream release (closes: #144920) -- Paul Russell Mon, 13 May 2002 10:01:09 +0200 ccache (1.8-1) unstable; urgency=low * New upstream release (closes: #145401) -- Paul Russell Fri, 3 May 2002 02:26:32 +0200 ccache (1.7-1) unstable; urgency=low * New upstream release * Install symlinks in /usr/lib/ccache (closes: #141337) -- Paul Russell Wed, 10 Apr 2002 17:51:21 +0200 ccache (1.4-1) unstable; urgency=low * New upstream release -- Paul Russell Wed, 3 Apr 2002 03:41:46 +0200 ccache (1.2-1) unstable; urgency=low * Initial Release. -- Paul Russell Sun, 31 Mar 2002 14:08:57 +0200 swig-4.4.1/CCache/debian/compat000066400000000000000000000000021511462406000162160ustar00rootroot000000000000006 swig-4.4.1/CCache/debian/control000066400000000000000000000013161511462406000164240ustar00rootroot00000000000000Source: ccache Section: devel Priority: optional Maintainer: Francois Marier Build-Depends: debhelper (>> 6), autotools-dev, zlib1g-dev Standards-Version: 3.7.3 Homepage: http://ccache.samba.org Vcs-Svn: svn://svn.debian.org/svn/collab-maint/deb-maint/ccache/ Vcs-Browser: http://svn.debian.org/wsvn/collab-maint/deb-maint/ccache/ Package: ccache Architecture: any Depends: ${shlibs:Depends} Suggests: distcc Description: Compiler results cacher, for fast recompiles ccache is a compiler cache. It speeds up re-compilation of C/C++ code by caching previous compiles and detecting when the same compile is being done again. . This is similar to, but faster than, the compilercache package. swig-4.4.1/CCache/debian/copyright000066400000000000000000000024061511462406000167550ustar00rootroot00000000000000This package was debianized by Paul Russell on Sun, 31 Mar 2002 14:08:57 +0200. It was downloaded from http://ccache.samba.org/ftp/ccache/ The ccache-zlib patch was downloaded from http://www.gustaebel.de/lars/ccache/ Upstream Author: Andrew Tridgell Copyright: 2002-2005 Andrew Tridgell This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA You are free to distribute this software under the terms of the GNU General Public License. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL file. swig-4.4.1/CCache/debian/dirs000066400000000000000000000000521511462406000157010ustar00rootroot00000000000000usr/bin usr/lib/ccache usr/share/man/man1 swig-4.4.1/CCache/debian/docs000066400000000000000000000000071511462406000156700ustar00rootroot00000000000000README swig-4.4.1/CCache/debian/examples000066400000000000000000000000451511462406000165600ustar00rootroot00000000000000debian/update-ccache manage-cache.sh swig-4.4.1/CCache/debian/patches/000077500000000000000000000000001511462406000164475ustar00rootroot00000000000000swig-4.4.1/CCache/debian/patches/01_no_home.diff000066400000000000000000000041421511462406000212260ustar00rootroot00000000000000--- ccache.c +++ ccache.c @@ -836,6 +836,13 @@ { /* find the real compiler */ find_compiler(argc, argv); + + /* use the real compiler if HOME is not set */ + if (!cache_dir) { + cc_log("Unable to determine home directory\n"); + cc_log("ccache is disabled\n"); + failed(); + } /* we might be disabled */ if (getenv("CCACHE_DISABLE")) { @@ -895,6 +902,13 @@ printf("-V print version number\n"); } +static void check_cache_dir(void) +{ + if (!cache_dir) { + fatal("Unable to determine home directory"); + } +} + /* the main program when not doing a compile */ static int ccache_main(int argc, char *argv[]) { @@ -914,31 +928,37 @@ exit(0); case 's': + check_cache_dir(); stats_summary(); break; case 'c': + check_cache_dir(); cleanup_all(cache_dir); printf("Cleaned cache\n"); break; case 'C': + check_cache_dir(); wipe_all(cache_dir); printf("Cleared cache\n"); break; case 'z': + check_cache_dir(); stats_zero(); printf("Statistics cleared\n"); break; case 'F': + check_cache_dir(); v = atoi(optarg); stats_set_limits(v, -1); printf("Set cache file limit to %u\n", (unsigned)v); break; case 'M': + check_cache_dir(); v = value_units(optarg); stats_set_limits(-1, v); printf("Set cache size limit to %uk\n", (unsigned)v); @@ -983,7 +1003,10 @@ cache_dir = getenv("CCACHE_DIR"); if (!cache_dir) { - x_asprintf(&cache_dir, "%s/.ccache", get_home_directory()); + const char *home_directory = get_home_directory(); + if (home_directory) { + x_asprintf(&cache_dir, "%s/.ccache", home_directory); + } } temp_dir = getenv("CCACHE_TEMPDIR"); @@ -1023,7 +1046,7 @@ } /* make sure the cache dir exists */ - if (create_dir(cache_dir) != 0) { + if (cache_dir && (create_dir(cache_dir) != 0)) { fprintf(stderr,"ccache: failed to create %s (%s)\n", cache_dir, strerror(errno)); exit(1); --- util.c +++ util.c @@ -448,7 +448,7 @@ } } #endif - fatal("Unable to determine home directory"); + cc_log("Unable to determine home directory"); return NULL; } swig-4.4.1/CCache/debian/patches/02_ccache-compressed.diff000066400000000000000000000737711511462406000231710ustar00rootroot00000000000000Index: ccache.1 =================================================================== RCS file: /home/cvsroot/lars/ccache/ccache.1,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.6 diff -u -r1.1.1.1.2.1 -r1.6 --- ccache.1 21 Nov 2004 17:55:36 -0000 1.1.1.1.2.1 +++ ccache.1 21 Nov 2004 18:19:28 -0000 1.6 @@ -210,7 +210,8 @@ CCACHE_HARDLINK then ccache will attempt to use hard links from the cache directory when creating the compiler output rather than using a file copy\&. Using hard links is faster, but can confuse programs like -\&'make\&' that rely on modification times\&. +\&'make\&' that rely on modification times\&. Hard links are never made for +compressed cache files\&. .IP .IP "\fBCCACHE_RECACHE\fP" This forces ccache to not use any cached @@ -257,6 +258,11 @@ the default\&. On HP-UX set this environment variable to "i" if you use the aCC compiler\&. .IP +.IP "\fBCCACHE_NOCOMPRESS\fP" +If you set the environment variable +CCACHE_NOCOMPRESS then there is no compression used on files that go +into the cache\&. +.IP .PP .SH "CACHE SIZE MANAGEMENT" .PP @@ -269,6 +275,14 @@ below the numbers you specified in order to avoid doing the cache clean operation too often\&. .PP +.SH "CACHE COMPRESSION" +.PP +By default ccache will compress all files it puts into the cache +using the zlib compression\&. While this involves a negligible +performance slowdown, it significantly increases the number of files +that fit in the cache\&. You can turn off compression setting the +CCACHE_NOCOMPRESS environment variable\&. +.PP .SH "HOW IT WORKS" .PP The basic idea is to detect when you are compiling exactly the same Index: ccache.c =================================================================== RCS file: /home/cvsroot/lars/ccache/ccache.c,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.9 diff -u -r1.1.1.1.2.1 -r1.9 --- ccache.c 21 Nov 2004 17:55:36 -0000 1.1.1.1.2.1 +++ ccache.c 21 Nov 2004 18:19:28 -0000 1.9 @@ -199,7 +199,7 @@ fd = open(tmp_stderr, O_RDONLY | O_BINARY); if (fd != -1) { if (strcmp(output_file, "/dev/null") == 0 || - rename(tmp_hashname, output_file) == 0 || errno == ENOENT) { + move_file(tmp_hashname, output_file) == 0 || errno == ENOENT) { if (cpp_stderr) { /* we might have some stderr from cpp */ int fd2 = open(cpp_stderr, O_RDONLY | O_BINARY); @@ -231,14 +231,25 @@ x_asprintf(&path_stderr, "%s.stderr", hashname); if (stat(tmp_stderr, &st1) != 0 || - stat(tmp_hashname, &st2) != 0 || - rename(tmp_hashname, hashname) != 0 || - rename(tmp_stderr, path_stderr) != 0) { + stat(tmp_hashname, &st2) != 0 || + move_file(tmp_hashname, hashname) != 0 || + move_file(tmp_stderr, path_stderr) != 0) { cc_log("failed to rename tmp files - %s\n", strerror(errno)); stats_update(STATS_ERROR); failed(); } +#if ENABLE_ZLIB + /* do an extra stat on the cache files for + the size statistics */ + if (stat(path_stderr, &st1) != 0 || + stat(hashname, &st2) != 0) { + cc_log("failed to stat cache files - %s\n", strerror(errno)); + stats_update(STATS_ERROR); + failed(); + } +#endif + cc_log("Placed %s into cache\n", output_file); stats_tocache(file_size(&st1) + file_size(&st2)); @@ -474,7 +485,13 @@ } /* the user might be disabling cache hits */ +#ifndef ENABLE_ZLIB + /* if the cache file is compressed we must recache */ + if ((first && getenv("CCACHE_RECACHE")) || + test_if_compressed(hashname) == 1) { +#else if (first && getenv("CCACHE_RECACHE")) { +#endif close(fd_stderr); unlink(stderr_file); free(stderr_file); @@ -487,7 +504,9 @@ ret = 0; } else { unlink(output_file); - if (getenv("CCACHE_HARDLINK")) { + /* only make a hardlink if the cache file is uncompressed */ + if (getenv("CCACHE_HARDLINK") && + test_if_compressed(hashname) == 0) { ret = link(hashname, output_file); } else { ret = copy_file(hashname, output_file); Index: ccache.h =================================================================== RCS file: /home/cvsroot/lars/ccache/ccache.h,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.7 diff -u -r1.1.1.1.2.1 -r1.7 --- ccache.h 21 Nov 2004 17:55:36 -0000 1.1.1.1.2.1 +++ ccache.h 21 Nov 2004 18:19:28 -0000 1.7 @@ -23,6 +23,10 @@ #include #endif +#ifdef ENABLE_ZLIB +#include +#endif + #define STATUS_NOTFOUND 3 #define STATUS_FATAL 4 #define STATUS_NOCACHE 5 @@ -36,6 +40,13 @@ #define DEFAULT_MAXSIZE (1000*1000) #endif +/* file copy mode */ +#ifdef ENABLE_ZLIB +#define COPY_UNCOMPRESSED 0 +#define COPY_FROM_CACHE 1 +#define COPY_TO_CACHE 2 +#endif + enum stats { STATS_NONE=0, STATS_STDOUT, @@ -79,6 +90,8 @@ void copy_fd(int fd_in, int fd_out); int copy_file(const char *src, const char *dest); +int move_file(const char *src, const char *dest); +int test_if_compressed(const char *filename); int create_dir(const char *dir); void x_asprintf(char **ptr, const char *format, ...); Index: ccache.yo =================================================================== RCS file: /home/cvsroot/lars/ccache/ccache.yo,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.5 diff -u -r1.1.1.1.2.1 -r1.5 --- ccache.yo 21 Nov 2004 17:55:36 -0000 1.1.1.1.2.1 +++ ccache.yo 21 Nov 2004 18:19:28 -0000 1.5 @@ -169,6 +169,11 @@ this optimisation, in which case this option could allow ccache to be used. +dit(bf(CCACHE_NOCOMPRESS)) If you set the environment variable +CCACHE_NOCOMPRESS then there is no compression used on files that go +into the cache. However, this setting has no effect on how files are +retrieved from the cache, compressed results will still be usable. + dit(bf(CCACHE_NOSTATS)) If you set the environment variable CCACHE_NOSTATS then ccache will not update the statistics files on each compile. @@ -181,7 +186,8 @@ CCACHE_HARDLINK then ccache will attempt to use hard links from the cache directory when creating the compiler output rather than using a file copy. Using hard links is faster, but can confuse programs like -'make' that rely on modification times. +'make' that rely on modification times. Hard links are never made for +compressed cache files. dit(bf(CCACHE_RECACHE)) This forces ccache to not use any cached results, even if it finds them. New results are still cached, but @@ -236,6 +242,14 @@ below the numbers you specified in order to avoid doing the cache clean operation too often. +manpagesection(CACHE COMPRESSION) + +By default ccache will compress all files it puts into the cache +using the zlib compression. While this involves a negligible +performance slowdown, it significantly increases the number of files +that fit in the cache. You can turn off compression setting the +CCACHE_NOCOMPRESS environment variable. + manpagesection(HOW IT WORKS) The basic idea is to detect when you are compiling exactly the same @@ -294,6 +308,8 @@ cache. This tells the filesystem to inherit group ownership for new directories. The command "chmod g+s `find $CCACHE_DIR -type d`" might be useful for this. + it() Set bf(CCACHE_NOCOMPRESS) for all users, if there are users with + versions of ccache that do not support compression. ) manpagesection(HISTORY) Index: config.h.in =================================================================== RCS file: /home/cvsroot/lars/ccache/config.h.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- config.h.in 30 Apr 2004 13:13:41 -0000 1.1.1.1 +++ config.h.in 4 May 2004 20:49:26 -0000 1.2 @@ -98,3 +98,6 @@ /* Define _GNU_SOURCE so that we get all necessary prototypes */ #undef _GNU_SOURCE + +/* Define to 1 if you like to have zlib compression for the ccache. */ +#undef ENABLE_ZLIB Index: configure =================================================================== RCS file: /home/cvsroot/lars/ccache/configure,v retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1.2.1 configure --- configure 21 Nov 2004 17:55:36 -0000 1.1.1.1.2.1 +++ configure 21 Nov 2004 18:24:42 -0000 @@ -836,6 +836,11 @@ cat <<\_ACEOF +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-zlib enable zlib support for ccache compression + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -936,7 +941,7 @@ else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi - cd "$ac_popdir" + cd $ac_popdir done fi @@ -1859,7 +1864,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1917,7 +1923,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2033,7 +2040,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2087,7 +2095,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2132,7 +2141,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2176,7 +2186,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2609,7 +2620,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2681,7 +2693,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2735,7 +2748,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2806,7 +2820,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2860,7 +2875,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2927,7 +2943,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2997,7 +3014,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3078,7 +3096,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3248,7 +3267,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3319,7 +3339,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3509,7 +3530,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3611,7 +3633,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3676,7 +3699,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3775,6 +3799,229 @@ fi +# Check whether --enable-zlib or --disable-zlib was given. +if test "${enable_zlib+set}" = set; then + enableval="$enable_zlib" + +else + enable_zlib=yes +fi; + +if test x"$enable_zlib" = x"yes"; then + if test "${ac_cv_header_zlib_h+set}" = set; then + echo "$as_me:$LINENO: checking for zlib.h" >&5 +echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_zlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking zlib.h usability" >&5 +echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking zlib.h presence" >&5 +echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for zlib.h" >&5 +echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_zlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_zlib_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 + +fi +if test $ac_cv_header_zlib_h = yes; then + echo "$as_me:$LINENO: checking for gzdopen in -lz" >&5 +echo $ECHO_N "checking for gzdopen in -lz... $ECHO_C" >&6 +if test "${ac_cv_lib_z_gzdopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gzdopen (); +int +main () +{ +gzdopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_z_gzdopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_z_gzdopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzdopen" >&5 +echo "${ECHO_T}$ac_cv_lib_z_gzdopen" >&6 +if test $ac_cv_lib_z_gzdopen = yes; then + LIBS="-lz $LIBS"; cat >>confdefs.h <<\_ACEOF +#define ENABLE_ZLIB 1 +_ACEOF + +fi + +fi + + +fi + ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -4568,6 +4815,11 @@ *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ @@ -4606,12 +4858,6 @@ fi;; esac done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub Index: configure.in =================================================================== RCS file: /home/cvsroot/lars/ccache/configure.in,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.4 diff -u -r1.1.1.1.2.1 -r1.4 --- configure.in 21 Nov 2004 17:55:36 -0000 1.1.1.1.2.1 +++ configure.in 21 Nov 2004 18:19:28 -0000 1.4 @@ -68,5 +68,14 @@ AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ]) fi +dnl Check for zlib. +AC_ARG_ENABLE([zlib], + AS_HELP_STRING([--enable-zlib], [enable zlib support for ccache compression]),, + [enable_zlib=yes]) + +if test x"$enable_zlib" = x"yes"; then + AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, gzdopen, LIBS="-lz $LIBS"; AC_DEFINE(ENABLE_ZLIB))) +fi + AC_CONFIG_FILES([Makefile]) AC_OUTPUT Index: util.c =================================================================== RCS file: /home/cvsroot/lars/ccache/util.c,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.11 diff -u -r1.1.1.1.2.1 -r1.11 --- util.c 21 Nov 2004 17:55:36 -0000 1.1.1.1.2.1 +++ util.c 21 Nov 2004 18:19:28 -0000 1.11 @@ -44,6 +44,7 @@ exit(1); } +#ifndef ENABLE_ZLIB /* copy all data from one file descriptor to another */ void copy_fd(int fd_in, int fd_out) { @@ -57,6 +58,11 @@ } } +/* move a file using rename */ +int move_file(const char *src, const char *dest) { + return rename(src, dest); +} + /* copy a file - used when hard links don't work the copy is done via a temporary file and atomic rename */ @@ -120,6 +126,174 @@ return 0; } +#else /* ENABLE_ZLIB */ + +/* copy all data from one file descriptor to another + possibly decompressing it +*/ +void copy_fd(int fd_in, int fd_out) { + char buf[10240]; + int n; + gzFile gz_in; + + gz_in = gzdopen(dup(fd_in), "rb"); + + if (!gz_in) { + fatal("Failed to copy fd"); + } + + while ((n = gzread(gz_in, buf, sizeof(buf))) > 0) { + if (write(fd_out, buf, n) != n) { + fatal("Failed to copy fd"); + } + } +} + +static int _copy_file(const char *src, const char *dest, int mode) { + int fd_in, fd_out; + gzFile gz_in, gz_out = NULL; + char buf[10240]; + int n, ret; + char *tmp_name; + mode_t mask; + struct stat st; + + x_asprintf(&tmp_name, "%s.XXXXXX", dest); + + if (getenv("CCACHE_NOCOMPRESS")) { + mode = COPY_UNCOMPRESSED; + } + + /* open source file */ + fd_in = open(src, O_RDONLY); + if (fd_in == -1) { + return -1; + } + + gz_in = gzdopen(fd_in, "rb"); + if (!gz_in) { + close(fd_in); + return -1; + } + + /* open destination file */ + fd_out = mkstemp(tmp_name); + if (fd_out == -1) { + gzclose(gz_in); + free(tmp_name); + return -1; + } + + if (mode == COPY_TO_CACHE) { + /* The gzip file format occupies at least 20 bytes. So + it will always occupy an entire filesystem block, + even for empty files. + Since most stderr files will be empty, we turn off + compression in this case to save space. + */ + if (fstat(fd_in, &st) != 0) { + gzclose(gz_in); + close(fd_out); + free(tmp_name); + return -1; + } + if (file_size(&st) == 0) { + mode = COPY_UNCOMPRESSED; + } + } + + if (mode == COPY_TO_CACHE) { + gz_out = gzdopen(dup(fd_out), "wb"); + if (!gz_out) { + gzclose(gz_in); + close(fd_out); + free(tmp_name); + return -1; + } + } + + while ((n = gzread(gz_in, buf, sizeof(buf))) > 0) { + if (mode == COPY_TO_CACHE) { + ret = gzwrite(gz_out, buf, n); + } else { + ret = write(fd_out, buf, n); + } + if (ret != n) { + gzclose(gz_in); + if (gz_out) { + gzclose(gz_out); + } + close(fd_out); + unlink(tmp_name); + free(tmp_name); + return -1; + } + } + + gzclose(gz_in); + if (gz_out) { + gzclose(gz_out); + } + + /* get perms right on the tmp file */ + mask = umask(0); + fchmod(fd_out, 0666 & ~mask); + umask(mask); + + /* the close can fail on NFS if out of space */ + if (close(fd_out) == -1) { + unlink(tmp_name); + free(tmp_name); + return -1; + } + + unlink(dest); + + if (rename(tmp_name, dest) == -1) { + unlink(tmp_name); + free(tmp_name); + return -1; + } + + free(tmp_name); + + return 0; +} + +/* move a file to the cache, compressing it */ +int move_file(const char *src, const char *dest) { + int ret; + + ret = _copy_file(src, dest, COPY_TO_CACHE); + if (ret != -1) unlink(src); + return ret; +} + +/* copy a file from the cache, decompressing it */ +int copy_file(const char *src, const char *dest) { + return _copy_file(src, dest, COPY_FROM_CACHE); +} +#endif /* ENABLE_ZLIB */ + +/* test if a file is zlib compressed */ +int test_if_compressed(const char *filename) { + FILE *f; + + f = fopen(filename, "rb"); + if (!f) { + return 0; + } + + /* test if file starts with 1F8B, which is zlib's + * magic number */ + if ((fgetc(f) != 0x1f) || (fgetc(f) != 0x8b)) { + fclose(f); + return 0; + } + + fclose(f); + return 1; +} /* make sure a directory exists */ int create_dir(const char *dir) Index: manage-cache.sh =================================================================== RCS file: manage-cache.sh diff -N manage-cache.sh --- manage-cache.sh 1 Jan 1970 00:00:00 -0000 +++ manage-cache.sh-cache.sh 12 May 2004 19:22:20 -0000 1.1 @@ -0,0 +1,68 @@ +#!/bin/bash +# +# 2004-05-12 lars@gustaebel.de + +CCACHE_DIR=${CCACHE_DIR:-$HOME/.ccache} + +echo "Do you want to compress or decompress the ccache in $CCACHE_DIR?" +read -p "Type c or d: " mode + +if [ "$mode" != "c" ] && [ "$mode" != "d" ] +then + exit 1 +fi + +is_compressed() { + test "$(head -c 2 $1)" = $'\x1f\x8b' + return $? +} + +tmpfile=$(mktemp) + +for dir in 0 1 2 3 4 5 6 7 8 9 a b c d e f +do + # process ccache subdir + echo -n "$dir " + + # find cache files + find $CCACHE_DIR/$dir -type f -name '*-*' | + sort > $tmpfile + + oldsize=$(cat $CCACHE_DIR/$dir/stats | cut -d ' ' -f 13) + newsize=0 + + while read file + do + # empty files will be ignored since compressing + # them makes them bigger + test $(stat -c %s $file) -eq 0 && continue + + if [ $mode = c ] + then + if ! is_compressed $file + then + gzip $file + mv $file.gz $file + fi + else + if is_compressed $file + then + mv $file $file.gz + gzip -d $file.gz + fi + fi + + # calculate new size statistic for this subdir + let newsize=$newsize+$(stat -c "%B*%b" $file)/1024 + done < $tmpfile + + # update statistic file + read -a numbers < $CCACHE_DIR/$dir/stats + numbers[12]=$newsize + echo "${numbers[*]} " > $CCACHE_DIR/$dir/stats +done +echo + +# clean up +rm $tmpfile + Index: Makefile.in =================================================================== RCS file: /home/cvsroot/lars/ccache/Makefile.in,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.12 diff -u -r1.1.1.1.2.1 -r1.12 --- Makefile.in 21 Nov 2004 17:55:36 -0000 1.1.1.1.2.1 +++ Makefile.in 21 Nov 2004 18:19:28 -0000 1.12 @@ -11,6 +11,7 @@ CFLAGS=@CFLAGS@ -I. EXEEXT=@EXEEXT@ +LIBS= @LIBS@ OBJS= ccache.o mdfour.o hash.o execute.o util.o args.o stats.o \ cleanup.o snprintf.o unify.o HEADERS = ccache.h mdfour.h @@ -20,7 +21,7 @@ docs: ccache.1 web/ccache-man.html ccache$(EXEEXT): $(OBJS) $(HEADERS) - $(CC) $(CFLAGS) -o $@ $(OBJS) + $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) ccache.1: ccache.yo -yodl2man -o ccache.1 ccache.yo swig-4.4.1/CCache/debian/patches/03_long_options.diff000066400000000000000000000115041511462406000223160ustar00rootroot00000000000000Index: ccache.c =================================================================== --- ccache.c (révision 7695) +++ ccache.c (copie de travail) @@ -22,6 +22,7 @@ */ #include "ccache.h" +#include /* the base cache directory */ char *cache_dir = NULL; @@ -885,14 +886,14 @@ printf("\tcompiler [compile options] (via symbolic link)\n"); printf("\nOptions:\n"); - printf("-s show statistics summary\n"); - printf("-z zero statistics\n"); - printf("-c run a cache cleanup\n"); - printf("-C clear the cache completely\n"); - printf("-F set maximum files in cache\n"); - printf("-M set maximum size of cache (use G, M or K)\n"); - printf("-h this help page\n"); - printf("-V print version number\n"); + printf("-s, --show-stats show statistics summary\n"); + printf("-z, --zero-stats zero statistics\n"); + printf("-c, --cleanup run a cache cleanup\n"); + printf("-C, --clear clear the cache completely\n"); + printf("-F , --max-files= set maximum files in cache\n"); + printf("-M , --max-size= set maximum size of cache (use G, M or K)\n"); + printf("-h, --help this help page\n"); + printf("-V, --version print version number\n"); } /* the main program when not doing a compile */ @@ -901,7 +902,21 @@ int c; size_t v; - while ((c = getopt(argc, argv, "hszcCF:M:V")) != -1) { + static struct option long_options[] = + { + {"show-stats", no_argument, 0, 's'}, + {"zero-stats", no_argument, 0, 'z'}, + {"cleanup", no_argument, 0, 'c'}, + {"clear", no_argument, 0, 'C'}, + {"max-files", required_argument, 0, 'F'}, + {"max-size", required_argument, 0, 'M'}, + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'V'}, + {0, 0, 0, 0} + }; + int option_index = 0; + + while ((c = getopt_long(argc, argv, "hszcCF:M:V", long_options, &option_index)) != -1) { switch (c) { case 'V': printf("ccache version %s\n", CCACHE_VERSION); Index: ccache.1 =================================================================== --- ccache.1 (révision 7695) +++ ccache.1 (copie de travail) @@ -23,14 +23,14 @@ .nf --s show statistics summary --z zero statistics --c run a cache cleanup --C clear the cache completely --F set maximum files in cache --M set maximum size of cache (use G, M or K) --h this help page --V print version number +\-s, \-\-show-stats show statistics summary +\-z, \-\-zero-stats zero statistics +\-c, \-\-cleanup run a cache cleanup +\-C, \-\-clear clear the cache completely +\-F , \-\-max-files= set maximum files in cache +\-M , \-\-max-size= set maximum size of cache (use G, M or K) +\-h, \-\-help this help page +\-V, \-\-version print version number .fi @@ -43,22 +43,22 @@ normal compiler options apply and you should refer to your compilers documentation\&. .PP -.IP "\fB-h\fP" +.IP "\fB-h, --help\fP" Print a options summary page .IP -.IP "\fB-s\fP" +.IP "\fB-s, --show-stats\fP" Print the current statistics summary for the cache\&. The statistics are stored spread across the subdirectories of the cache\&. Using "ccache -s" adds up the statistics across all subdirectories and prints the totals\&. .IP -.IP "\fB-z\fP" +.IP "\fB-z, --zero-stats\fP" Zero the cache statistics\&. .IP -.IP "\fB-V\fP" +.IP "\fB-V, --version\fP" Print the ccache version number .IP -.IP "\fB-c\fP" +.IP "\fB-c, --cleanup\fP" Clean the cache and re-calculate the cache file count and size totals\&. Normally the -c option should not be necessary as ccache keeps the cache below the specified limits at runtime and keeps @@ -66,16 +66,16 @@ if you manually modify the cache contents or believe that the cache size statistics may be inaccurate\&. .IP -.IP "\fB-C\fP" +.IP "\fB-C, --clear\fP" Clear the entire cache, removing all cached files\&. .IP -.IP "\fB-F maxfiles\fP" +.IP "\fB-F , --max-files=\fP" This sets the maximum number of files allowed in the cache\&. The value is stored inside the cache directory and applies to all future compiles\&. Due to the way the value is stored the actual value used is always rounded down to the nearest multiple of 16\&. .IP -.IP "\fB-M maxsize\fP" +.IP "\fB-M , --max-size=\fP" This sets the maximum cache size\&. You can specify a value in gigabytes, megabytes or kilobytes by appending a G, M or K to the value\&. The default is gigabytes\&. The actual value stored is swig-4.4.1/CCache/debian/patches/04_ignore_profile.diff000066400000000000000000000007771511462406000226220ustar00rootroot00000000000000diff -ru ccache-2.4/ccache.c ccache-2.4-tp/ccache.c --- ccache.c 2007-05-20 03:14:19.000000000 +1000 +++ ccache.c 2007-05-20 03:17:54.000000000 +1000 @@ -641,6 +641,9 @@ /* these are too hard */ if (strcmp(argv[i], "-fbranch-probabilities")==0 || + strcmp(argv[i], "-fprofile-arcs") == 0 || + strcmp(argv[i], "-ftest-coverage") == 0 || + strcmp(argv[i], "--coverage") == 0 || strcmp(argv[i], "-M") == 0 || strcmp(argv[i], "-MM") == 0 || strcmp(argv[i], "-x") == 0) { swig-4.4.1/CCache/debian/patches/05_nfs_fix.diff000066400000000000000000000023071511462406000212430ustar00rootroot00000000000000--- ccache.1.orig 2007-05-20 17:30:57.000000000 +1200 +++ ccache.1 2007-05-20 17:31:27.000000000 +1200 @@ -367,12 +367,6 @@ .IP o ccache avoids a double call to cpp on a cache miss .PP -.SH "BUGS" -.PP -When the cache is stored on an NFS filesystem, the filesystem must be -exported with the \fBno_subtree_check\fP option to make renames between -directories reliable\&. -.PP .SH "CREDITS" .PP Thanks to the following people for their contributions to ccache --- util.c.patched 2007-05-20 18:19:11.000000000 +1200 +++ util.c 2007-05-20 18:20:55.000000000 +1200 @@ -58,9 +58,26 @@ } } +static int safe_rename(const char* oldpath, const char* newpath) +{ + /* safe_rename is for creating entries in the cache. + + Works like rename(), but it never overwrites an existing + cache entry. This avoids corruption on NFS. */ + int status = link( oldpath, newpath ); + if( status == 0 || errno == EEXIST ) + { + return unlink( oldpath ); + } + else + { + return -1; + } +} + /* move a file using rename */ int move_file(const char *src, const char *dest) { - return rename(src, dest); + return safe_rename(src, dest); } /* copy a file - used when hard links don't work swig-4.4.1/CCache/debian/patches/06_md.diff000066400000000000000000000042251511462406000202110ustar00rootroot00000000000000--- ccache.c Mon Sep 13 11:38:30 2004 +++ ccache.c Thu Jun 21 22:17:32 2007 @@ -627,6 +627,13 @@ static void process_args(int argc, char int found_S_opt = 0; struct stat st; char *e; + /* is gcc being asked to output dependencies? */ + int generating_dependencies = 0; + /* is the dependency makefile name overridden with -MF? */ + int dependency_filename_specified = 0; + /* is the dependency makefile target name specified with -MQ or -MF? */ + int dependency_target_specified = 0; + stripped_args = args_init(0, NULL); @@ -702,6 +709,18 @@ static void process_args(int argc, char continue; } + /* These options require special handling, because they + behave differently with gcc -E, when the output + file is not specified. */ + + if (strcmp(argv[i], "-MD") == 0 || strcmp(argv[i], "-MMD") == 0) { + generating_dependencies = 1; + } else if (strcmp(argv[i], "-MF") == 0) { + dependency_filename_specified = 1; + } else if (strcmp(argv[i], "-MQ") == 0 || strcmp(argv[i], "-MT") == 0) { + dependency_target_specified = 1; + } + /* options that take an argument */ { const char *opts[] = {"-I", "-include", "-imacros", "-iprefix", @@ -812,6 +831,41 @@ static void process_args(int argc, char } p[1] = found_S_opt ? 's' : 'o'; p[2] = 0; + } + + /* If dependencies are generated, configure the preprocessor */ + + if (generating_dependencies && output_file) { + if (!dependency_filename_specified) { + char *default_depfile_name = x_strdup(output_file); + char *p = strrchr(default_depfile_name, '.'); + + if (p) { + if (strlen(p) < 2) { + stats_update(STATS_ARGS); + failed(); + return; + } + *p = 0; + } + else { + int len = p - default_depfile_name; + + p = x_malloc(len + 3); + strncpy(default_depfile_name, p, len - 1); + free(default_depfile_name); + default_depfile_name = p; + } + + strcat(default_depfile_name, ".d"); + args_add(stripped_args, "-MF"); + args_add(stripped_args, default_depfile_name); + } + + if (!dependency_target_specified) { + args_add(stripped_args, "-MT"); + args_add(stripped_args, output_file); + } } /* cope with -o /dev/null */ swig-4.4.1/CCache/debian/patches/07_cachedirtag.diff000066400000000000000000000036101511462406000220450ustar00rootroot00000000000000Index: ccache.c =================================================================== --- ccache.c (révision 7695) +++ ccache.c (copie de travail) @@ -1029,6 +1029,14 @@ exit(1); } + if (!getenv("CCACHE_READONLY")) { + if (create_cachedirtag(cache_dir) != 0) { + fprintf(stderr,"ccache: failed to create %s/CACHEDIR.TAG (%s)\n", + cache_dir, strerror(errno)); + exit(1); + } + } + ccache(argc, argv); return 1; } Index: ccache.h =================================================================== --- ccache.h (révision 7695) +++ ccache.h (copie de travail) @@ -81,6 +81,7 @@ int copy_file(const char *src, const char *dest); int create_dir(const char *dir); +int create_cachedirtag(const char *dir); void x_asprintf(char **ptr, const char *format, ...); char *x_strdup(const char *s); void *x_realloc(void *ptr, size_t size); Index: util.c =================================================================== --- util.c (révision 7695) +++ util.c (copie de travail) @@ -138,6 +138,39 @@ return 0; } +char const CACHEDIR_TAG[] = + "Signature: 8a477f597d28d172789f06886806bc55\n" + "# This file is a cache directory tag created by ccache.\n" + "# For information about cache directory tags, see:\n" + "# http://www.brynosaurus.com/cachedir/\n"; + +int create_cachedirtag(const char *dir) +{ + char *filename; + struct stat st; + FILE *f; + x_asprintf(&filename, "%s/CACHEDIR.TAG", dir); + if (stat(filename, &st) == 0) { + if (S_ISREG(st.st_mode)) { + goto success; + } + errno = EEXIST; + goto error; + } + f = fopen(filename, "w"); + if (!f) goto error; + if (fwrite(CACHEDIR_TAG, sizeof(CACHEDIR_TAG)-1, 1, f) != 1) { + goto error; + } + if (fclose(f)) goto error; +success: + free(filename); + return 0; +error: + free(filename); + return 1; +} + /* this is like asprintf() but dies if the malloc fails note that we use vsnprintf in a rather poor way to make this more portable swig-4.4.1/CCache/debian/patches/08_manpage_hyphens.diff000066400000000000000000000072271511462406000227660ustar00rootroot00000000000000Index: ccache.1 =================================================================== --- ccache.1 (révision 7695) +++ ccache.1 (copie de travail) @@ -49,7 +49,7 @@ .IP "\fB-s\fP" Print the current statistics summary for the cache\&. The statistics are stored spread across the subdirectories of the -cache\&. Using "ccache -s" adds up the statistics across all +cache\&. Using "ccache \-s" adds up the statistics across all subdirectories and prints the totals\&. .IP .IP "\fB-z\fP" @@ -60,7 +60,7 @@ .IP .IP "\fB-c\fP" Clean the cache and re-calculate the cache file count and -size totals\&. Normally the -c option should not be necessary as ccache +size totals\&. Normally the \-c option should not be necessary as ccache keeps the cache below the specified limits at runtime and keeps statistics up to date on each compile\&. This option is mostly useful if you manually modify the cache contents or believe that the cache @@ -100,9 +100,9 @@ cp ccache /usr/local/bin/ - ln -s /usr/local/bin/ccache /usr/local/bin/gcc - ln -s /usr/local/bin/ccache /usr/local/bin/g++ - ln -s /usr/local/bin/ccache /usr/local/bin/cc + ln \-s /usr/local/bin/ccache /usr/local/bin/gcc + ln \-s /usr/local/bin/ccache /usr/local/bin/g++ + ln \-s /usr/local/bin/ccache /usr/local/bin/cc .fi @@ -118,7 +118,7 @@ .PP When run as a compiler front end ccache usually just takes the same command line options as the compiler you are using\&. The only exception -to this is the option \&'--ccache-skip\&'\&. That option can be used to tell +to this is the option \&'\-\-ccache-skip\&'\&. That option can be used to tell ccache that the next option is definitely not a input filename, and should be passed along to the compiler as-is\&. .PP @@ -128,7 +128,7 @@ of the resulting object file (among other things)\&. The heuristic ccache uses in this parse is that any string on the command line that exists as a file is treated as an input file name (usually a C -file)\&. By using --ccache-skip you can force an option to not be +file)\&. By using \-\-ccache-skip you can force an option to not be treated as an input file name and instead be passed along to the compiler as a command line option\&. .PP @@ -238,7 +238,7 @@ .IP "\fBCCACHE_UNIFY\fP" If you set the environment variable CCACHE_UNIFY then ccache will use the C/C++ unifier when hashing the pre-processor -output if -g is not used in the compile\&. The unifier is slower than a +output if \-g is not used in the compile\&. The unifier is slower than a normal hash, so setting this environment variable loses a little bit of speed, but it means that ccache can take advantage of not recompiling when the changes to the source code consist of @@ -262,7 +262,7 @@ .PP By default ccache has a one gigabyte limit on the cache size and no maximum number of files\&. You can set a different limit using the -"ccache -M" and "ccache -F" options, which set the size and number of +"ccache \-M" and "ccache \-F" options, which set the size and number of files limits\&. .PP When these limits are reached ccache will reduce the cache to 20% @@ -276,7 +276,7 @@ that it is the same code by forming a hash of: .PP .IP o -the pre-processor output from running the compiler with -E +the pre-processor output from running the compiler with \-E .IP o the command line options .IP o @@ -331,7 +331,7 @@ .IP o Make sure that the setgid bit is set on all directories in the cache\&. This tells the filesystem to inherit group ownership for new -directories\&. The command "chmod g+s `find $CCACHE_DIR -type d`" might +directories\&. The command "chmod g+s `find $CCACHE_DIR \-type d`" might be useful for this\&. .PP .SH "HISTORY" swig-4.4.1/CCache/debian/patches/09_respect_ldflags.diff000066400000000000000000000005361511462406000227560ustar00rootroot00000000000000--- Makefile.in.orig 2008-03-23 17:01:19.000000000 +1300 +++ Makefile.in 2008-03-23 17:03:03.000000000 +1300 @@ -21,7 +21,7 @@ docs: ccache.1 web/ccache-man.html ccache$(EXEEXT): $(OBJS) $(HEADERS) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) ccache.1: ccache.yo -yodl2man -o ccache.1 ccache.yo swig-4.4.1/CCache/debian/patches/10_lru_cleanup.diff000066400000000000000000000010571511462406000221150ustar00rootroot00000000000000--- ccache.c (révision 8804) +++ ccache.c (copie de travail) @@ -481,6 +481,9 @@ return; } + /* update timestamps for LRU cleanup + also gives output_file a sensible mtime when hard-linking (for make) */ + utime(hashname, NULL); utime(stderr_file, NULL); if (strcmp(output_file, "/dev/null") == 0) { @@ -513,10 +516,6 @@ failed(); } } - if (ret == 0) { - /* update the mtime on the file so that make doesn't get confused */ - utime(output_file, NULL); - } /* get rid of the intermediate preprocessor file */ if (i_tmpfile) { swig-4.4.1/CCache/debian/patches/11_utimes.diff000066400000000000000000000046021511462406000211120ustar00rootroot00000000000000--- ccache.c 2004-09-13 03:38:30.000000000 -0700 +++ ccache.c 2006-06-09 16:29:16.695117780 -0700 @@ -481,8 +481,13 @@ /* update timestamps for LRU cleanup also gives output_file a sensible mtime when hard-linking (for make) */ +#ifdef HAVE_UTIMES + utimes(hashname, NULL); + utimes(stderr_file, NULL); +#else utime(hashname, NULL); utime(stderr_file, NULL); +#endif if (strcmp(output_file, "/dev/null") == 0) { ret = 0; --- ccache.h 2004-09-13 03:38:30.000000000 -0700 +++ ccache.h 2006-06-09 16:28:16.601658626 -0700 @@ -22,6 +22,9 @@ #ifdef HAVE_PWD_H #include #endif +#ifdef HAVE_SYS_TIME_H +#include +#endif #define STATUS_NOTFOUND 3 #define STATUS_FATAL 4 --- config.h.in 2003-09-27 21:48:17.000000000 -0700 +++ config.h.in 2006-06-09 16:25:43.000000000 -0700 @@ -19,6 +19,9 @@ /* Define to 1 if you have the `gethostname' function. */ #undef HAVE_GETHOSTNAME +/* Define to 1 if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@ -31,6 +34,9 @@ /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + /* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH @@ -60,6 +66,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H @@ -69,6 +78,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `utimes' function. */ +#undef HAVE_UTIMES + /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF --- configure.in 2004-09-13 03:38:30.000000000 -0700 +++ configure.in 2006-06-09 16:25:15.541288184 -0700 @@ -27,10 +27,11 @@ AC_HEADER_TIME AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h) +AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h sys/time.h) AC_CHECK_FUNCS(realpath snprintf vsnprintf vasprintf asprintf mkstemp) AC_CHECK_FUNCS(gethostname getpwuid) +AC_CHECK_FUNCS(utimes) AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [ AC_TRY_COMPILE( swig-4.4.1/CCache/debian/patches/12_cachesize_permissions.diff000066400000000000000000000037451511462406000242050ustar00rootroot00000000000000--- stats.c (révision 8804) +++ stats.c (copie de travail) @@ -286,7 +286,7 @@ /* set the per directory limits */ -void stats_set_limits(long maxfiles, long maxsize) +int stats_set_limits(long maxfiles, long maxsize) { int dir; unsigned counters[STATS_END]; @@ -298,7 +298,9 @@ maxsize /= 16; } - create_dir(cache_dir); + if (create_dir(cache_dir) != 0) { + return 1; + } /* set the limits in each directory */ for (dir=0;dir<=0xF;dir++) { @@ -306,7 +308,9 @@ int fd; x_asprintf(&cdir, "%s/%1x", cache_dir, dir); - create_dir(cdir); + if (create_dir(cdir) != 0) { + return 1; + } x_asprintf(&fname, "%s/stats", cdir); free(cdir); @@ -326,6 +330,8 @@ } free(fname); } + + return 0; } /* set the per directory sizes */ --- ccache.c (révision 8804) +++ ccache.c (copie de travail) @@ -935,15 +934,23 @@ case 'F': check_cache_dir(); v = atoi(optarg); - stats_set_limits(v, -1); - printf("Set cache file limit to %u\n", (unsigned)v); + if (stats_set_limits(v, -1) == 0) { + printf("Set cache file limit to %u\n", (unsigned)v); + } else { + printf("Could not set cache file limit.\n"); + exit(1); + } break; case 'M': check_cache_dir(); v = value_units(optarg); - stats_set_limits(-1, v); - printf("Set cache size limit to %uk\n", (unsigned)v); + if (stats_set_limits(-1, v) == 0) { + printf("Set cache size limit to %uk\n", (unsigned)v); + } else { + printf("Could not set cache size limit.\n"); + exit(1); + } break; default: --- ccache.h (révision 8804) +++ ccache.h (copie de travail) @@ -101,7 +101,7 @@ void stats_summary(void); void stats_tocache(size_t size); void stats_read(const char *stats_file, unsigned counters[STATS_END]); -void stats_set_limits(long maxfiles, long maxsize); +int stats_set_limits(long maxfiles, long maxsize); size_t value_units(const char *s); void display_size(unsigned v); void stats_set_sizes(const char *dir, size_t num_files, size_t total_size); swig-4.4.1/CCache/debian/patches/13_html_links.diff000066400000000000000000000022261511462406000217520ustar00rootroot00000000000000--- web/index.html~ 2004-09-13 13:38:30.000000000 +0300 +++ web/index.html 2004-09-26 01:04:38.458008118 +0300 @@ -29,10 +29,10 @@
  • fixed handling of HOME environment variable -See the manual page for details +See the manual page for details on the new options.

    -You can get this release from the download directory +You can get this release from the download directory

    NOTE! This release changes the hash input slighly, so you will probably find that you will not get any hits against your existing @@ -87,7 +87,7 @@

    Documentation

    -See the manual page +See the manual page

    Performance

    @@ -116,7 +116,7 @@

    Download

    You can download the latest release from the download directory.

    +href="http://ccache.samba.org/ftp/ccache/">download directory.

    For the bleeding edge, you can fetch ccache via CVS or rsync. To fetch via cvs use the following command: swig-4.4.1/CCache/debian/patches/14_hardlink_doc.diff000066400000000000000000000036661511462406000222410ustar00rootroot00000000000000Index: ccache.1 =================================================================== RCS file: /cvsroot/ccache/ccache.1,v retrieving revision 1.26 diff -u -r1.26 ccache.1 --- ccache.1 24 Nov 2005 21:10:08 -0000 1.26 +++ ccache.1 21 Jul 2007 21:03:32 -0000 @@ -330,7 +330,7 @@ .IP o Use the same \fBCCACHE_DIR\fP environment variable setting .IP o -Set the \fBCCACHE_NOLINK\fP environment variable +Unset the \fBCCACHE_HARDLINK\fP environment variable .IP o Make sure everyone sets the CCACHE_UMASK environment variable to 002, this ensures that cached files are accessible to everyone in Index: ccache.yo =================================================================== RCS file: /cvsroot/ccache/ccache.yo,v retrieving revision 1.27 diff -u -r1.27 ccache.yo --- ccache.yo 24 Nov 2005 21:54:09 -0000 1.27 +++ ccache.yo 21 Jul 2007 21:03:32 -0000 @@ -289,7 +289,7 @@ itemize( it() Use the same bf(CCACHE_DIR) environment variable setting - it() Set the bf(CCACHE_NOLINK) environment variable + it() Unset the bf(CCACHE_HARDLINK) environment variable it() Make sure everyone sets the CCACHE_UMASK environment variable to 002, this ensures that cached files are accessible to everyone in the group. Index: web/ccache-man.html =================================================================== RCS file: /cvsroot/ccache/web/ccache-man.html,v retrieving revision 1.25 diff -u -r1.25 ccache-man.html --- web/ccache-man.html 13 Sep 2004 10:38:17 -0000 1.25 +++ web/ccache-man.html 21 Jul 2007 21:03:32 -0000 @@ -256,7 +256,7 @@ following conditions need to be met:

    \n" if subsubsection: index += "\n" if subsection: index += "\n" if section == 1: index += "
      \n" index += """
    • %s\n""" % (headingname,prevheadingtext) subsection = 0 subsubsection = 0 subsubsubsection = 0 skipspace = 1 continue m = h3.match(s) if m: prevheadingtext = getheadingtext(m, s) nameindex += 1 subsection += 1 headingname = getheadingname(m) result.append("""

      %d.%d.%d %s

      """ % (headingname,num,section, subsection, prevheadingtext)) if subsubsubsection: index += "
    \n" if subsubsection: index += "\n" if subsection == 1: index += "
      \n" index += """
    • %s\n""" % (headingname,prevheadingtext) subsubsection = 0 skipspace = 1 continue m = h4.match(s) if m: prevheadingtext = getheadingtext(m, s) nameindex += 1 subsubsection += 1 headingname = getheadingname(m) result.append("""

      %d.%d.%d.%d %s

      """ % (headingname,num,section, subsection, subsubsection, prevheadingtext)) if subsubsubsection: index += "
    \n" if subsubsection == 1: index += "
      \n" index += """
    • %s\n""" % (headingname,prevheadingtext) subsubsubsection = 0 skipspace = 1 continue m = h5.match(s) if m: prevheadingtext = getheadingtext(m, s) nameindex += 1 subsubsubsection += 1 headingname = getheadingname(m) result.append("""
      %d.%d.%d.%d.%d %s
      """ % (headingname,num,section, subsection, subsubsection, subsubsubsection, prevheadingtext)) if subsubsubsection == 1: index += "
        \n" index += """
      • %s\n""" % (headingname,prevheadingtext) skipspace = 1 continue result.append(s) if subsubsubsection: index += "
      \n" if subsubsection: index += "
    \n" if subsection: index += "\n" if section: index += "\n" index += "
  • \n\n" data = "\n".join(result) data = data.replace("@INDEX@",index) + "\n"; # Write the file back out open(filename,"w").write(data) # Print the TOC data to stdout correcting the anchor links for external referencing index = index.replace("
  • %d %s\n""" % (filename,filenamebase,num,name)) print(index) swig-4.4.1/Doc/Manual/maketoc.py000066400000000000000000000012521511462406000164070ustar00rootroot00000000000000#!/usr/bin/env python3 import sys import os chs = open("chapters").readlines() f = open("Contents.html","w") f.write(""" SWIG Users Manual

    SWIG Users Manual

    """) f.close() num = 1 for c in chs: c = c.strip() print("Processing " + c) if c: os.system("python3 makechap.py %s %d >> Contents.html" % (c,num)) num += 1 f = open("Contents.html","a") f.write(""" """) swig-4.4.1/Doc/Manual/style.css000066400000000000000000000030221511462406000162610ustar00rootroot00000000000000div.sectiontoc { border-style: dotted; border-width: 2px; padding: 2pt; } h2 { padding: 3px; color: #000000; border-bottom: 2px solid #dddddd; } h3, h4 { margin-left: 1em; } p,li,table,dl { margin-left: 2em; margin-right: 2em; } div.indent { margin-left: 4em; margin-right: 4em; } div.code { border-style: solid; border-width: 1px; padding: 2pt; margin-left: 4em; margin-right: 4em; background-color: #F0FFFF; font-family: "Courier New", Courier, "Courier 10 Pitch", monospace; } div.targetlang { border-style: solid; border-width: 1px; padding: 2pt; margin-left: 4em; margin-right: 4em; background-color: #d7f6bb; font-family: "Courier New", Courier, "Courier 10 Pitch", monospace; } div.shell { border-style: solid; border-width: 1px; padding: 2pt; margin-left: 4em; margin-right: 4em; background-color: #DCDCDC; font-family: "Courier New", Courier, "Courier 10 Pitch", monospace; } div.diagram { border-style: solid; border-width: 1px; padding: 2pt; margin-left: 4em; margin-right: 4em; background-color: #FFEBCD; font-family: "Courier New", Courier, "Courier 10 Pitch", monospace; } div.diagram li { margin-left: 0; } ul li p { margin-left: 0; margin-right: 0; } ol li p { margin-left: 0; margin-right: 0; } dl dd p { margin-left: 0; margin-right: 0; } div.indent p { margin-left: 0; margin-right: 0; } pre, code, tt { font-family: "Courier New", Courier, "Courier 10 Pitch", monospace; } body { font-family: serif; } swig-4.4.1/Doc/Manual/swig16.png000066400000000000000000000126421511462406000162450ustar00rootroot00000000000000‰PNG  IHDR§U’ÌPLTEÿÿÿzzzÊÊÊ555ððð¡¡¡OOOýýýéé鬬¬ZZZßßߘ˜˜CCCfff'''×××½½½ùùù´´´}}}ääännn¿¿¿ÏÏÏ___“““///:::¦¦¦TTTaaaMMM ………ÇÇÇîîîòòòÒÒÒ÷÷÷‹‹‹ÍÍÍÚÚÚ···...áááGGGuuu???$$$æææiii €€€žžžIIIkkk,,,‚‚‚sssÅÅÅ>>>¯¯¯€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿÞêµp]IDATxœb`ÿÿbh ÿÿ$îäS”Ç«ÿÿxwJ °š››s©áUÿÿXwºÉ°˜ssƒ|*ÿÿ8wò)CÜ(**j ‚\üøTÿÿwꈛªqq9‚)ÊÆ\Ž‚øtÿÿ¢»;õÅ•LÌÕÔ  îÊØŸ6ÿÿ¢«;]Ä•åÌÕ€‘ w¢±»1Ì©\¢êx´ÿÿ¢›;%ØØÍÁ¡v˜±(„ºÐÊÝ ¤Jx´ÿÿ¢‹;™äQÍ…ÕîîÆV g‚1HÄÿÿ¢¹;”X€Qí(*Šp#(ü@޹‚Ü!1Çÿÿ¢©;ù ÕÔ žaB*î0— TÅÛ(ÿÿ¢™;xÌÔ`íFÀ`‡!ȵàd ÌC*V`GÅ@Ø·qÿÿ¢‰;]xäÔ¸D‘Ó#r$[1ƒÒ ÂtwgBh^ÂSuÿÿ¢º;uL ÕŒ#"·@CÑ †îVht¢1ÔÅ à6Æm,ÿÿ¢ª;­`\à °!Ñ Žr+˜û€a¨bD*V*HNvwçÕÅi4ÿÿ¢š;ÙLÕŒ‘#œê ±- G ³TÀñîs© PTä jÜm;ÿÿ¢†;µuÁµ5̉0÷‰Â‚PÅ ÌR¹$`I•`9Hpwÿÿ¢Ôâ pä‚"8-BÓ¡$—€\ça0€ãè ..ˆZP&R(€”õš¸ìÿÿ¢ÄœÀêTÃc–c ÉèpðiP\ƒ!0E•t´ô$å¡Ùž’D5Åeÿÿ"×Bl2†æ ªÐ¹š†ghchâc°‚2€nŸ»»Ô A°#a„;¾ ÿÿ"˲&ö úÚÑ”î°\Í) ·Ah3 r¡;84¤’A†ðj ¸KPÿÿ"Õz’ò† 7s9:rÁò,©1@Jd`á‡)$a‚ÃÓblLª@JGè)H (.{ÿÿ"Å"’,‚j`7;:ŠÂÊ =ð(; ’A!q$û€ÄÜÍ €9Ë8K ¸*I0J‚s<¢u×Áa7ÿÿ"ÖbJ, &®°ýì-pÁÚRZ2‚ÝA «0@Â\®iGPp:«2)»š)ÊØ‚r‚¢^Ôʇýÿÿ"Æn’ÀòQÍ Ž ¢0/à!+„+A4¨ ‚²­ âî\ÀÈÖQ²E†¼€¼¡(8Ô¡.ÅS‚ÿÿ"äN7qP@×ó6(0!íqhA+€T .d€E10Ì!å#8傼¡ânÌëºLæÚÊØ\’.­ y ämc-ìîÿÿÂçNiq95¹@Í\p‚ä‚6&¹ ÕÔ °;¬`áu¬»»“¾48¡ë®f/Áè¢ã̪9!Íeh¢eàTÔ»[ÿÿÂáN `UÊÖÀ¸‡ "IÂêF+QD¥ v%4Ü`aê(ÍÈáêîÎ|P«i0ŠÙȃ³ —𽤍h²b°‚ ¸:ÿÿÂâN1pŒiPÒìJ¤^ ¼5 ­{ %’<$!aêÎ¥ÌȨìq%¸TQ\œŒÂ:,@¢üºÂà(60TdEhŽÇQ2ÿÿBs'§“‰ 9¨ëêèq!RÇì>0„µ4 Á ­¡î…9ÖÝ^ƒQRR$ÁDE,¦+Ôg¦³Ò)σýØÛvÿÿBq§¢=¨*H,ƒÉq„gp(Ïñ ·‚ó6(|U¬àÏ`Ï%ÍÈÇ j˜ãEÙ%˜\ܹ°¢’¶]D±—LÿÿBq§¸¢‡$R[Ú¿qGnYBúŒîÐV(êÔøeÔÜa±$Ô€ýqEQ+xáD¢ÀrÉ™Ç XŽ:‰I ó ˜12JÉ¢›Ò¾š½× ÿÿBq§%°l„¦GPXº#"ä,`j3àZhé ÎÎVjÀ΢Œ(,׸ŒY9Õ é¢@@‡ñ8»3ˆÊÛ*òH*Êkeä®0æ±¶íÿÿBq§¨ çBJŒÐ~ ¸«tx÷ÑòºW˜à˜ìᤠƒ¨š'£ RJ:^T‘ÑNÕè Wee~[`$»ñ€ô3À“¨86wÿÿBÍG‚ÈYÛB¸C*ݬPú¢ ŠÜÂr]­õùmiQÅJMTŠÑZÙÝ ^úƒB”Ë…QLÇpŽÀ¬ª,ô¢ç2HÔ›;ÿÿBu§<(ã¸C\mAÂ>v%˜PSTæ‚”ò`eŠŒÚr<à2â0GwqF)`R@þ@µ¢Àf$Ÿ#(¦(3“2´\‚ rLÿÿBu§’(ZÝ íçˆB#YN”­ = wGE ìer¼•£¨ £¶28ZAkyPƒ ñ¶'9*ò12 €8 ˆî¨¨1wÿÿBu§—(<®!ÝYˆû@!¬>lmùÍaÎTÓÖÔò°~¯;—"°XW…5“@ ” è&e{¤âœBÙµ™„íAm5W`p2 ȇÀE$@±µíÿÿBu§ˆ¬^„¦BHÔÀ* ” ^U“5Ð`Ý!`³„ €(¬.µÕõyäQ*+`̳¸°–ƒ«½¹œŒ‘0 pAÛÉàŠgØJPÿÿB« áwÄxPÀœ®„Òhä ¹ðAªj pT¶,í- xè3’»,#0ÏXÁ«SHQot¨£¦$ze¡<¸fÇ>¶¶ÿÿBs§-,ù‰Bú­Ð¢SAÕHJ«‰Bƒ€ ’IêŽÊ<öjŠàðTƒ "@vŽ¢ŠŒBB† @µ£ ?¿"¼½£¸µ§>-1w+s ƒµø•€î”ÕH°’”£q¬,gÍH0àhŽhc*JʃÚ •€+6 ½<ŒÿÿBs§0°_4œáé´]ä¤l#榣#`Ïb ë#¨sª´%æ`m {°‹`ªæ(Á(àꎠ@Äen±OYRÚˆ8Ú¶ÇÒ¶ÿÿBoש¹Ã:=îð¼ Œ>FEnW{9e.p(ƒq s¼ƒ¼9¸i¤ E9pÉr­;ƒ —,Ð-îRžg5gQ–PT–1Qƒ4^ÁePBzÓXÚvÿÿBw'‹(d@iÌ@TÔ‰QBUŒßØ®w4w„” –±(@]Y@úôxelYÀ$+H¯]ÍQ†Q[Æ‘A¥òyCÔÜžE^Ú:µb°‚'´ Ãp'ÿÿBw§-¬Ñna€†1€n6eäöAÀ=8p 4b$Êt¡Ž“$Å(¸ãØÕ Ö‰•¢ŽjÀ°–QCÊîð:‚R .cÅ P̪ÿÿBw§8hF^ÝBÆPEùEBYPÍ\PNNÐ\ €Ô˜ÿmXDXA9ÉYˆÑŽÅ’iáYÛœ•ÑÚž¨0`îà —¯ØK&ÿÿBw§d°œ*Ú\ãZHè˜ê8h0jØ:‚º‡ õÆ…õ\õݸø5¤$ùåx ÙRj\lŒ.r؆[x'Qp¡ˆáNÿÿÂè™Ã zpun0˜K‚d4,À DuÔÀE3ÐjŒÚnвNrfâ|&¦À SVçu+hé,døÔ°ºÍÉVVÐ~ ¤âPEwÿÿÂp§¼(¼ ʆ½=Êœ³¾ — ¤Ã­lž[8é° Hóñ1ê"kU }7ws{sxD?” †¤f+XÔ#ÿÿÂp'lh Ò:gAQW9%f„ a%h‡F X²Š ¸H(šÛ»%ÜÔdDUMzh¯™`hÂFÃÁŽæ>EtgÿÿÂp§$KCÑ ÃDV\ʶr,rr,f¶Ê $ঠi…q™ë0J+ûéüö ÉI5whÿRkªDWèp¤|¦LG5CeI>^tG12ÿÿÂp§&´n‡9rjÊÎLª@`íl ,Œ\¡e¨ƒl ȰhƒÜÉ# M²ÂïFd6¬E,çäl%m„0ÝÿÿÂg0…È€S68c“¢œ­²¢ ??¼#'¿Œ(dvÀÞØÒeÔVSe³Ö¢Ú®¶V (CM¢›ÖÙà²ç·³ÁŽ0ÿÿÂt§h¤ip‹Rþs·#h´ÉžXÉ+«AFŒ]AE-5>ky FF~Aw‡¨ ; 30!¥ž¨£½­³ Žñ/ÿÿÂt§l.RzBªh7Þ‘KMñr¶Àָ̒3gå>E;~~'v5Q$w¸[!» ¹:‚Ž:‚3ò2ªøÂÿÿÂt§˜(,]-]¬ÜYìxÔ@YÑ\ÎD†‘×ÜÖ‘2Ví¨ìo¹2Ù *ûî*XËÌø¶ke‘a³ ìFÿÿÂt§ˆbTS2F`¥¢æÌ˨ok/¯l§Ìð’jüÐñY`Q fí¦(§ìèîh®æŽì4·ÂFšU Ýh59eg1,ÂÿÿÂ2^'( )š¬ }pÁ¬pµ8A=ÿÍíåà£[îŽ\\\ræ —€ëô¼USŒkEURÜÿÿÂâN[x ÎGàqð ,)rÙrA‡ A…(9¸£9 •9ÔÈvå•U¹It#ÿÿÂâNIÈPd&HÒ[TcAÈ 8ÚÊY©@û3Âá+÷ªÀHÐÔš¹<fË’8ÿÿÂâNcH-æÁ5µ¨œœ D–ÙÞÔ×E,D/¿aÖ`'G{[kulDÿÿÂ6î -é¡%(¤Í+*/ï* Ã¤ÌÂ/)`oïÑ@k´|ců ­ÀntæÃ·6‰ÿÿÂæNypƒÜ«V†'Ð=öÀ.¤3“¢œ(¸Ië›ÇÂÈÖà,­©fÔäáDÿÿÂæNeèšÐp,å@[ÕÔ@C³ÐæØ‘î pǪ0ÀJÈà0[KS„ÿÿÂæN&h¹ñƒ¤nm)‚ƒÔ š{ ‹hö«egn"‹p¢ÿÿÂæN .ð°18yA²«¬[*$a4 Pxç[ÔQPX<âœð'ÿÿÂ:$.˜Ü¡}køT%¤Á¦k4ÂF:¡¹ÔXxT)ÉÖ8ÿÿÂêN3wD Ñ>‡7 ?(œ¡…¬¸‰ ,)ÍÖ8ÿÿÂêNEQQX“ ÚÁ¶‚†¬ lü’]À“~  Æï¬JnNÿÿÂêN¤™6+xáÍ/Ðá5wH îÈeï*ƒ«N=ÿÿÂêN#cèX ê«\ Síа…ë*@{7‚ÿÿÂ>k­áa‹=`5=lÔS³ ZñHÿÿÂîN~Èä´1-6­  ÷DAS½®’Üts#ÿÿÂîNEQXï”]À+¸ ó°Ö#'Vm4ÿÿÂîNcØ 2lÙ#$ Y€­pjV3DÿÿÂîN CHÁ›ì,/dev/null RUNPIPE= RUNME = runme IWRAP = $(INTERFACE:.i=_wrap.i) ISRCS = $(IWRAP:.i=.c) ICXXSRCS = $(IWRAP:.i=.cxx) IOBJS = $(IWRAP:.i=.@OBJEXT@) ################################################################## # Some options for silent output ################################################################## ifneq (,$(findstring s, $(filter-out --%, $(MAKEFLAGS)))) # make -s detected SILENT=1 else SILENT= endif ifneq (,$(SILENT)) SILENT_OPTION = -s SILENT_PIPE = >/dev/null ANT_QUIET = -q -logfile /dev/null else SILENT_OPTION = SILENT_PIPE = ANT_QUIET = endif ################################################################## # Dynamic loading for C++ # If you are going to be building dynamic loadable modules in C++, # you may need to edit this line appropriately. # # This line works for g++, but I'm not sure what it might be # for other C++ compilers ################################################################## CPP_DLLIBS = #-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \ -L/usr/local/lib -lg++ -lstdc++ -lgcc # Solaris workshop 5.0 # CPP_DLLIBS = -L/opt/SUNWspro/lib -lCrun # Symbols used for using shared libraries SO= @SO@ LDSHARED= @LDSHARED@ CCSHARED= @CCSHARED@ CXXSHARED= @CXXSHARED@ # This is used for building shared libraries with a number of C++ # compilers. If it doesn't work, comment it out. @TRYLINKINGWITHCXX@ OBJS = $(SRCS:.c=.@OBJEXT@) $(CXXSRCS:.cxx=.@OBJEXT@) distclean: rm -f Makefile ################################################################## # Very generic invocation of swig ################################################################## swiginvoke: $(SWIG) $(SWIGOPT) ################################################################## ##### ANDROID ###### ################################################################## ANDROID = @ANDROID@ ANDROID_NDK_BUILD = @NDKBUILD@ ANDROID_ADB = @ADB@ ANT = @ANT@ TARGETID = 1 # ---------------------------------------------------------------- # Build an Android dynamically loadable module (C) # ---------------------------------------------------------------- android: $(SRCDIR_SRCS) $(ANDROID) $(SILENT_OPTION) update project --target $(TARGETID) --name $(PROJECTNAME) --path . $(SWIG) -java $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH) +$(ANDROID_NDK_BUILD) $(SILENT_PIPE) $(ANT) $(ANT_QUIET) debug # ---------------------------------------------------------------- # Build an Android dynamically loadable module (C++) # ---------------------------------------------------------------- android_cpp: $(SRCDIR_SRCS) $(ANDROID) $(SILENT_OPTION) update project --target $(TARGETID) --name $(PROJECTNAME) --path . $(SWIG) -java -c++ $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.cpp $(INTERFACEPATH) +$(ANDROID_NDK_BUILD) $(SILENT_PIPE) $(ANT) $(ANT_QUIET) debug # ---------------------------------------------------------------- # Android install # ---------------------------------------------------------------- android_install: -$(ANDROID_ADB) uninstall $(PACKAGENAME) $(ANDROID_ADB) install $(INSTALLOPTIONS) bin/$(PROJECTNAME)-debug.apk # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- android_version: $(ANDROID_ADB) version # ----------------------------------------------------------------- # Cleaning the Android examples # ----------------------------------------------------------------- android_clean: test -n "$(SRCDIR)" && cd $(SRCDIR) ; $(ANT) -q -logfile /dev/null clean rm -f $(INTERFACEDIR)$(TARGET)_wrap.* rm -f `find $(PACKAGEDIR) -name \*.java | grep -v $(PROJECTNAME).java` rm -rf obj ################################################################## ##### C ###### ################################################################## # ---------------------------------------------------------------- # Build a C dynamically loadable module # ---------------------------------------------------------------- CLIBPREFIX = lib C_LDSHARED = @C_LDSHARED@ CXX_LDSHARED = @CXX_LDSHARED@ C_SO = @C_SO@ c: $(SRCDIR_SRCS) $(SWIG) -c $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(SRCDIR_INCLUDE) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(COMPILETOOL) $(C_LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(CLIBPREFIX)$(TARGET)$(C_SO) c_cpp: $(SRCDIR_SRCS) $(SWIG) -c++ -c $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(SRCDIR_INCLUDE) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(COMPILETOOL) $(CXX_LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(CLIBPREFIX)$(TARGET)$(C_SO) c_compile_c: $(SRCDIR)$(RUNME).c $(COMPILETOOL) $(CC) $(CPPFLAGS) $(CFLAGS) -o $(RUNME)_$(RUNME_EXT) -I. -I.. $< -L. -l$(TARGET) c_compile_cxx: $(SRCDIR)$(RUNME).cxx $(COMPILETOOL) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(RUNME)_$(RUNME_EXT) -I. -I.. $< -L. -l$(TARGET) $(eval c_compile: c_compile_$(RUNME_EXT)) # This target is used for the unit tests: if we don't have any test code to # run, we at least can check that the generated header can be included without # giving any syntax errors, both when compiling it as C and C++ code. c_syntax_check: c_syntax_check_c c_syntax_check_cxx c_syntax_check_c: $(CC) -fsyntax-only -x c -I$(SRCDIR)$(INTERFACEDIR) $(C_HEADER) c_syntax_check_cxx: $(CXX) -fsyntax-only -x c++ -I$(SRCDIR)$(INTERFACEDIR) $(C_HEADER) # ----------------------------------------------------------------- # Run C example # ----------------------------------------------------------------- c_run: c_compile env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) ./$(RUNME)_$(RUNME_EXT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- c_version: $(CC) --version | head -n 1 # ----------------------------------------------------------------- # Cleaning the C examples # ----------------------------------------------------------------- c_clean: rm -f *_wrap.[ch] *_wrap.cxx rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ rm -f $(RUNME)_c $(RUNME)_cxx ################################################################## ##### CSHARP ###### ################################################################## # Extra CSharp specific dynamic linking options CSHARP_DLNK = @CSHARPDYNAMICLINKING@ CSHARP_LIBPREFIX = @CSHARPLIBRARYPREFIX@ CSHARPCOMPILER = @CSHARPCOMPILER@ CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@ CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@ CSHARPCFLAGS = @CSHARPCFLAGS@ CSHARPFLAGS = CSHARPOPTIONS = CSHARPSO = @CSHARPSO@ CSHARP_RUNME = ./$(RUNME).exe # ---------------------------------------------------------------- # Build a CSharp dynamically loadable module (C) # ---------------------------------------------------------------- csharp: $(SRCDIR_SRCS) $(SWIG) -csharp $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(CSHARPCFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(CSHARP_DLNK) $(LIBS) -o $(CSHARP_LIBPREFIX)$(TARGET)$(CSHARPSO) # ---------------------------------------------------------------- # Build a CSharp dynamically loadable module (C++) # ---------------------------------------------------------------- csharp_cpp: $(SRCDIR_SRCS) $(SWIG) -csharp -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(CSHARPCFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(CSHARP_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(CSHARP_LIBPREFIX)$(TARGET)$(CSHARPSO) # ---------------------------------------------------------------- # Compile CSharp files # ---------------------------------------------------------------- ifneq (,$(SRCDIR)) SRCDIR_CSHARPSRCS = $(addprefix $(SRCDIR),$(CSHARPSRCS)) else SRCDIR_CSHARPSRCS = endif csharp_compile: $(SRCDIR_SRCS) $(COMPILETOOL) $(CSHARPCOMPILER) $(CSHARPFLAGS) $(CSHARPOPTIONS) $(CSHARPSRCS) $(SRCDIR_CSHARPSRCS) # ----------------------------------------------------------------- # Run CSharp example # ----------------------------------------------------------------- csharp_run: env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) $(CSHARP_RUNME) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- # Version check below also works with MS csc.exe which does not understand --version csharp_version: $(CSHARPCOMPILER) --version | head -n 1 if test -n "$(CSHARPCILINTERPRETER)" ; then "$(CSHARPCILINTERPRETER)" --version ; fi # ----------------------------------------------------------------- # Cleaning the CSharp examples # ----------------------------------------------------------------- csharp_clean: rm -f *_wrap* *~ .~* $(RUNME) $(RUNME).exe *.exe.mdb gc.log `find . -name \*.cs | grep -v $(RUNME).cs` rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@CSHARPSO@ ################################################################## ##### D ###### ################################################################## DLIBPREFIX = @DLIBPREFIX@ SWIGD = $(SWIG) -d DCOMPILER = @D2COMPILER@ D_RUNME = ./$(RUNME) # ---------------------------------------------------------------- # Build a dynamically loadable D wrapper for a C module # ---------------------------------------------------------------- d: $(SRCDIR_SRCS) $(SWIGD) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(DCFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(DCFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(DLIBPREFIX)$(TARGET)$(SO) # ---------------------------------------------------------------- # Build a dynamically loadable D wrapper for a C++ module # ---------------------------------------------------------------- d_cpp: $(SRCDIR_SRCS) $(SWIGD) -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(DCFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(DCFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(DLIBPREFIX)$(TARGET)$(SO) # ---------------------------------------------------------------- # Compile D files # ---------------------------------------------------------------- # Clear the DFLAGS environment variable for the compiler call itself # to work around a discrepancy in argument handling between DMD and LDC. d_compile: $(SRCDIR_SRCS) DFLAGS="" $(COMPILETOOL) $(DCOMPILER) $(DFLAGS) $(DSRCS) # ----------------------------------------------------------------- # Run D example # ----------------------------------------------------------------- d_run: env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(D_RUNME) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- d_version: $(DCOMPILER) --version 2> /dev/null | head -n 3 # ----------------------------------------------------------------- # Clean the D examples # ----------------------------------------------------------------- d_clean: rm -f *_wrap* *~ .~* $(RUNME) $(RUNME).exe `find . -name \*.d | grep -v $(RUNME).d` rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ ################################################################## ##### Go ###### ################################################################## GO = @GO@ GOGCC = @GOGCC@ GCCGO = @GCCGO@ GOOPT = @GOOPT@ GCCGOOPT = @GCCGOOPT@ GOVERSIONOPTION = @GOVERSIONOPTION@ ifneq (false, $(GOGCC)) GOSWIGARG = -gccgo GOBUILDARG = -compiler=gccgo else GOSWIGARG = GOBUILDARG = endif GOSRCS = $(INTERFACE:.i=.go) GOCSRCS = $(INTERFACE:.i=_gc.c) GOPACKAGE = $(notdir $(INTERFACE:.i=.a)) GOPATHPARENTDIR = gopath/$(GOMOD)/src GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=) # ---------------------------------------------------------------- # Build a Go module (C) # ---------------------------------------------------------------- $(GOPATHPARENTDIR)/go.mod: @mkdir gopath 2>/dev/null || true @mkdir gopath/$(GOMOD) 2>/dev/null || true @mkdir gopath/$(GOMOD)/src 2>/dev/null || true @mkdir $(GOPATHDIR) 2>/dev/null || true echo "module swigtests" > $(GOPATHDIR)/go.mod echo "" >> $(GOPATHDIR)/go.mod echo "go 1.20" >> $(GOPATHDIR)/go.mod mv -f $(GOPATHDIR)/go.mod $(GOPATHPARENTDIR)/go.mod go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod $(SWIG) -go -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) @mkdir gopath 2>/dev/null || true @mkdir gopath/$(GOMOD) 2>/dev/null || true @mkdir gopath/$(GOMOD)/src 2>/dev/null || true @mkdir $(GOPATHDIR) 2>/dev/null || true rm -rf $(GOPATHDIR)/* cp $(ISRCS) $(GOPATHDIR)/ if test -f $(IWRAP:.i=.h); then \ cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \ fi if test -n "$(SRCDIR_SRCS)"; then \ cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \ fi cp $(GOSRCS) $(GOPATHDIR)/ @if test -f $(SRCDIR)$(RUNME).go; then \ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \ rm -f gopath/$(GOMOD)/src/runme/*; \ fi if test -f $(SRCDIR)$(RUNME).go; then \ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \ fi GOPATH=`pwd`/gopath/$(GOMOD); \ export GOPATH; \ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \ export CGO_CPPFLAGS; \ CGO_CFLAGS="$(CFLAGS)"; \ export CGO_CFLAGS; \ CGO_LDFLAGS="$(LDFLAGS) -lm"; \ export CGO_LDFLAGS; \ (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build $(GOBUILDARG) -o $(GOPACKAGE)); \ stat=$$?; \ if test $$stat != 0; then \ exit $$stat; \ fi; \ if $(GOGCC); then \ cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \ fi; \ if test -f $(SRCDIR)$(RUNME).go; then \ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build $(GOBUILDARG) -o runme $(RUNME).go); \ stat=$$?; \ if test $$stat != 0; then \ exit $$stat; \ fi; \ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \ fi # ---------------------------------------------------------------- # Build a Go module (C++) # ---------------------------------------------------------------- go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod $(SWIG) -go -c++ -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) @mkdir gopath 2>/dev/null || true @mkdir gopath/$(GOMOD) 2>/dev/null || true @mkdir gopath/$(GOMOD)/src 2>/dev/null || true @mkdir $(GOPATHDIR) 2>/dev/null || true rm -rf $(GOPATHDIR)/* cp $(ICXXSRCS) $(GOPATHDIR)/ if test -f $(IWRAP:.i=.h); then \ cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \ fi if test -n "$(SRCDIR_CXXSRCS)"; then \ cp $(SRCDIR_CXXSRCS) $(GOPATHDIR)/; \ fi if test -n "$(SRCDIR_SRCS)"; then \ cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \ fi cp $(GOSRCS) $(GOPATHDIR)/ @if test -f $(SRCDIR)$(RUNME).go; then \ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \ rm -f gopath/$(GOMOD)/src/runme/*; \ fi if test -f $(SRCDIR)$(RUNME).go; then \ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \ fi GOPATH=`pwd`/gopath/$(GOMOD); \ export GOPATH; \ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \ export CGO_CPPFLAGS; \ CGO_CFLAGS="$(CFLAGS)"; \ export CGO_CFLAGS; \ CGO_CXXFLAGS="$(CXXFLAGS)"; \ export CGO_CXXFLAGS; \ CGO_LDFLAGS="$(LDFLAGS) -lm"; \ export CGO_LDFLAGS; \ (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build $(GOBUILDARG) -o $(GOPACKAGE)); \ stat=$$?; \ if test $$stat != 0; then \ exit $$stat; \ fi; \ if $(GOGCC); then \ cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \ fi; \ if test -f $(SRCDIR)$(RUNME).go; then \ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build $(GOBUILDARG) -o runme $(RUNME).go); \ stat=$$?; \ if test $$stat != 0; then \ exit $$stat; \ fi; \ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \ fi # ----------------------------------------------------------------- # Running Go example # ----------------------------------------------------------------- go_run: env $(RUNTOOL) ./$(RUNME) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- go_version: $(GO) $(GOVERSIONOPTION) # ----------------------------------------------------------------- # Cleaning the Go examples # ----------------------------------------------------------------- go_clean: rm -f *_wrap* *_gc* *.gox .~* $(RUNME) $(GOSRCS) rm -rf gopath rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *.[568] *.a *@SO@ ################################################################## ##### GUILE ###### ################################################################## # Make sure these locate your Guile installation GUILE = @GUILE@ GUILE_CFLAGS = @GUILE_CFLAGS@ GUILE_SO = @GUILE_SO@ GUILE_LIBS = @GUILE_LIBS@ GUILE_LIBOPTS = @LIBS@ $(SYSLIBS) GUILE_LIBPREFIX = lib GUILE_SCRIPT = $(SRCDIR)$(RUNME).scm #------------------------------------------------------------------ # Build a dynamically loaded module with passive linkage #------------------------------------------------------------------ guile: $(SRCDIR_SRCS) $(SWIG) -guile -Linkage passive $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO) guile_cpp: $(SRCDIR_SRCS) $(SWIG) -c++ -guile -Linkage passive $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) $(CPP_DLLIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO) guile_externalhdr: $(SWIG) -guile -external-runtime $(TARGET) # ----------------------------------------------------------------- # Build Guile interpreter augmented with extra functions # ----------------------------------------------------------------- guile_augmented: $(SRCDIR_SRCS) $(SWIG) -guile $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) -o $(TARGET) # ----------------------------------------------------------------- # Build statically linked Guile interpreter # ----------------------------------------------------------------- guile_static: $(SRCDIR_SRCS) $(SWIG) -guile -lguilemain.i -Linkage simple $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \ $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) $(GUILE_LIBOPTS) -o $(TARGET)-guile guile_static_cpp: $(SRCDIR_SRCS) $(SWIG) -c++ -guile -lguilemain.i -Linkage simple $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \ $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) $(GUILE_LIBOPTS) -o $(TARGET)-guile # ----------------------------------------------------------------- # Running a Guile example # ----------------------------------------------------------------- guile_run: env GUILE_AUTO_COMPILE=0 $(RUNTOOL) $(GUILE) -l $(GUILE_SCRIPT) $(RUNPIPE) guile_augmented_run: env GUILE_AUTO_COMPILE=0 $(RUNTOOL) ./$(TARGET) $(GUILE_RUNOPTIONS) -s $(GUILE_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- guile_version: $(GUILE) --version | head -n 1 # ----------------------------------------------------------------- # Cleaning the Guile examples # ----------------------------------------------------------------- guile_clean: rm -f *_wrap* *~ .~* my-guile@EXEEXT@ $(TARGET)@EXEEXT@ rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *$(GUILE_SO) ################################################################## ##### JAVA ###### ################################################################## # You need to set this variable to the java directories containing the # files "jni.h" and "md.h" # usually something like /usr/java/include and /usr/java/include/. JAVA_INCLUDE= @JAVAINC@ # Extra Java specific dynamic linking options JAVA_DLNK = @JAVADYNAMICLINKING@ JAVA_LIBPREFIX = @JAVALIBRARYPREFIX@ JAVASO =@JAVASO@ JAVALDSHARED = @JAVALDSHARED@ JAVACXXSHARED = @JAVACXXSHARED@ JAVACFLAGS = @JAVACFLAGS@ JAVAFLAGS = @JAVAFLAGS@ JAVAC_OPTIONS = @JAVAC_OPTIONS@ JAVA = @JAVA@ JAVAC = @JAVAC@ -d . # ---------------------------------------------------------------- # Build a java dynamically loadable module (C) # ---------------------------------------------------------------- java: $(SRCDIR_SRCS) $(SWIG) -java $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(JAVACFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(JAVA_INCLUDE) $(JAVALDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JAVA_DLNK) $(LIBS) -o $(JAVA_LIBPREFIX)$(TARGET)$(JAVASO) # ---------------------------------------------------------------- # Build a java dynamically loadable module (C++) # ---------------------------------------------------------------- java_cpp: $(SRCDIR_SRCS) $(SWIG) -java -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(JAVACFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(JAVA_INCLUDE) $(JAVACXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JAVA_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(JAVA_LIBPREFIX)$(TARGET)$(JAVASO) # ---------------------------------------------------------------- # Compile java files # ---------------------------------------------------------------- java_compile: $(SRCDIR_SRCS) $(COMPILETOOL) $(JAVAC) $(JAVAC_OPTIONS) $(addprefix $(SRCDIR),$(JAVASRCS)) # ----------------------------------------------------------------- # Run java example # ----------------------------------------------------------------- java_run: env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(JAVA) $(JAVAFLAGS) $(RUNME) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- java_version: $(JAVA) -version $(JAVAC) -version || echo "Unknown javac version" # ----------------------------------------------------------------- # Cleaning the java examples # ----------------------------------------------------------------- java_clean: rm -f *_wrap* *~ .~* *.class `find . -name \*.java | grep -v $(RUNME).java` rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@JAVASO@ ################################################################## ##### JAVASCRIPT ###### ################################################################## # Note: These targets are also from within Makefiles in the Example directories. # There is a common makefile, 'Examples/javascript/js_example.mk' to simplify # create a configuration for a new example. ROOT_DIR = @ROOT_DIR@ JSINCLUDES = @JSCOREINC@ @JSV8INC@ JSDYNAMICLINKING = @JSCOREDYNAMICLINKING@ @JSV8DYNAMICLINKING@ NODEJS = @NODEJS@ NODEGYP = @NODEGYP@ ifneq (, $(ENGINE)) JSENGINE=$(ENGINE) else ifneq (, $(NODEJS)) JSENGINE=node else ifneq (, @JSCENABLED@) JSENGINE=jsc else ifneq (, @JSV8ENABLED@) JSENGINE=v8 else # Shouldn't happen, but avoid empty value if it does. JSENGINE=node endif endif endif endif # ---------------------------------------------------------------- # Creating and building Javascript wrappers # ---------------------------------------------------------------- NAPI_DIR = @NODENAPI_DIR@ javascript_wrapper: ifneq (jsc,$(JSENGINE)) $(SWIG) -javascript $(SWIGOPT) -$(JSENGINE) -o $(INTERFACEDIR)$(TARGET)_wrap.cxx $(INTERFACEPATH) else $(SWIG) -javascript $(SWIGOPT) -$(JSENGINE) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH) endif javascript_wrapper_cpp: $(SRCDIR_SRCS) $(SWIG) -javascript -c++ $(SWIGOPT) -$(JSENGINE) -o $(INTERFACEDIR)$(TARGET)_wrap.cxx $(INTERFACEPATH) javascript_build: $(SRCDIR_SRCS) ifeq (node,$(JSENGINE)) sed -e 's|$$srcdir|./$(SRCDIR)|g' $(SRCDIR)binding.gyp.in > binding.gyp MAKEFLAGS= $(NODEGYP) --loglevel=silent configure build 1>>/dev/null else ifeq (napi,$(JSENGINE)) sed -e 's|$$srcdir|./$(SRCDIR)|g' $(SRCDIR)binding.gyp.in > binding.gyp MAKEFLAGS= CXXFLAGS="$(CXXFLAGS) -I$(NAPI_DIR)" $(NODEGYP) --loglevel=silent configure build 1>>/dev/null else ifeq (v8,$(JSENGINE)) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(INCLUDES) $(JSINCLUDES) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) else $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(JSINCLUDES) $(LDSHARED) $(CCSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) endif javascript_build_cpp: $(SRCDIR_SRCS) ifeq ($(JSENGINE), $(filter $(JSENGINE), node napi)) sed -e 's|$$srcdir|./$(SRCDIR)|g' $(SRCDIR)binding.gyp.in > binding.gyp MAKEFLAGS= CXXFLAGS="$(CXXFLAGS) -I$(NAPI_DIR)" $(NODEGYP) --loglevel=silent configure build 1>>/dev/null else $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(JSINCLUDES) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) endif # These targets are used by the test-suite: javascript: $(SRCDIR_SRCS) javascript_custom_interpreter ifeq (v8, $(ENGINE)) $(SWIG) -javascript $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) else $(SWIG) -javascript $(SWIGOPT) $(INTERFACEPATH) endif ifeq (jsc, $(ENGINE)) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(JSINCLUDES) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) else ifeq (v8, $(ENGINE)) # v8 must be compiled as c++ $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(INCLUDES) $(JSINCLUDES) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) else # node and napi must be compiled as c++ $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(JSINCLUDES) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) endif javascript_cpp: $(SRCDIR_SRCS) javascript_custom_interpreter $(SWIG) -javascript -c++ $(SWIGOPT) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(JSINCLUDES) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ----------------------------------------------------------------- # Running a Javascript example # ----------------------------------------------------------------- javascript_custom_interpreter: $(MAKE) -C $(ROOT_DIR)/Tools/javascript JSENGINE='$(JSENGINE)' ifeq ($(JSENGINE), $(filter $(JSENGINE), node napi)) javascript_run: env NODE_PATH=$$PWD:$(SRCDIR) $(RUNTOOL) $(NODEJS) $(SRCDIR)$(RUNME).js $(RUNPIPE) else javascript_run: javascript_custom_interpreter $(RUNTOOL) $(ROOT_DIR)/Tools/javascript/javascript -$(JSENGINE) -L $(TARGET) $(SRCDIR)$(RUNME).js $(RUNPIPE) endif # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- javascript_version: ifeq (, $(ENGINE)) @if [ "$(NODEJS)" != "" ]; then \ echo "Node.js: `($(NODEJS) --version)`"; \ echo "node-gyp: `($(NODEGYP) --version)`"; \ else \ echo "Version depends on the interpreter"; \ fi endif ifeq ($(ENGINE), $(filter $(ENGINE), node napi)) echo "Node.js: `($(NODEJS) --version)`" echo "node-gyp: `($(NODEGYP) --version)`" endif ifeq (jsc, $(ENGINE)) @if [ "@JSCOREVERSION@" != "" ]; then \ echo "JavaScriptCore: @JSCOREVERSION@"; \ else \ echo "Unknown JavaScriptCore version."; \ fi endif ifeq (v8, $(ENGINE)) @printf '%s\n' '#include ' 'SWIGMAGICv8: V8_MAJOR_VERSION.V8_MINOR_VERSION.V8_BUILD_NUMBER.V8_PATCH_LEVEL'|$(CXX) $(JSINCLUDES) -xc++ -E -|sed 's/ \. /./g;s/SWIGMAGIC//p;d' endif # ----------------------------------------------------------------- # Cleaning the Javascript examples # ----------------------------------------------------------------- javascript_clean: rm -rf build rm -f *_wrap* $(RUNME) rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ rm -f binding.gyp example-gypcopy.cxx $(MAKE) -C $(ROOT_DIR)/Tools/javascript -s clean ################################################################## ##### LUA ###### ################################################################## # lua flags LUA_INCLUDE= @LUAFLAGS@ LUA_LIB = @LUALINK@ # Extra specific dynamic linking options LUA_DLNK = @LUADYNAMICLINKING@ LUA_SO = @LUA_SO@ LUA = @LUABIN@ LUA_SCRIPT = $(SRCDIR)$(RUNME).lua # Extra code for lua static link LUA_INTERP = ../lua.c # ---------------------------------------------------------------- # Build a C dynamically loadable module # ---------------------------------------------------------------- lua: $(SRCDIR_SRCS) $(SWIG) -lua $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(LUA_INCLUDE) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) -o $(LIBPREFIX)$(TARGET)$(LUA_SO) # ----------------------------------------------------------------- # Build a C++ dynamically loadable module # ----------------------------------------------------------------- lua_cpp: $(SRCDIR_SRCS) $(GENCXXSRCS) $(SWIG) -c++ -lua $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(GENCXXSRCS) $(INCLUDES) $(LUA_INCLUDE) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(LUA_SO) lua_externalhdr: $(SWIG) -lua -external-runtime $(TARGET) lua_swig_cpp: $(SWIG) -c++ -lua $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) # ----------------------------------------------------------------- # Build statically linked Lua interpreter # ----------------------------------------------------------------- lua_static: $(SRCDIR_SRCS) $(SWIG) -lua -module example $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR)$(LUA_INTERP) $(INCLUDES) \ $(LUA_INCLUDE) $(LIBS) $(LUA_LIB) -o $(TARGET) lua_static_cpp: $(SRCDIR_SRCS) $(GENCXXSRCS) $(SWIG) -c++ -lua -module example $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(GENCXXSRCS) $(SRCDIR)$(LUA_INTERP) $(INCLUDES) \ $(LUA_INCLUDE) $(LIBS) $(LUA_LIB) -o $(TARGET) # ----------------------------------------------------------------- # Run Lua example # ----------------------------------------------------------------- lua_run: $(RUNTOOL) $(LUA) $(LUA_SCRIPT) $(RUNPIPE) lua_embed_run: $(RUNTOOL) ./$(TARGET) $(LUA_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- lua_version: $(LUA) -v | head -n 1 # ----------------------------------------------------------------- # Cleaning the lua examples # ----------------------------------------------------------------- lua_clean: rm -f *_wrap* *~ .~* mylua@EXEEXT@ rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *$(LUA_SO) ################################################################## ##### OCAML ###### ################################################################## OCC=$(COMPILETOOL) @OCAMLC@ OCC_WITH_PP=env TMPDIR=./localtmp $(OCC) # TMPDIR above is a workaround for some ocamlc versions, such as 4.05.0, which always create a temp file of the same name breaking parallel make (seemingly only when -pp is used) OCAMLDLGEN=$(COMPILETOOL) @OCAMLDLGEN@ OCAMLFIND=$(COMPILETOOL) @OCAMLFIND@ OCAMLMKTOP=$(COMPILETOOL) @OCAMLMKTOP@ NOLINK ?= false OCAMLPP= -pp "camlp4o ./swigp4.cmo" OCAMLP4WHERE=`$(COMPILETOOL) @CAMLP4@ -where` ocaml_core: mkdir -p ./localtmp $(SWIG) -ocaml -co swig.mli 2>/dev/null $(SWIG) -ocaml -co swig.ml 2>/dev/null $(SWIG) -ocaml -co swigp4.ml 2>/dev/null $(OCC) -c swig.mli $(OCC) -c swig.ml $(OCC_WITH_PP) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml ocaml_static: $(SRCDIR_SRCS) $(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS) $(OCC) -g -c $(INTERFACE:%.i=%.mli) $(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE) $(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)" ocaml_dynamic: $(SRCDIR_SRCS) $(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS) $(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(CCSHARED) -o $(INTERFACE:%.i=%@SO@) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(LIBS) $(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > $(INTERFACE:%.i=%_dynamic.ml) mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml) rm $(INTERFACE:%.i=%.mli) $(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE) $(NOLINK) || $(OCAMLFIND) $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) ocaml_static_toplevel: $(SRCDIR_SRCS) $(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS) $(OCC) -g -c $(INTERFACE:%.i=%.mli) $(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE) $(NOLINK) || $(OCAMLMKTOP) swig.cmo -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo -cclib "$(LIBS)" -g -ccopt -g -cclib -g -custom -o $(RUNME)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) ocaml_static_cpp: $(SRCDIR_SRCS) $(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c) $(OCC) -cc '$(CXX) $(CPPFLAGS) $(CXXFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(OCC) -g -c $(INTERFACE:%.i=%.mli) $(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE) $(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)" -cc '$(CXX)' ocaml_static_cpp_toplevel: $(SRCDIR_SRCS) $(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c) $(OCC) -cc '$(CXX) $(CPPFLAGS) $(CXXFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(OCC) -g -c $(INTERFACE:%.i=%.mli) $(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE) $(NOLINK) || $(OCAMLMKTOP) -cc '$(CXX) $(CPPFLAGS)' swig.cmo -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo -cclib "$(LIBS)" -g -ccopt -g -cclib -g -custom -o $(RUNME)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) ocaml_dynamic_cpp: $(SRCDIR_SRCS) $(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c) $(OCC) -cc '$(CXX) $(CPPFLAGS) $(CXXFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) -ccopt -fPIC $(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(INTERFACE:%.i=%@SO@) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(CPP_DLLIBS) $(LIBS) $(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > $(INTERFACE:%.i=%_dynamic.ml) mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml) rm $(INTERFACE:%.i=%.mli) $(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE) $(NOLINK) || $(OCAMLFIND) swig.cmo $(OCC) -cclib -export-dynamic -g -ccopt -g -cclib -g -custom -o $(RUNME) -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) -cc '$(CXX)' # ----------------------------------------------------------------- # Run ocaml example # ----------------------------------------------------------------- ocaml_run: $(RUNTOOL) ./$(RUNME) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- ocaml_version: $(OCC) -version # ----------------------------------------------------------------- # Cleaning the Ocaml examples # ----------------------------------------------------------------- ocaml_clean: rm -f *_wrap* *~ .~* *.cmo *.cmi *.mli $(TARGET).ml $(RUNME) $(RUNME)_top swig.ml swigp4.ml rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ rm -rf ./localtmp ################################################################## ##### OCTAVE ###### ################################################################## # Make sure these locate your Octave installation OCTAVE = @OCTAVE@ OCTAVE_CXX = $(DEFS) @OCTAVE_CPPFLAGS@ @OCTAVE_CXXFLAGS@ # Extra Octave specific dynamic linking options OCTAVE_DLNK = @OCTAVE_LDFLAGS@ OCTAVE_SO = @OCTAVE_SO@ OCTAVE_SCRIPT = $(SRCDIR)$(RUNME).m # ---------------------------------------------------------------- # Pre-compile Octave headers, if supported # ---------------------------------------------------------------- ifeq (yes,$(PCHSUPPORT)) octave_precompile_headers: echo "precompiling $(OCTHEADERS)" cp -f $(OCTHEADERSSRC) $(OCTHEADERS) if $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(OCTAVE_CXX) $(OCTHEADERS); then \ : ; \ else \ rm -f $(OCTHEADERSGCH); \ exit 1; \ fi else octave_precompile_headers: echo "precompiling Octave headers not supported"; exit 1 endif # ---------------------------------------------------------------- # Build a C dynamically loadable module # Note: Octave requires C++ compiler when compiling C wrappers # ---------------------------------------------------------------- octave: $(SRCDIR_SRCS) $(SWIG) -octave $(SWIGOCTHDROPT) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -g -c $(IOCTHEADERS) $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(INCLUDES) $(OCTAVE_CXX) $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS) $(INCLUDES) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO) # ----------------------------------------------------------------- # Build a C++ dynamically loadable module # ----------------------------------------------------------------- octave_cpp: $(SRCDIR_SRCS) $(SWIG) -c++ -octave $(SWIGOCTHDROPT) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -g -c $(IOCTHEADERS) $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(OCTAVE_CXX) $(CXXSHARED) -g $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO) # ----------------------------------------------------------------- # Running an Octave example # ----------------------------------------------------------------- octave_run: env OCTAVE_PATH= OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(OCTAVE_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- octave_version: $(OCTAVE) --version | head -n 1 # ----------------------------------------------------------------- # Cleaning the Octave examples # ----------------------------------------------------------------- octave_clean: rm -rf __pycache__ rm -f *_wrap* *~ .~* myoctave@EXEEXT@ *.pyc rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ *$(OCTAVE_SO) rm -f $(OCTHEADERS) $(OCTHEADERSGCH) ################################################################## ##### PERL 5 ###### ################################################################## # You need to set this variable to the Perl5 directory containing the # files "perl.h", "EXTERN.h" and "XSUB.h". With Perl5.003, it's # usually something like /usr/local/lib/perl5/arch-osname/5.003/CORE. PERL5_INCLUDE= @PERL5EXT@ # Extra Perl specific dynamic linking options PERL5_DLNK = @PERL5DYNAMICLINKING@ PERL5_CCFLAGS = @PERL5CCFLAGS@ PERL5_CCDLFLAGS = @PERL5CCDLFLAGS@ PERL5_CCCDLFLAGS = @PERL5CCCDLFLAGS@ PERL5_LDFLAGS = @PERL5LDFLAGS@ PERL = @PERL@ PERL5_LIB = -L$(PERL5_INCLUDE) -l@PERL5LIB@ @LIBS@ $(SYSLIBS) PERL5_SCRIPT = $(SRCDIR)$(RUNME).pl # ---------------------------------------------------------------- # Build a Perl5 dynamically loadable module (C) # ---------------------------------------------------------------- perl5: $(SRCDIR_SRCS) $(SWIG) -perl5 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c -Dbool=char $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ---------------------------------------------------------------- # Build a Perl5 dynamically loadable module (C++) # ---------------------------------------------------------------- perl5_cpp: $(SRCDIR_SRCS) $(SWIG) -perl5 -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ---------------------------------------------------------------- # Build a module from existing XS C source code. (ie. from xsubpp). # ---------------------------------------------------------------- perl5_xs: $(SRCDIR_SRCS) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(TARGET)$(SO) # ---------------------------------------------------------------- # Build a statically linked Perl5 executable # ---------------------------------------------------------------- perl5_static: $(SRCDIR_SRCS) $(SWIG) -perl5 -static -lperlmain.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Dbool=char $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET) perl5_static_cpp: $(SRCDIR_SRCS) $(SWIG) -perl5 -c++ -static -lperlmain.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET) # ----------------------------------------------------------------- # Running a Perl5 example # ----------------------------------------------------------------- perl5_run: $(RUNTOOL) $(PERL) -I. $(PERL5_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- perl5_version: $(PERL) -v | grep "This is" # ----------------------------------------------------------------- # Cleaning the Perl5 examples # ----------------------------------------------------------------- perl5_clean: rm -f *_wrap* *~ .~* myperl@EXEEXT@ *.pm rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ ################################################################## ##### PHP ###### ################################################################## PHP = @PHP@ PHP_INCLUDE = @PHPINC@ PHP_SO = @PHP_SO@ PHP_SCRIPT = $(SRCDIR)$(RUNME).php PHP_EXTENSION = example$(PHP_SO) # ------------------------------------------------------------------- # Build a PHP dynamically loadable module (C) # ------------------------------------------------------------------- php: $(SRCDIR_SRCS) $(SWIG) -php $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PHP_INCLUDE) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO) # -------------------------------------------------------------------- # Build a PHP dynamically loadable module (C++) # -------------------------------------------------------------------- php_cpp: $(SRCDIR_SRCS) $(SWIG) -php -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP_INCLUDE) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO) # ----------------------------------------------------------------- # Running a PHP example # ----------------------------------------------------------------- php_run: $(RUNTOOL) $(PHP) -n -d extension_dir=. -d extension=$(PHP_EXTENSION) -d display_errors=stderr -r 'set_error_handler(function($$n,$$s,$$f,$$l){if($$f!==Null){print$$f;if($$l!==Null)print":$$l";print": ";}print"$$s\n";exit(1);});if(strlen($$argv[1]))include($$argv[1]);' '$(PHP_SCRIPT)' $(RUNPIPE) php_run_multi: $(RUNTOOL) $(PHP) -n -d extension_dir=. `while read e ; do echo ' -d extension=$(TARGETPREFIX)'"$$e"'@PHP_SO@' ; done < $(PHP_EXTENSION_LIST)` -d display_errors=stderr -r 'set_error_handler(function($$n,$$s,$$f,$$l){if($$f!==Null){print$$f;if($$l!==Null)print":$$l";print": ";}print"$$s\n";exit(1);});if(strlen($$argv[1]))include($$argv[1]);' '$(PHP_SCRIPT)' $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- php_version: $(PHP) -v | head -n 1 # ----------------------------------------------------------------- # Cleaning the PHP examples # ----------------------------------------------------------------- php_clean: rm -f *_wrap* *~ .~* example.php php_example.h rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *$(PHP_SO) ################################################################## ##### PYTHON ###### ################################################################## # Make sure these locate your Python installation ifneq (,$(PY2)) PYTHON_INCLUDE= $(DEFS) @PYINCLUDE@ PYTHON_LIB = @PYLIB@ PYTHON = @PYTHON@ else PYTHON_INCLUDE= $(DEFS) @PY3INCLUDE@ PYTHON_LIB = @PY3LIB@ PYTHON = @PYTHON3@ endif # Extra Python specific linking options ifneq (,$(PY2)) PYTHON_DLNK = @PYTHONDYNAMICLINKING@ PYTHON_LINK = @PYLINK@ else PYTHON_DLNK = @PYTHON3DYNAMICLINKING@ PYTHON_LINK = @PY3LINK@ endif # Set PY_ABI_VER to the target ABI version, such as 3.4, if wanting a stable ABI build PY_ABI_VER = ifneq (,$(PY_ABI_VER)) PYTHON_SO = .abi3@PYTHON_SO@ EXTRA_CPPFLAGS := -DPy_LIMITED_API=$(shell printf "0x%02X%02X0000" $(subst ., ,$(PY_ABI_VER))) else PYTHON_SO = @PYTHON_SO@ endif PYFLAGS = -Werror PYCODESTYLE = @PYCODESTYLE@ PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,W291,W391 PYABI3AUDIT = @PYABI3AUDIT@ # ---------------------------------------------------------------- # Build a C dynamically loadable module # ---------------------------------------------------------------- python: $(SRCDIR_SRCS) $(SWIG) -python $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(PYTHON_INCLUDE) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) ifneq (,$(PY_ABI_VER)) ifneq (,$(PYABI3AUDIT)) $(COMPILETOOL) $(PYABI3AUDIT) --assume-minimum-abi3 $(PY_ABI_VER) --report -o $(TARGET)_abi3_report.json $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) || (cat $(TARGET)_abi3_report.json && false) endif endif # ----------------------------------------------------------------- # Build a C++ dynamically loadable module # ----------------------------------------------------------------- python_cpp: $(SRCDIR_SRCS) $(SWIG) -python -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(PYTHON_INCLUDE) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) ifneq (,$(PY_ABI_VER)) ifneq (,$(PYABI3AUDIT)) $(COMPILETOOL) $(PYABI3AUDIT) --assume-minimum-abi3 $(PY_ABI_VER) --report -o $(TARGET)_abi3_report.json $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) || (cat $(TARGET)_abi3_report.json && false) endif endif # ----------------------------------------------------------------- # Build statically linked Python interpreter # # These should only be used in conjunction with the %include embed.i # library file # ----------------------------------------------------------------- #TKINTER = -L/usr/X11R6.3/lib -L/usr/local/compat/lib -ltk4.0 -ltcl7.4 -lX11 TKINTER = PYTHON_LIBOPTS = $(PYTHON_LINK) @LIBS@ $(TKINTER) $(SYSLIBS) python_static: $(SRCDIR_SRCS) $(SWIG) -python -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \ $(PYTHON_INCLUDE) $(LIBS) $(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET) python_static_cpp: $(SRCDIR_SRCS) $(SWIG) -python -c++ -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \ $(PYTHON_INCLUDE) $(LIBS) $(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET) # ----------------------------------------------------------------- # Running a Python example # ----------------------------------------------------------------- PYSCRIPT = $(RUNME).py python_run: $(PYSCRIPT) ifneq (,$(PYCODESTYLE)) $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $(PYSCRIPT) endif env PYTHONPATH=$$PWD $(RUNTOOL) $(PYTHON) $(PYFLAGS) $(PYSCRIPT) $(RUNPIPE) ifneq (,$(SRCDIR)) $(RUNME).py: $(SRCDIR)$(RUNME).py cp $< $@ endif # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- python_version: $(PYTHON) -VV # ----------------------------------------------------------------- # Cleaning the python examples # ----------------------------------------------------------------- python_clean: rm -rf __pycache__ rm -f *_wrap* *~ .~* mypython@EXEEXT@ *.pyc rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ *$(PYTHON_SO) rm -f $(TARGET).py rm -f *_abi3_report.json case "x$(SRCDIR)" in x|x./);; *) rm -f $(RUNME).py;; esac ################################################################## ##### R ###### ################################################################## R = R RCXXSRCS = $(INTERFACE:.i=_wrap.cpp) #Need to use _wrap.cpp for R build system as it does not understand _wrap.cxx RRSRC = $(INTERFACE:.i=.R) R_CFLAGS=-fPIC R_OPT = --slave --quiet --no-save --no-restore R_SCRIPT=$(SRCDIR)$(RUNME).R # need to compile .cxx files outside of R build system to make sure that # we get -fPIC # CMD SHLIB stdout is piped to /dev/null to prevent echo of compiler command # ---------------------------------------------------------------- # Build a R dynamically loadable module (C) # ---------------------------------------------------------------- r: $(SRCDIR_SRCS) $(SWIG) -r $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) ifneq ($(SRCDIR_SRCS),) $(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(R_CFLAGS) $(SRCDIR_SRCS) $(INCLUDES) endif +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" PKG_CFLAGS="$(CFLAGS)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) $(OBJS) > /dev/null ) # ---------------------------------------------------------------- # Build a R dynamically loadable module (C++) # ---------------------------------------------------------------- r_cpp: $(SRCDIR_CXXSRCS) $(SWIG) -c++ -r $(SWIGOPT) -o $(RCXXSRCS) $(INTERFACEPATH) ifneq ($(SRCDIR_CXXSRCS),) $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(R_CFLAGS) $(SRCDIR_CXXSRCS) $(INCLUDES) endif +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" PKG_CXXFLAGS="$(CXXFLAGS)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) $(OBJS) > /dev/null ) # ----------------------------------------------------------------- # Run R example # ----------------------------------------------------------------- r_run: $(RUNTOOL) $(R) $(R_OPT) -f $(R_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- r_version: $(R) --version | head -n 1 # ----------------------------------------------------------------- # Cleaning the R examples # ----------------------------------------------------------------- r_clean: rm -f *_wrap* *~ .~* rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ NAMESPACE rm -f $(RRSRC) $(RUNME).Rout .RData ################################################################## ##### RUBY ###### ################################################################## # Make sure these locate your Ruby installation RUBY_CFLAGS= @RUBYCCDLFLAGS@ $(DEFS) RUBY_INCLUDE= @RUBYINCLUDE@ RUBY_LIB = @RUBYLIB@ RUBY_DLNK = @RUBYDYNAMICLINKING@ RUBY_LIBOPTS = @RUBYLINK@ @LIBS@ $(SYSLIBS) RUBY_SO = @RUBYSO@ RUBY = @RUBY@ RUBY_SCRIPT = $(SRCDIR)$(RUNME).rb # ---------------------------------------------------------------- # Build a C dynamically loadable module # ---------------------------------------------------------------- ruby: $(SRCDIR_SRCS) $(SWIG) -ruby $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(RUBY_CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(RUBY_INCLUDE) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(RUBY_SO) # ----------------------------------------------------------------- # Build a C++ dynamically loadable module # ----------------------------------------------------------------- ruby_cpp: $(SRCDIR_SRCS) $(SWIG) -c++ -ruby $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(RUBY_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(RUBY_INCLUDE) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(RUBY_SO) # ----------------------------------------------------------------- # Build statically linked Ruby interpreter # # These should only be used in conjunction with the %include embed.i # library file # ----------------------------------------------------------------- ruby_static: $(SRCDIR_SRCS) $(SWIG) -ruby -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(RUBY_CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \ $(RUBY_INCLUDE) $(LIBS) -L$(RUBY_LIB) $(RUBY_LIBOPTS) -o $(TARGET) ruby_cpp_static: $(SRCDIR_SRCS) $(SWIG) -c++ -ruby -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(RUBY_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \ $(RUBY_INCLUDE) $(LIBS) -L$(RUBY_LIB) $(RUBY_LIBOPTS) -o $(TARGET) # ----------------------------------------------------------------- # Run Ruby example # ----------------------------------------------------------------- ruby_run: $(RUNTOOL) $(RUBY) $(RUBYFLAGS) -I. $(RUBY_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- ruby_version: $(RUBY) -v # ----------------------------------------------------------------- # Cleaning the Ruby examples # ----------------------------------------------------------------- ruby_clean: rm -f *_wrap* *~ .~* myruby@EXEEXT@ rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *$(RUBY_SO) ################################################################## ##### SCILAB ###### ################################################################## SCILAB = @SCILAB@ SCILAB_INC= @SCILABINCLUDE@ SCILAB_OPT = @SCILABOPT@ SCILAB_VERSION = @SCILAB_VERSION@ SCILAB_LIBPREFIX = lib # ---------------------------------------------------------------- # Build a C dynamically loadable module # ---------------------------------------------------------------- scilab: $(SWIG) -scilab $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SCILAB_INC) $(INCLUDES) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(IOBJS) $(OBJS) $(LIBS) -o $(SCILAB_LIBPREFIX)$(TARGET)$(SO) # ---------------------------------------------------------------- # Build a C++ dynamically loadable module # ---------------------------------------------------------------- scilab_cpp: $(SWIG) -c++ -scilab $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SCILAB_INC) $(INCLUDES) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(IOBJS) $(OBJS) $(LIBS) $(CPP_DLLIBS) -o $(SCILAB_LIBPREFIX)$(TARGET)$(SO) # ----------------------------------------------------------------- # Running a Scilab example # ----------------------------------------------------------------- scilab_run: env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(SCILAB) $(SCILAB_OPT) -f $(SRCDIR)$(RUNME).sci $(RUNPIPE) # ----------------------------------------------------------------- # Scilab version # ----------------------------------------------------------------- scilab_version: echo `$(SCILAB) -nwni -version | head -1` # ----------------------------------------------------------------- # Cleaning the scilab examples # ----------------------------------------------------------------- scilab_clean: rm -f *_wrap* *~ .~* rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ rm -f *.sce ################################################################## ##### TCL ###### ################################################################## # Set these to your local copy of Tcl TCLSH = tclsh TCL_INCLUDE = @TCLINCLUDE@ TCL_LIB = @TCLLIB@ TCL_OPTS = @LIBS@ TK_OPTS = -ltk -ltcl @LIBS@ # Extra Tcl specific dynamic linking options TCL_DLNK = @TCLDYNAMICLINKING@ TCL_SO = @TCL_SO@ TCLLDSHARED = @TCLLDSHARED@ TCLCXXSHARED = @TCLCXXSHARED@ TCL_SCRIPT = $(SRCDIR)$(RUNME).tcl TCL_LINK = @TCLLINK@ # ----------------------------------------------------------- # Build a new version of the tclsh shell # ----------------------------------------------------------- tclsh: $(SRCDIR_SRCS) $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i -o $(ISRCS) $(INTERFACEPATH) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) \ $(TCL_LIB) $(TCL_OPTS) $(LIBS) $(SYSLIBS) -o $(TARGET) tclsh_cpp: $(SRCDIR_SRCS) $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) \ $(TCL_LIB) $(TCL_OPTS) $(LIBS) $(SYSLIBS) -o $(TARGET) # ----------------------------------------------------------- # Build a Tcl dynamic loadable module (you might need to tweak this) # ----------------------------------------------------------- tcl: $(SRCDIR_SRCS) $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) $(TCLLDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) $(TCL_LINK) # ----------------------------------------------------------- # Build a Tcl dynamic loadable module for C++ # ----------------------------------------------------------- tcl_cpp: $(SRCDIR_SRCS) $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) $(TCLCXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) $(TCL_LINK) # ----------------------------------------------------------------- # Run Tcl example # ----------------------------------------------------------------- tcl_run: $(RUNTOOL) $(TCLSH) $(TCL_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- tcl_version: echo 'puts $$tcl_version;exit 0' | $(TCLSH) # ----------------------------------------------------------------- # Cleaning the Tcl examples # ----------------------------------------------------------------- tcl_clean: rm -f *_wrap* *~ .~* mytclsh@EXEEXT@ rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *$(TCL_SO) swig-4.4.1/Examples/README000066400000000000000000000030521511462406000151260ustar00rootroot00000000000000SWIG Examples The subdirectories of "Examples" named after SWIG's language backends contain a number of simple examples that are primarily used for testing. The file 'index.html' is the top of a hyperlinked document that contains information about all of the examples along with various notes related to each example. Note: All of the examples rely upon the Makefile in this directory. You may need to edit it to reflect the configuration of your machine in case the configure script guesses incorrect settings. *** Special note concerning C++ *** The configure script is currently unable to handle all of the possible options for producing dynamically loadable C++ extensions. Here are the rules of thumb for making C++ work: - Try using the C++ as the linker for the shared library. For example: g++ -shared $(OBJS) -o module.so - If that doesn't work, you may need to explicitly link against some kind of C++ runtime library. For example: ld -G $(OBJS) -L/opt/SUNWspro/lib -lCrun -o module.so This can be set by modifying the setting of CPP_DLLIBS in the Makefile. *** Special note for SWIG Maintainers *** When you add an example, consider arranging for the example to be also useful as part of the SWIG testing framework. To do this, include in the example makefile a target "check" ("check: all" is sufficient for a first pass), and add an invocation to ../Makefile.in under target "check-examples" (or whatever is appropriate). Later, we can add or expand the actions under target "check" to do more in-depth testing. swig-4.4.1/Examples/android/000077500000000000000000000000001511462406000156665ustar00rootroot00000000000000swig-4.4.1/Examples/android/check.list000066400000000000000000000000601511462406000176340ustar00rootroot00000000000000# see top-level Makefile.in class extend simple swig-4.4.1/Examples/android/class/000077500000000000000000000000001511462406000167735ustar00rootroot00000000000000swig-4.4.1/Examples/android/class/AndroidManifest.xml000066400000000000000000000011431511462406000225630ustar00rootroot00000000000000 swig-4.4.1/Examples/android/class/Makefile000066400000000000000000000020661511462406000204370ustar00rootroot00000000000000TOP = ../.. SWIGEXE = $(TOP)/../swig SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib TARGET = example INTERFACE = example.i INTERFACEDIR = jni/ PACKAGEDIR = $(SRCDIR)src/org/swig PACKAGENAME= org.swig.classexample SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/classexample PROJECTNAME= SwigClass TARGETID = 1 #INSTALLOPTIONS = -s # To install on SD Card check: build build: $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \ PROJECTNAME='$(PROJECTNAME)' TARGETID='$(TARGETID)' android_cpp install: $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INSTALLOPTIONS='$(INSTALLOPTIONS)' PROJECTNAME='$(PROJECTNAME)' \ PACKAGEDIR='$(PACKAGEDIR)' PACKAGENAME='$(PACKAGENAME)' android_install clean: $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \ PACKAGEDIR='$(PACKAGEDIR)' INTERFACEDIR='$(INTERFACEDIR)' android_clean swig-4.4.1/Examples/android/class/ant.properties000066400000000000000000000012701511462406000216730ustar00rootroot00000000000000# This file is used to override default values used by the Ant build system. # # This file must be checked in Version Control Systems, as it is # integral to the build system of your project. # This file is only used by the Ant script. # You can use this to override default values such as # 'source.dir' for the location of your java source folder and # 'out.dir' for the location of your output folder. # You can also use it define how the release builds are signed by declaring # the following properties: # 'key.store' for the location of your keystore and # 'key.alias' for the name of the key to use. # The password will be asked during the build when you use the 'release' target. swig-4.4.1/Examples/android/class/build.xml000066400000000000000000000064041511462406000206200ustar00rootroot00000000000000 swig-4.4.1/Examples/android/class/jni/000077500000000000000000000000001511462406000175535ustar00rootroot00000000000000swig-4.4.1/Examples/android/class/jni/Android.mk000066400000000000000000000003161511462406000214640ustar00rootroot00000000000000# File: Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := example LOCAL_SRC_FILES := example_wrap.cpp example.cpp LOCAL_CFLAGS := -frtti include $(BUILD_SHARED_LIBRARY) swig-4.4.1/Examples/android/class/jni/example.cpp000066400000000000000000000006501511462406000217130ustar00rootroot00000000000000/* File : example.cpp */ #include "example.h" #define M_PI 3.14159265358979323846 /* Move the shape to a new location */ void Shape::move(double dx, double dy) { x += dx; y += dy; } int Shape::nshapes = 0; double Circle::area() { return M_PI*radius*radius; } double Circle::perimeter() { return 2*M_PI*radius; } double Square::area() { return width*width; } double Square::perimeter() { return 4*width; } swig-4.4.1/Examples/android/class/jni/example.h000066400000000000000000000010761511462406000213630ustar00rootroot00000000000000/* File : example.h */ class Shape { public: Shape() { nshapes++; } virtual ~Shape() { nshapes--; } double x, y; void move(double dx, double dy); virtual double area() = 0; virtual double perimeter() = 0; static int nshapes; }; class Circle : public Shape { private: double radius; public: Circle(double r) : radius(r) { } virtual double area(); virtual double perimeter(); }; class Square : public Shape { private: double width; public: Square(double w) : width(w) { } virtual double area(); virtual double perimeter(); }; swig-4.4.1/Examples/android/class/jni/example.i000066400000000000000000000002151511462406000213560ustar00rootroot00000000000000/* File : example.i */ %module example %{ #include "example.h" %} /* Let's just grab the original header file here */ %include "example.h" swig-4.4.1/Examples/android/class/local.properties000066400000000000000000000006631511462406000222100ustar00rootroot00000000000000# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must *NOT* be checked in Version Control Systems, # as it contains information specific to your local configuration. # location of the SDK. This is only used by Ant # For customization when using a Version Control System, please read the # header note. sdk.dir=/home/william/android/android-sdk-linux_x86 swig-4.4.1/Examples/android/class/proguard.cfg000066400000000000000000000023401511462406000212760ustar00rootroot00000000000000-optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService -keepclasseswithmembernames class * { native ; } -keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet); } -keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet, int); } -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } swig-4.4.1/Examples/android/class/project.properties000066400000000000000000000005501511462406000225570ustar00rootroot00000000000000# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system use, # "ant.properties", and override values to adapt the script to your # project structure. # Project target. target=android-8 swig-4.4.1/Examples/android/class/res/000077500000000000000000000000001511462406000175645ustar00rootroot00000000000000swig-4.4.1/Examples/android/class/res/layout/000077500000000000000000000000001511462406000211015ustar00rootroot00000000000000swig-4.4.1/Examples/android/class/res/layout/main.xml000066400000000000000000000013221511462406000225450ustar00rootroot00000000000000