ffi 1.9.23 → 1.9.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -0
- data/Rakefile +1 -1
- data/ext/ffi_c/Call.c +5 -2
- data/ext/ffi_c/Function.c +8 -5
- data/ext/ffi_c/Thread.c +1 -0
- data/ext/ffi_c/extconf.rb +1 -0
- data/ext/ffi_c/libffi/.appveyor.yml +6 -4
- data/ext/ffi_c/libffi/.github/issue_template.md +10 -0
- data/ext/ffi_c/libffi/.gitignore +2 -0
- data/ext/ffi_c/libffi/.travis.yml +20 -16
- data/ext/ffi_c/libffi/.travis/ar-lib +270 -0
- data/ext/ffi_c/libffi/.travis/build.sh +34 -0
- data/ext/ffi_c/libffi/.travis/compile +351 -0
- data/ext/ffi_c/libffi/.travis/install.sh +11 -3
- data/ext/ffi_c/libffi/.travis/moxie-sim.exp +60 -0
- data/ext/ffi_c/libffi/.travis/site.exp +18 -0
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +352 -0
- data/ext/ffi_c/libffi/Makefile.am +4 -45
- data/ext/ffi_c/libffi/{README → README.md} +237 -230
- data/ext/ffi_c/libffi/configure.ac +10 -8
- data/ext/ffi_c/libffi/configure.host +5 -0
- data/ext/ffi_c/libffi/include/ffi.h.in +48 -26
- data/ext/ffi_c/libffi/include/ffi_common.h +2 -0
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +18 -16
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +21 -8
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +4 -4
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +9 -7
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +8 -5
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -5
- data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +7 -6
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +99 -61
- data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +18 -8
- data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +37 -0
- data/ext/ffi_c/libffi/msvcc.sh +82 -14
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +8 -31
- data/ext/ffi_c/libffi/src/closures.c +31 -1
- data/ext/ffi_c/libffi/src/ia64/ffi.c +24 -6
- data/ext/ffi_c/libffi/src/ia64/ffitarget.h +2 -1
- data/ext/ffi_c/libffi/src/ia64/unix.S +6 -1
- data/ext/ffi_c/libffi/src/mips/ffi.c +29 -12
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +7 -12
- data/ext/ffi_c/libffi/src/moxie/eabi.S +1 -1
- data/ext/ffi_c/libffi/src/moxie/ffi.c +18 -5
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +45 -16
- data/ext/ffi_c/libffi/src/riscv/ffi.c +445 -0
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +68 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +214 -0
- data/ext/ffi_c/libffi/src/types.c +3 -1
- data/ext/ffi_c/libffi/src/x86/ffi.c +18 -0
- data/ext/ffi_c/libffi/src/x86/ffi64.c +15 -9
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +8 -2
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +30 -9
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +6 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.am +108 -77
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +195 -5
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +50 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +58 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1745 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2885 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +743 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +14 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +3 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest.cc +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest_ffi_call.cc +1 -1
- data/lib/ffi/library.rb +2 -4
- data/lib/ffi/platform/mips64-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +104 -0
- data/lib/ffi/version.rb +1 -1
- metadata +29 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c08414eed21b4a4c2dbb89687f9004a970ce2b997fc419566221ee01384e5eb
|
|
4
|
+
data.tar.gz: 4849cae15554e04a89322a7e1738b804be57f09e8606170803655c4804ba03a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a4984c832d1358e61c05b50b936e6f757cb301202d441a686bbd2b2a963f77fd1371bfcb2644e75522ded093d0f9055843d28bf7593ef7f037c349cd443efab5
|
|
7
|
+
data.tar.gz: cae427a16110ac965beb4e999f9f5a8950a69f321a09d641343dfd2b3ec4f3fcd5ad428047f25e1b87800b4f0dd2827eb5cd143e51c50af9944ce2c0f38eb892
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
1.9.24 / 2018-06-02
|
|
2
|
+
-------------------
|
|
3
|
+
|
|
4
|
+
Added:
|
|
5
|
+
* Added a CHANGELOG file
|
|
6
|
+
* Add mips64(eb) support, and mips r6 support. (#601)
|
|
7
|
+
|
|
8
|
+
Changed:
|
|
9
|
+
* Update libffi to latest changes on master.
|
|
10
|
+
* Don't search in hardcoded /usr paths on Windows.
|
|
11
|
+
* Don't treat Symbol args different to Strings in ffi_lib.
|
|
12
|
+
* Make sure size_t is defined in Thread.c. Fixes #609
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
1.9.23 / 2018-02-25
|
|
16
|
+
-------------------
|
|
17
|
+
|
|
18
|
+
Changed:
|
|
19
|
+
* Fix unnecessary rebuild of configure in darwin multi arch. Fixes #605
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
1.9.22 / 2018-02-22
|
|
23
|
+
-------------------
|
|
24
|
+
|
|
25
|
+
Changed:
|
|
26
|
+
* Update libffi to latest changes on master.
|
|
27
|
+
* Update detection of system libffi to match new requirements. Fixes #617
|
|
28
|
+
* Prefer bundled libffi over system libffi on Mac OS.
|
|
29
|
+
* Do closures via libffi. This removes ClosurePool and fixes compat with PaX. #540
|
|
30
|
+
* Use a more deterministic gem packaging.
|
|
31
|
+
* Fix unnecessary update of autoconf files at gem install.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
1.9.21 / 2018-02-06
|
|
35
|
+
-------------------
|
|
36
|
+
|
|
37
|
+
Added:
|
|
38
|
+
* Ruby-2.5 support by Windows binary gems. Fixes #598
|
|
39
|
+
* Add missing win64 types.
|
|
40
|
+
* Added support for Bitmask. (#573)
|
|
41
|
+
* Add support for MSYS2 (#572) and Sparc64 Linux. (#574)
|
|
42
|
+
|
|
43
|
+
Changed:
|
|
44
|
+
* Fix read_string to not throw an error on length 0.
|
|
45
|
+
* Don't use absolute paths for sh and env. Fixes usage on Adroid #528
|
|
46
|
+
* Use Ruby implementation for `which` for better compat with Windows. Fixes #315
|
|
47
|
+
* Fix compatibility with PPC64LE platform. (#577)
|
|
48
|
+
* Normalize sparc64 to sparcv9. (#575)
|
|
49
|
+
|
|
50
|
+
Removed:
|
|
51
|
+
* Drop Ruby 1.8.7 support (#480)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
1.9.18 / 2017-03-03
|
|
55
|
+
-------------------
|
|
56
|
+
|
|
57
|
+
Added:
|
|
58
|
+
* Add compatibility with Ruby-2.4.
|
|
59
|
+
|
|
60
|
+
Changed:
|
|
61
|
+
* Add missing shlwapi.h include to fix Windows build.
|
|
62
|
+
* Avoid undefined behaviour of LoadLibrary() on Windows. #553
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
1.9.17 / 2017-01-13
|
|
66
|
+
-------------------
|
data/Rakefile
CHANGED
|
@@ -161,7 +161,7 @@ namespace 'java' do
|
|
|
161
161
|
s.homepage = gem_spec.homepage
|
|
162
162
|
s.summary = gem_spec.summary
|
|
163
163
|
s.description = gem_spec.description
|
|
164
|
-
s.files = %w(LICENSE COPYING README.md Rakefile)
|
|
164
|
+
s.files = %w(LICENSE COPYING README.md CHANGELOG.md Rakefile)
|
|
165
165
|
s.has_rdoc = false
|
|
166
166
|
s.license = gem_spec.license
|
|
167
167
|
s.platform = 'java'
|
data/ext/ffi_c/Call.c
CHANGED
|
@@ -43,6 +43,9 @@
|
|
|
43
43
|
#endif
|
|
44
44
|
#include <errno.h>
|
|
45
45
|
#include <ruby.h>
|
|
46
|
+
#if defined(HAVE_RUBY_THREAD_H)
|
|
47
|
+
#include <ruby/thread.h>
|
|
48
|
+
#endif
|
|
46
49
|
#if defined(HAVE_NATIVETHREAD) && (defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) && !defined(_WIN32)
|
|
47
50
|
# include <signal.h>
|
|
48
51
|
# include <pthread.h>
|
|
@@ -317,7 +320,7 @@ rbffi_SetupCallParams(int argc, VALUE* argv, int paramCount, Type** paramTypes,
|
|
|
317
320
|
}
|
|
318
321
|
}
|
|
319
322
|
|
|
320
|
-
static
|
|
323
|
+
static void *
|
|
321
324
|
call_blocking_function(void* data)
|
|
322
325
|
{
|
|
323
326
|
rbffi_blocking_call_t* b = (rbffi_blocking_call_t *) data;
|
|
@@ -325,7 +328,7 @@ call_blocking_function(void* data)
|
|
|
325
328
|
ffi_call(&b->cif, FFI_FN(b->function), b->retval, b->ffiValues);
|
|
326
329
|
b->frame->has_gvl = true;
|
|
327
330
|
|
|
328
|
-
return
|
|
331
|
+
return NULL;
|
|
329
332
|
}
|
|
330
333
|
|
|
331
334
|
VALUE
|
data/ext/ffi_c/Function.c
CHANGED
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
# endif
|
|
48
48
|
#endif
|
|
49
49
|
#include <ruby.h>
|
|
50
|
+
#if defined(HAVE_RUBY_THREAD_H)
|
|
51
|
+
#include <ruby/thread.h>
|
|
52
|
+
#endif
|
|
50
53
|
|
|
51
54
|
#include <ffi.h>
|
|
52
55
|
#if defined(HAVE_NATIVETHREAD) && !defined(_WIN32)
|
|
@@ -554,7 +557,7 @@ struct async_wait {
|
|
|
554
557
|
bool stop;
|
|
555
558
|
};
|
|
556
559
|
|
|
557
|
-
static
|
|
560
|
+
static void * async_cb_wait(void *);
|
|
558
561
|
static void async_cb_stop(void *);
|
|
559
562
|
|
|
560
563
|
#if defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
|
|
@@ -643,7 +646,7 @@ async_cb_event(void* unused)
|
|
|
643
646
|
#endif
|
|
644
647
|
|
|
645
648
|
#ifdef _WIN32
|
|
646
|
-
static
|
|
649
|
+
static void *
|
|
647
650
|
async_cb_wait(void *data)
|
|
648
651
|
{
|
|
649
652
|
struct async_wait* w = (struct async_wait *) data;
|
|
@@ -665,7 +668,7 @@ async_cb_wait(void *data)
|
|
|
665
668
|
|
|
666
669
|
LeaveCriticalSection(&async_cb_lock);
|
|
667
670
|
|
|
668
|
-
return
|
|
671
|
+
return NULL;
|
|
669
672
|
}
|
|
670
673
|
|
|
671
674
|
static void
|
|
@@ -680,7 +683,7 @@ async_cb_stop(void *data)
|
|
|
680
683
|
}
|
|
681
684
|
|
|
682
685
|
#else
|
|
683
|
-
static
|
|
686
|
+
static void *
|
|
684
687
|
async_cb_wait(void *data)
|
|
685
688
|
{
|
|
686
689
|
struct async_wait* w = (struct async_wait *) data;
|
|
@@ -700,7 +703,7 @@ async_cb_wait(void *data)
|
|
|
700
703
|
|
|
701
704
|
pthread_mutex_unlock(&async_cb_mutex);
|
|
702
705
|
|
|
703
|
-
return
|
|
706
|
+
return NULL;
|
|
704
707
|
}
|
|
705
708
|
|
|
706
709
|
static void
|
data/ext/ffi_c/Thread.c
CHANGED
data/ext/ffi_c/extconf.rb
CHANGED
|
@@ -26,6 +26,7 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
have_header('shlwapi.h')
|
|
29
|
+
have_header('ruby/thread.h') # for compat with ruby < 2.0
|
|
29
30
|
have_func('rb_thread_blocking_region')
|
|
30
31
|
have_func('rb_thread_call_with_gvl')
|
|
31
32
|
have_func('rb_thread_call_without_gvl')
|
|
@@ -28,10 +28,10 @@ install:
|
|
|
28
28
|
$env:HOST="x86-pc-windows"
|
|
29
29
|
} Else {
|
|
30
30
|
$env:VCVARS_PLATFORM="amd64"
|
|
31
|
-
$env:BUILD="x86_64-
|
|
32
|
-
$env:HOST="x86_64-
|
|
31
|
+
$env:BUILD="x86_64-w64-cygwin"
|
|
32
|
+
$env:HOST="x86_64-w64-cygwin"
|
|
33
33
|
}
|
|
34
|
-
- 'appveyor DownloadFile
|
|
34
|
+
- 'appveyor DownloadFile https://cygwin.com/setup-x86.exe -FileName setup.exe'
|
|
35
35
|
- 'setup.exe -qnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P dejagnu >NUL'
|
|
36
36
|
- '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin"'
|
|
37
37
|
- ps: $env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:VSVER" + "0COMNTOOLS"))
|
|
@@ -40,7 +40,9 @@ install:
|
|
|
40
40
|
|
|
41
41
|
build_script:
|
|
42
42
|
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; ./autogen.sh;)"
|
|
43
|
-
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; ./configure CC='/cygdrive/c/projects/libffi/msvcc.sh -m64' CXX='/cygdrive/c/projects/libffi/msvcc.sh -m64' LD=link CPP='cl -nologo -EP' --build=$BUILD --host=$HOST;
|
|
43
|
+
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; ./configure CC='/cygdrive/c/projects/libffi/msvcc.sh -m64' CXX='/cygdrive/c/projects/libffi/msvcc.sh -m64' LD='link' CPP='cl -nologo -EP' CXXCPP='cl -nologo -EP' CPPFLAGS='-DFFI_BUILDING_DLL' AR='/cygdrive/c/projects/libffi/.travis/ar-lib lib' NM='dumpbin -symbols' STRIP=':' --build=$BUILD --host=$HOST;)"
|
|
44
|
+
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; cp src/x86/ffitarget.h include; make; find .;)"
|
|
45
|
+
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; cp `find . -name 'libffi-?.dll'` $HOST/testsuite/; make check; cat `find ./ -name libffi.log`)"
|
|
44
46
|
|
|
45
47
|
# FIXME: "make check" currently fails. It just looks like msvcc needs
|
|
46
48
|
# to learn about -L and -l options. If you add "make check; cat `find
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## System Details
|
|
2
|
+
|
|
3
|
+
<!--- What platform are you working with? eg. the output of config.guess -->
|
|
4
|
+
<!--- Provide any toolchain details here. eg. compiler version -->
|
|
5
|
+
|
|
6
|
+
## Problems Description
|
|
7
|
+
|
|
8
|
+
<!--- Provide a description of the problem here -->
|
|
9
|
+
<!--- If this is a configure-time problem, attach config.log -->
|
|
10
|
+
<!--- If this is a testsuite problem, attach the relevant log output -->
|
data/ext/ffi_c/libffi/.gitignore
CHANGED
|
@@ -3,28 +3,32 @@ sudo: required
|
|
|
3
3
|
|
|
4
4
|
language: cpp
|
|
5
5
|
|
|
6
|
-
os:
|
|
7
|
-
- linux
|
|
8
|
-
compiler:
|
|
9
|
-
- gcc
|
|
10
|
-
- clang
|
|
11
|
-
env:
|
|
12
|
-
- CONFIGURE_OPTIONS=--disable-shared
|
|
13
|
-
- CONFIGURE_OPTIONS=
|
|
14
6
|
matrix:
|
|
15
7
|
include:
|
|
8
|
+
- os: osx
|
|
9
|
+
env: HOST=arm-apple-darwin
|
|
16
10
|
- os: linux
|
|
17
11
|
compiler: gcc
|
|
18
|
-
env: HOST=i386-pc-linux-gnu
|
|
12
|
+
env: HOST=i386-pc-linux-gnu MEVAL='export CC="$CC -m32" && CXX="$CXX -m32"'
|
|
13
|
+
- os: linux
|
|
14
|
+
compiler: gcc
|
|
15
|
+
- os: linux
|
|
16
|
+
compiler: gcc
|
|
17
|
+
env: CONFIGURE_OPTIONS=--disable-shared
|
|
18
|
+
- os: linux
|
|
19
|
+
compiler: clang
|
|
20
|
+
- os: linux
|
|
21
|
+
compiler: clang
|
|
22
|
+
env: CONFIGURE_OPTIONS=--disable-shared
|
|
23
|
+
- os: linux
|
|
24
|
+
env: HOST=moxie-elf MEVAL='export PATH=/opt/moxielogic/bin:$PATH && CC=moxie-elf-gcc && CXX=moxie-elf-g++' LDFLAGS=-Tsim.ld RUNTESTFLAGS="--target_board moxie-sim" DEJAGNU="$TRAVIS_BUILD_DIR/.travis/site.exp"
|
|
25
|
+
|
|
26
|
+
before_install:
|
|
27
|
+
- if test x"$MEVAL" != x; then eval ${MEVAL}; fi
|
|
19
28
|
|
|
20
29
|
install:
|
|
21
30
|
- ./.travis/install.sh
|
|
22
31
|
|
|
23
32
|
script:
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- ./configure ${HOST+--host=$HOST} ${CONFIGURE_OPTIONS}
|
|
27
|
-
- make
|
|
28
|
-
- make dist
|
|
29
|
-
- make check
|
|
30
|
-
- cat */testsuite/libffi.log
|
|
33
|
+
- if ! test x"$MEVAL" = x; then eval ${MEVAL}; fi
|
|
34
|
+
- ./.travis/build.sh
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
#! /bin/sh
|
|
2
|
+
# Wrapper for Microsoft lib.exe
|
|
3
|
+
|
|
4
|
+
me=ar-lib
|
|
5
|
+
scriptversion=2012-03-01.08; # UTC
|
|
6
|
+
|
|
7
|
+
# Copyright (C) 2010-2018 Free Software Foundation, Inc.
|
|
8
|
+
# Written by Peter Rosin <peda@lysator.liu.se>.
|
|
9
|
+
#
|
|
10
|
+
# This program is free software; you can redistribute it and/or modify
|
|
11
|
+
# it under the terms of the GNU General Public License as published by
|
|
12
|
+
# the Free Software Foundation; either version 2, or (at your option)
|
|
13
|
+
# any later version.
|
|
14
|
+
#
|
|
15
|
+
# This program is distributed in the hope that it will be useful,
|
|
16
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
# GNU General Public License for more details.
|
|
19
|
+
#
|
|
20
|
+
# You should have received a copy of the GNU General Public License
|
|
21
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
22
|
+
|
|
23
|
+
# As a special exception to the GNU General Public License, if you
|
|
24
|
+
# distribute this file as part of a program that contains a
|
|
25
|
+
# configuration script generated by Autoconf, you may include it under
|
|
26
|
+
# the same distribution terms that you use for the rest of that program.
|
|
27
|
+
|
|
28
|
+
# This file is maintained in Automake, please report
|
|
29
|
+
# bugs to <bug-automake@gnu.org> or send patches to
|
|
30
|
+
# <automake-patches@gnu.org>.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# func_error message
|
|
34
|
+
func_error ()
|
|
35
|
+
{
|
|
36
|
+
echo "$me: $1" 1>&2
|
|
37
|
+
exit 1
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
file_conv=
|
|
41
|
+
|
|
42
|
+
# func_file_conv build_file
|
|
43
|
+
# Convert a $build file to $host form and store it in $file
|
|
44
|
+
# Currently only supports Windows hosts.
|
|
45
|
+
func_file_conv ()
|
|
46
|
+
{
|
|
47
|
+
file=$1
|
|
48
|
+
case $file in
|
|
49
|
+
/ | /[!/]*) # absolute file, and not a UNC file
|
|
50
|
+
if test -z "$file_conv"; then
|
|
51
|
+
# lazily determine how to convert abs files
|
|
52
|
+
case `uname -s` in
|
|
53
|
+
MINGW*)
|
|
54
|
+
file_conv=mingw
|
|
55
|
+
;;
|
|
56
|
+
CYGWIN*)
|
|
57
|
+
file_conv=cygwin
|
|
58
|
+
;;
|
|
59
|
+
*)
|
|
60
|
+
file_conv=wine
|
|
61
|
+
;;
|
|
62
|
+
esac
|
|
63
|
+
fi
|
|
64
|
+
case $file_conv in
|
|
65
|
+
mingw)
|
|
66
|
+
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
|
67
|
+
;;
|
|
68
|
+
cygwin)
|
|
69
|
+
file=`cygpath -m "$file" || echo "$file"`
|
|
70
|
+
;;
|
|
71
|
+
wine)
|
|
72
|
+
file=`winepath -w "$file" || echo "$file"`
|
|
73
|
+
;;
|
|
74
|
+
esac
|
|
75
|
+
;;
|
|
76
|
+
esac
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
# func_at_file at_file operation archive
|
|
80
|
+
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
|
|
81
|
+
# for each of them.
|
|
82
|
+
# When interpreting the content of the @FILE, do NOT use func_file_conv,
|
|
83
|
+
# since the user would need to supply preconverted file names to
|
|
84
|
+
# binutils ar, at least for MinGW.
|
|
85
|
+
func_at_file ()
|
|
86
|
+
{
|
|
87
|
+
operation=$2
|
|
88
|
+
archive=$3
|
|
89
|
+
at_file_contents=`cat "$1"`
|
|
90
|
+
eval set x "$at_file_contents"
|
|
91
|
+
shift
|
|
92
|
+
|
|
93
|
+
for member
|
|
94
|
+
do
|
|
95
|
+
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
|
|
96
|
+
done
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
case $1 in
|
|
100
|
+
'')
|
|
101
|
+
func_error "no command. Try '$0 --help' for more information."
|
|
102
|
+
;;
|
|
103
|
+
-h | --h*)
|
|
104
|
+
cat <<EOF
|
|
105
|
+
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
|
|
106
|
+
|
|
107
|
+
Members may be specified in a file named with @FILE.
|
|
108
|
+
EOF
|
|
109
|
+
exit $?
|
|
110
|
+
;;
|
|
111
|
+
-v | --v*)
|
|
112
|
+
echo "$me, version $scriptversion"
|
|
113
|
+
exit $?
|
|
114
|
+
;;
|
|
115
|
+
esac
|
|
116
|
+
|
|
117
|
+
if test $# -lt 3; then
|
|
118
|
+
func_error "you must specify a program, an action and an archive"
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
AR=$1
|
|
122
|
+
shift
|
|
123
|
+
while :
|
|
124
|
+
do
|
|
125
|
+
if test $# -lt 2; then
|
|
126
|
+
func_error "you must specify a program, an action and an archive"
|
|
127
|
+
fi
|
|
128
|
+
case $1 in
|
|
129
|
+
-lib | -LIB \
|
|
130
|
+
| -ltcg | -LTCG \
|
|
131
|
+
| -machine* | -MACHINE* \
|
|
132
|
+
| -subsystem* | -SUBSYSTEM* \
|
|
133
|
+
| -verbose | -VERBOSE \
|
|
134
|
+
| -wx* | -WX* )
|
|
135
|
+
AR="$AR $1"
|
|
136
|
+
shift
|
|
137
|
+
;;
|
|
138
|
+
*)
|
|
139
|
+
action=$1
|
|
140
|
+
shift
|
|
141
|
+
break
|
|
142
|
+
;;
|
|
143
|
+
esac
|
|
144
|
+
done
|
|
145
|
+
orig_archive=$1
|
|
146
|
+
shift
|
|
147
|
+
func_file_conv "$orig_archive"
|
|
148
|
+
archive=$file
|
|
149
|
+
|
|
150
|
+
# strip leading dash in $action
|
|
151
|
+
action=${action#-}
|
|
152
|
+
|
|
153
|
+
delete=
|
|
154
|
+
extract=
|
|
155
|
+
list=
|
|
156
|
+
quick=
|
|
157
|
+
replace=
|
|
158
|
+
index=
|
|
159
|
+
create=
|
|
160
|
+
|
|
161
|
+
while test -n "$action"
|
|
162
|
+
do
|
|
163
|
+
case $action in
|
|
164
|
+
d*) delete=yes ;;
|
|
165
|
+
x*) extract=yes ;;
|
|
166
|
+
t*) list=yes ;;
|
|
167
|
+
q*) quick=yes ;;
|
|
168
|
+
r*) replace=yes ;;
|
|
169
|
+
s*) index=yes ;;
|
|
170
|
+
S*) ;; # the index is always updated implicitly
|
|
171
|
+
c*) create=yes ;;
|
|
172
|
+
u*) ;; # TODO: don't ignore the update modifier
|
|
173
|
+
v*) ;; # TODO: don't ignore the verbose modifier
|
|
174
|
+
*)
|
|
175
|
+
func_error "unknown action specified"
|
|
176
|
+
;;
|
|
177
|
+
esac
|
|
178
|
+
action=${action#?}
|
|
179
|
+
done
|
|
180
|
+
|
|
181
|
+
case $delete$extract$list$quick$replace,$index in
|
|
182
|
+
yes,* | ,yes)
|
|
183
|
+
;;
|
|
184
|
+
yesyes*)
|
|
185
|
+
func_error "more than one action specified"
|
|
186
|
+
;;
|
|
187
|
+
*)
|
|
188
|
+
func_error "no action specified"
|
|
189
|
+
;;
|
|
190
|
+
esac
|
|
191
|
+
|
|
192
|
+
if test -n "$delete"; then
|
|
193
|
+
if test ! -f "$orig_archive"; then
|
|
194
|
+
func_error "archive not found"
|
|
195
|
+
fi
|
|
196
|
+
for member
|
|
197
|
+
do
|
|
198
|
+
case $1 in
|
|
199
|
+
@*)
|
|
200
|
+
func_at_file "${1#@}" -REMOVE "$archive"
|
|
201
|
+
;;
|
|
202
|
+
*)
|
|
203
|
+
func_file_conv "$1"
|
|
204
|
+
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
|
|
205
|
+
;;
|
|
206
|
+
esac
|
|
207
|
+
done
|
|
208
|
+
|
|
209
|
+
elif test -n "$extract"; then
|
|
210
|
+
if test ! -f "$orig_archive"; then
|
|
211
|
+
func_error "archive not found"
|
|
212
|
+
fi
|
|
213
|
+
if test $# -gt 0; then
|
|
214
|
+
for member
|
|
215
|
+
do
|
|
216
|
+
case $1 in
|
|
217
|
+
@*)
|
|
218
|
+
func_at_file "${1#@}" -EXTRACT "$archive"
|
|
219
|
+
;;
|
|
220
|
+
*)
|
|
221
|
+
func_file_conv "$1"
|
|
222
|
+
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
|
|
223
|
+
;;
|
|
224
|
+
esac
|
|
225
|
+
done
|
|
226
|
+
else
|
|
227
|
+
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
|
|
228
|
+
do
|
|
229
|
+
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
|
|
230
|
+
done
|
|
231
|
+
fi
|
|
232
|
+
|
|
233
|
+
elif test -n "$quick$replace"; then
|
|
234
|
+
if test ! -f "$orig_archive"; then
|
|
235
|
+
if test -z "$create"; then
|
|
236
|
+
echo "$me: creating $orig_archive"
|
|
237
|
+
fi
|
|
238
|
+
orig_archive=
|
|
239
|
+
else
|
|
240
|
+
orig_archive=$archive
|
|
241
|
+
fi
|
|
242
|
+
|
|
243
|
+
for member
|
|
244
|
+
do
|
|
245
|
+
case $1 in
|
|
246
|
+
@*)
|
|
247
|
+
func_file_conv "${1#@}"
|
|
248
|
+
set x "$@" "@$file"
|
|
249
|
+
;;
|
|
250
|
+
*)
|
|
251
|
+
func_file_conv "$1"
|
|
252
|
+
set x "$@" "$file"
|
|
253
|
+
;;
|
|
254
|
+
esac
|
|
255
|
+
shift
|
|
256
|
+
shift
|
|
257
|
+
done
|
|
258
|
+
|
|
259
|
+
if test -n "$orig_archive"; then
|
|
260
|
+
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
|
|
261
|
+
else
|
|
262
|
+
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
|
|
263
|
+
fi
|
|
264
|
+
|
|
265
|
+
elif test -n "$list"; then
|
|
266
|
+
if test ! -f "$orig_archive"; then
|
|
267
|
+
func_error "archive not found"
|
|
268
|
+
fi
|
|
269
|
+
$AR -NOLOGO -LIST "$archive" || exit $?
|
|
270
|
+
fi
|