Compare commits
455
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cd66ae9b3 | ||
|
|
555bcdabaa | ||
|
|
3dfc393f95 | ||
|
|
79302f3ed4 | ||
|
|
3bc38c315b | ||
|
|
7289bbb01f | ||
|
|
9c9bd0e52f | ||
|
|
98e85cd6f6 | ||
|
|
76aa4eb895 | ||
|
|
fa5a0dd27b | ||
|
|
114fb11bc4 | ||
|
|
550f8cbcb4 | ||
|
|
b265280a63 | ||
|
|
60ab1f281d | ||
|
|
ac4aa0487b | ||
|
|
9fecc8301a | ||
|
|
4b29b87c14 | ||
|
|
12f359f748 | ||
|
|
afc84c9c0c | ||
|
|
ae9a7b2085 | ||
|
|
2b5f38bbeb | ||
|
|
caf50de5e5 | ||
|
|
944fa67c30 | ||
|
|
e37ffa9ec8 | ||
|
|
7e387675ac | ||
|
|
a60987f237 | ||
|
|
f404470e0d | ||
|
|
7057b9d359 | ||
|
|
eee71c930e | ||
|
|
1a3b65117f | ||
|
|
c22a8fa9c6 | ||
|
|
6495242f54 | ||
|
|
57a59c5696 | ||
|
|
1335cb41be | ||
|
|
15f40f2b8d | ||
|
|
3e8dc1b1ad | ||
|
|
eda67d7910 | ||
|
|
a30b8adb2b | ||
|
|
c50abdc645 | ||
|
|
f9e6a021db | ||
|
|
3a7d084081 | ||
|
|
85518ff44c | ||
|
|
5436509a23 | ||
|
|
622293c64e | ||
|
|
9a13a77691 | ||
|
|
3ccd280bd0 | ||
|
|
f6f8c749f2 | ||
|
|
5eb5e197b4 | ||
|
|
f39b9296d0 | ||
|
|
a9989d3ecd | ||
|
|
21731e6824 | ||
|
|
27b8bf22bf | ||
|
|
ac9a5f2f1a | ||
|
|
1fd21cd7a5 | ||
|
|
ba6f88661f | ||
|
|
359ed0728a | ||
|
|
19a1bae289 | ||
|
|
7a4e4f9189 | ||
|
|
b477c60d6c | ||
|
|
bb0a6cc918 | ||
|
|
c5d0daa9da | ||
|
|
fc323081ad | ||
|
|
7a10d2b866 | ||
|
|
ee64e7e368 | ||
|
|
0f788c3990 | ||
|
|
6f04ecd472 | ||
|
|
177338f28a | ||
|
|
194d5f5478 | ||
|
|
4184aa05f7 | ||
|
|
97292eca03 | ||
|
|
1a69a1b16b | ||
|
|
f0c3870db0 | ||
|
|
c17a3cbb86 | ||
|
|
8d756b995e | ||
|
|
719249a2a5 | ||
|
|
4560ce79f6 | ||
|
|
3dec87b9b5 | ||
|
|
a7b114d8bb | ||
|
|
e3071a1e40 | ||
|
|
76653f5380 | ||
|
|
2f2e5bf7fe | ||
|
|
63f37f5fe2 | ||
|
|
aa45e2ed71 | ||
|
|
2f8f81b119 | ||
|
|
0daf527ddf | ||
|
|
84523d94f2 | ||
|
|
f3d651ab31 | ||
|
|
aa4d601b8e | ||
|
|
2f333ffbd6 | ||
|
|
528435f14f | ||
|
|
375592aef4 | ||
|
|
0d7c39d9f5 | ||
|
|
5db4acd816 | ||
|
|
e148d9ebd6 | ||
|
|
b828a2be6c | ||
|
|
5d04ecc4ff | ||
|
|
3df2e3f2b6 | ||
|
|
32d4848993 | ||
|
|
5e5a5bf632 | ||
|
|
c14385be08 | ||
|
|
23223aaefa | ||
|
|
7f47307dab | ||
|
|
eeae3e9859 | ||
|
|
cf1ca21d1b | ||
|
|
104df74246 | ||
|
|
ac47c2a9a0 | ||
|
|
2e06bdb4af | ||
|
|
5e814ea606 | ||
|
|
9f66386cef | ||
|
|
c33391222a | ||
|
|
8908fe4a45 | ||
|
|
227665312b | ||
|
|
284001d4c1 | ||
|
|
0714d2e783 | ||
|
|
4ef1759bd4 | ||
|
|
f796720f63 | ||
|
|
fe2f20a49a | ||
|
|
bf7f36b707 | ||
|
|
6749446c59 | ||
|
|
901b798b69 | ||
|
|
27163edbd9 | ||
|
|
cfe89fdc3c | ||
|
|
fd2cbb82c9 | ||
|
|
79ddf1ad98 | ||
|
|
966a66c78a | ||
|
|
f8f38b6075 | ||
|
|
e05ba11196 | ||
|
|
7f8898c853 | ||
|
|
b54bece30d | ||
|
|
705cc95d7f | ||
|
|
1f7d55cffb | ||
|
|
bc772aa9a3 | ||
|
|
383dc0f7ae | ||
|
|
961cc44049 | ||
|
|
4e318dabf0 | ||
|
|
7583aeb55f | ||
|
|
be62792593 | ||
|
|
644e9b70bd | ||
|
|
cb0b6f65ac | ||
|
|
71237bdb1c | ||
|
|
a75aec0b99 | ||
|
|
7c66ae09b7 | ||
|
|
a32f9a0127 | ||
|
|
a92c3148f6 | ||
|
|
8c5d2e378e | ||
|
|
3f3a39168c | ||
|
|
d2fe82a6b4 | ||
|
|
62aed5f014 | ||
|
|
ff08b85528 | ||
|
|
5341906d83 | ||
|
|
3564d6f7a9 | ||
|
|
58a756460a | ||
|
|
cf06502b17 | ||
|
|
e9caa7dc23 | ||
|
|
df9a91a267 | ||
|
|
23305900c5 | ||
|
|
7a87f7405f | ||
|
|
2daaf38cb3 | ||
|
|
3497515a94 | ||
|
|
683fc6cea7 | ||
|
|
bc588849f8 | ||
|
|
8a6b579029 | ||
|
|
574b4d9b3c | ||
|
|
656c6b4fdd | ||
|
|
0c1a3360fa | ||
|
|
3119d39deb | ||
|
|
2de5816f04 | ||
|
|
363f1a1b07 | ||
|
|
a3ec9dc89e | ||
|
|
9320303fb3 | ||
|
|
8aa5b1bdec | ||
|
|
0875ee2467 | ||
|
|
6357c6370b | ||
|
|
e9d1116c79 | ||
|
|
47b131303f | ||
|
|
8396a9a6c1 | ||
|
|
0d631bf0a0 | ||
|
|
d3aa0f4f93 | ||
|
|
86411a3611 | ||
|
|
c8ece33fc9 | ||
|
|
f68f6dec50 | ||
|
|
98b5f5fc5a | ||
|
|
f2a2bf4ca6 | ||
|
|
56151b85aa | ||
|
|
e9045bc6e9 | ||
|
|
2aad8e8de3 | ||
|
|
9da2466609 | ||
|
|
047facb618 | ||
|
|
988d862a9e | ||
|
|
69e9fd39a5 | ||
|
|
b7b50c245d | ||
|
|
f495235196 | ||
|
|
797ff2687c | ||
|
|
6986f4998c | ||
|
|
6f84e2f6c4 | ||
|
|
47f8e708c6 | ||
|
|
aab02fc335 | ||
|
|
c91b7c2de1 | ||
|
|
7101b7f1be | ||
|
|
cfb2ecbc41 | ||
|
|
f6f5d2bb19 | ||
|
|
6594b7d1ab | ||
|
|
af371d50ba | ||
|
|
601232f730 | ||
|
|
ab8d2dc2a7 | ||
|
|
205c1c5891 | ||
|
|
50eaed3ae5 | ||
|
|
b8a9a5ae6e | ||
|
|
7735c35f16 | ||
|
|
6389d5d718 | ||
|
|
0e72048685 | ||
|
|
d8f42d74bf | ||
|
|
969411f8ef | ||
|
|
9633e297d8 | ||
|
|
1149e81c2b | ||
|
|
641f10688e | ||
|
|
19d395197d | ||
|
|
4ffc81c99f | ||
|
|
bbdc62f691 | ||
|
|
60f90b60ba | ||
|
|
ce935d7455 | ||
|
|
de63b5721f | ||
|
|
9311f0d61c | ||
|
|
bdea945ca7 | ||
|
|
62c9d75020 | ||
|
|
f9a56161ed | ||
|
|
54178656e8 | ||
|
|
a12a522410 | ||
|
|
f8fa944cd8 | ||
|
|
d0b70f096d | ||
|
|
eac0bd7141 | ||
|
|
167843a5f8 | ||
|
|
c0da465f74 | ||
|
|
30ef3a7ce8 | ||
|
|
e218cc3061 | ||
|
|
b3167cb78b | ||
|
|
91ccdad497 | ||
|
|
b42b5e68be | ||
|
|
2a10494b8a | ||
|
|
15d8b2ffaf | ||
|
|
57fcff35c5 | ||
|
|
0d21ae733e | ||
|
|
81fd78e81e | ||
|
|
cc3297fe2c | ||
|
|
85ce881011 | ||
|
|
0d813b41a0 | ||
|
|
15addc8105 | ||
|
|
655789e5ae | ||
|
|
1b39ad1ab2 | ||
|
|
583131153e | ||
|
|
e8e85732d0 | ||
|
|
fef4d9961b | ||
|
|
3ea3e2e15c | ||
|
|
94613e81e3 | ||
|
|
2d5dd862e5 | ||
|
|
77755e5a36 | ||
|
|
d17880fce2 | ||
|
|
d445beaac3 | ||
|
|
91d5162be4 | ||
|
|
cd5f0ede27 | ||
|
|
c35c23ef2c | ||
|
|
fe09a71580 | ||
|
|
6a244e1368 | ||
|
|
86a13f2756 | ||
|
|
84c921ebbf | ||
|
|
2eafce19bb | ||
|
|
94ebabcca8 | ||
|
|
abc6c2d46c | ||
|
|
72e2393bcf | ||
|
|
7458db97ed | ||
|
|
f4601fc86a | ||
|
|
064a9093d5 | ||
|
|
ff400de5bc | ||
|
|
664b096e52 | ||
|
|
4359051d4a | ||
|
|
02b1c043c1 | ||
|
|
5f12f27335 | ||
|
|
e7eaa8e753 | ||
|
|
784cef9f63 | ||
|
|
803127cf52 | ||
|
|
2fd6ac9538 | ||
|
|
2c96eab4b3 | ||
|
|
773f97f0b7 | ||
|
|
f24df1dfbd | ||
|
|
94c5e1ce7e | ||
|
|
33b14a50c9 | ||
|
|
f60c7521c7 | ||
|
|
0be18d4a9f | ||
|
|
d4d0ff19a2 | ||
|
|
510105d51f | ||
|
|
9dbbc39c65 | ||
|
|
dd48e47d98 | ||
|
|
12a60d54e9 | ||
|
|
6be45c9bcf | ||
|
|
b74e1e1020 | ||
|
|
66e80b31aa | ||
|
|
100917541f | ||
|
|
288b4b75c8 | ||
|
|
39bbd66193 | ||
|
|
6497d02b28 | ||
|
|
8f06f47fc9 | ||
|
|
fddaf96f67 | ||
|
|
3a3e32760b | ||
|
|
0e863c5bd1 | ||
|
|
8a555be07b | ||
|
|
7e624c997a | ||
|
|
88d18b7342 | ||
|
|
aa24163cca | ||
|
|
ab7421e9e4 | ||
|
|
76742cd93b | ||
|
|
27a3fc6356 | ||
|
|
84b0909170 | ||
|
|
c272b2535d | ||
|
|
af971ccea4 | ||
|
|
bf70bcaedf | ||
|
|
b502b8d32f | ||
|
|
527c019c0f | ||
|
|
f7ad93dec0 | ||
|
|
c4ef9f0efc | ||
|
|
b183666a08 | ||
|
|
e6512ce080 | ||
|
|
24935f654f | ||
|
|
98d33929de | ||
|
|
fde2c48986 | ||
|
|
f29aa6ba0d | ||
|
|
39b592d3b8 | ||
|
|
23397f5913 | ||
|
|
ba57e54d5c | ||
|
|
acda2974bf | ||
|
|
ad81191667 | ||
|
|
27754bc698 | ||
|
|
0033b6312f | ||
|
|
ca93874026 | ||
|
|
4937a24a0b | ||
|
|
9e21e8d36d | ||
|
|
365a16a564 | ||
|
|
53bf680ef4 | ||
|
|
7acf0bc422 | ||
|
|
5d1d643a0c | ||
|
|
6bbb37ca07 | ||
|
|
ee548255f4 | ||
|
|
c6b54cb045 | ||
|
|
194089bcba | ||
|
|
95e78e880c | ||
|
|
8882068501 | ||
|
|
8870247fae | ||
|
|
102aad8394 | ||
|
|
aee865386f | ||
|
|
1cae649d7b | ||
|
|
84a293950f | ||
|
|
ddbf40f6e4 | ||
|
|
f93029f2c2 | ||
|
|
ee898650ba | ||
|
|
6085bbc949 | ||
|
|
9d55f53860 | ||
|
|
1730a680b4 | ||
|
|
11e307fc0d | ||
|
|
e6ecff7006 | ||
|
|
6e3d640c1a | ||
|
|
05e52e11bf | ||
|
|
1624c4446f | ||
|
|
28cd6ec1ca | ||
|
|
c753e0cf10 | ||
|
|
212c04557f | ||
|
|
64ead975b8 | ||
|
|
dcf32cbf17 | ||
|
|
18759849e7 | ||
|
|
0c244dab90 | ||
|
|
d1ab0c71f5 | ||
|
|
c377d5c799 | ||
|
|
16bd9d27de | ||
|
|
9cf3b56cf0 | ||
|
|
84f3acc5aa | ||
|
|
ddaf96805c | ||
|
|
8ad11c21e5 | ||
|
|
7fa0d95f25 | ||
|
|
10f8d01b8d | ||
|
|
c52a39850c | ||
|
|
ad2d53d15a | ||
|
|
a201a75498 | ||
|
|
256b43c6f9 | ||
|
|
261b8e66a6 | ||
|
|
2d0525257a | ||
|
|
d84dd57127 | ||
|
|
1b2e841502 | ||
|
|
ee66264a6a | ||
|
|
abd804a552 | ||
|
|
a6c557855e | ||
|
|
06d492b8f6 | ||
|
|
fa306af477 | ||
|
|
7a2f606c48 | ||
|
|
1a631cebfe | ||
|
|
df32d17a25 | ||
|
|
39da57cf6b | ||
|
|
f7ffbfb6ce | ||
|
|
55b4808666 | ||
|
|
9437acb2c3 | ||
|
|
0af845c324 | ||
|
|
26fd41b56e | ||
|
|
82419fb435 | ||
|
|
c06af2d15b | ||
|
|
ced4499bf8 | ||
|
|
6ccdffe221 | ||
|
|
08f3c80fae | ||
|
|
0ecd6682c7 | ||
|
|
79909cbed9 | ||
|
|
79bc4818c7 | ||
|
|
a57543c950 | ||
|
|
0e518017d3 | ||
|
|
10714e3215 | ||
|
|
45cb65e2ca | ||
|
|
336165fc96 | ||
|
|
f8c711dd94 | ||
|
|
378233570b | ||
|
|
f230094d58 | ||
|
|
0fdc183551 | ||
|
|
722ed6c403 | ||
|
|
51d8182047 | ||
|
|
3339248b47 | ||
|
|
b5a5940b6b | ||
|
|
e726b3d0ba | ||
|
|
b490f97987 | ||
|
|
534d1824e5 | ||
|
|
e1a8244b92 | ||
|
|
3020cc66de | ||
|
|
c9a4d3335c | ||
|
|
bafa32f146 | ||
|
|
c776d5994c | ||
|
|
e4455d7193 | ||
|
|
57647bb05b | ||
|
|
4f4f636598 | ||
|
|
261c49ebf5 | ||
|
|
7627a1d5da | ||
|
|
9cb5c191b4 | ||
|
|
6ae50e517f | ||
|
|
8e9246992c | ||
|
|
7faf465af5 | ||
|
|
208f2debbf | ||
|
|
7412a4c50c | ||
|
|
bef99ccff3 | ||
|
|
06a8525837 | ||
|
|
06db1d29af | ||
|
|
266f989e52 | ||
|
|
1307d34b55 | ||
|
|
18d7334fbe | ||
|
|
96d39a0834 | ||
|
|
7607ce36db | ||
|
|
17e40a7de6 | ||
|
|
31551749e4 | ||
|
|
c2dc898a01 | ||
|
|
325ed27f32 | ||
|
|
fb772b1c67 | ||
|
|
ef27ca91b6 | ||
|
|
7137c4b7e2 | ||
|
|
baa023b914 |
@@ -1,62 +0,0 @@
|
||||
version: 2.1
|
||||
jobs:
|
||||
build:
|
||||
macos:
|
||||
xcode: 12.3.0
|
||||
steps:
|
||||
- checkout:
|
||||
path: ~/LIEF
|
||||
- restore_cache:
|
||||
keys:
|
||||
- ccache-{{ arch }}-{{ .Branch }}
|
||||
- ccache-{{ arch }}-master
|
||||
- ccache-{{ arch }}
|
||||
- pyenv
|
||||
- run:
|
||||
name: Install pyenv
|
||||
command: |
|
||||
brew install pyenv
|
||||
pyenv root
|
||||
pyenv install --list
|
||||
- run:
|
||||
name: Install ccache
|
||||
command: brew install ccache
|
||||
- run:
|
||||
name: Install ninja
|
||||
command: brew install ninja
|
||||
- run:
|
||||
name: CCache initialization
|
||||
command: |
|
||||
ccache --show-stats
|
||||
ccache --zero-stats
|
||||
ccache --max-size=10.0G
|
||||
ccache --set-config=compiler_check=content
|
||||
- run:
|
||||
name: LIEF build setup
|
||||
command: |
|
||||
export PYTHON_CONFIGURE_OPTS="--enable-shared --enable-unicode=ucs2"
|
||||
pyenv install --skip-existing 3.9.0
|
||||
export PYTHON_BINARY=$(pyenv root)/versions/3.9.0/bin/python3.9
|
||||
$PYTHON_BINARY -m pip install --upgrade pip setuptools wheel
|
||||
$PYTHON_BINARY ./setup.py --ninja --lief-test build bdist_wheel
|
||||
bash scripts/osx/package_sdk.sh
|
||||
- run:
|
||||
name: LIEF deploy
|
||||
command: |
|
||||
export PYTHON_BINARY=$(pyenv root)/versions/3.9.0/bin/python3.9
|
||||
$PYTHON_BINARY -m pip install --upgrade requests mako
|
||||
$PYTHON_BINARY .github/deploy.py
|
||||
- run:
|
||||
name: ccache stats
|
||||
when: always
|
||||
command: |
|
||||
ccache --show-stats
|
||||
- save_cache:
|
||||
key: 'ccache-{{ arch }}-{{ .Branch }}'
|
||||
paths: [ "/home/circleci/.ccache" ]
|
||||
- save_cache:
|
||||
key: 'pyenv'
|
||||
paths: [ "/home/circleci/.pyenv" ]
|
||||
|
||||
|
||||
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
Checks: >
|
||||
-*,
|
||||
bugprone-*,
|
||||
google-*,
|
||||
misc-*,
|
||||
modernize-*,
|
||||
performance-*,
|
||||
portability-*,
|
||||
readability-*,
|
||||
cppcoreguidelines-*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-narrowing-conversions,
|
||||
-google-readability-namespace-comments,
|
||||
-google-readability-todo,
|
||||
-google-runtime-int,
|
||||
-google-default-arguments
|
||||
-google-runtime-references,
|
||||
-misc-non-private-member-variables-in-classes,
|
||||
-modernize-use-trailing-return-type,
|
||||
-performance-noexcept-move-constructor,
|
||||
-readability-function-cognitive-complexity,
|
||||
-readability-inconsistent-declaration-parameter-name,
|
||||
-readability-magic-numbers,
|
||||
-readability-named-parameter,
|
||||
-readability-redundant-string-cstr
|
||||
-readability-uppercase-literal-suffix,
|
||||
|
||||
# Turn all the warnings from the checks above into errors.
|
||||
#WarningsAsErrors: "*"
|
||||
UseColor: false
|
||||
|
||||
CheckOptions:
|
||||
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
|
||||
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ }
|
||||
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
|
||||
@@ -1 +0,0 @@
|
||||
build
|
||||
@@ -0,0 +1 @@
|
||||
github: [romainthomas]
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
*Please describe what you would like to have in LIEF*.
|
||||
|
||||
**Note: If the feature is not precise or if you want to have feedback first, you can open a [discussion](https://github.com/lief-project/LIEF/discussions).**
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
name: Premium Issue
|
||||
about: You need a fix for the issue with a high priority
|
||||
title: ''
|
||||
labels: Premium
|
||||
assignees: romainthomas
|
||||
|
||||
---
|
||||
|
||||
*Premium issues can be used to get a higher priority resolution for users and companies.*
|
||||
*In return, you need to contribute to the project with an action:*
|
||||
|
||||
- Writing a guest blog post here: https://lief-project.github.io/blog/
|
||||
- Fixing another issue
|
||||
- Sponsoring the issue
|
||||
|
||||
*Premium issues will be highlighted in the changelog and the release blog post with your name/logo*
|
||||
|
||||
----------------------------------
|
||||
|
||||
**Description**
|
||||
|
||||
*Please describe the issue/request that needs to be addressed*
|
||||
|
||||
**Context**
|
||||
|
||||
*Please provide the version of LIEF, the operating system as well as the binaries associated with the issue
|
||||
(it can be sent by email as well)*
|
||||
|
||||
----------------------------------
|
||||
|
||||
|
||||
**Reach out to `issue@lief.re` to discuss about the timeline/contribution.**
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
name: Regular Issue
|
||||
about: You identified a bug or a problem in LIEF
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: romainthomas
|
||||
@@ -14,7 +14,7 @@ A clear and concise description of what the bug is.
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
A clear and concise description of what you expected to happen (if applicable)
|
||||
|
||||
**Environment (please complete the following information):**
|
||||
- System and Version : [e.g. Ubuntu 16.04]
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<title>Links for lief</title>
|
||||
<body>
|
||||
<h1>Links for lief</h1>
|
||||
% for path, filename in files:
|
||||
<a href="/${path}">${filename}</a><br />
|
||||
% endfor
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,9 @@
|
||||
[lief.s3]
|
||||
region = "fr-par"
|
||||
bucket = "lief"
|
||||
endpoint = "https://s3.fr-par.scw.cloud"
|
||||
|
||||
[lief.deploy]
|
||||
branches = ["master", "deploy", "devel"]
|
||||
main-branches = ["master", "main"]
|
||||
default-dir = "latest"
|
||||
+260
-239
@@ -1,277 +1,298 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import logging
|
||||
import pathlib
|
||||
import subprocess
|
||||
import shutil
|
||||
import json
|
||||
import itertools
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
from mako.template import Template
|
||||
from enum import Enum, auto
|
||||
import tempfile
|
||||
import boto3
|
||||
from botocore.exceptions import ClientError
|
||||
from mako.template import Template
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
|
||||
class CI(Enum):
|
||||
UNKNOWN = auto()
|
||||
TRAVIS = auto()
|
||||
APPVEYOR = auto()
|
||||
GITLAB_CI = auto()
|
||||
CIRCLE_CI = auto()
|
||||
GITHUB_ACTIONS = auto()
|
||||
AZURE = auto()
|
||||
LOCAL = auto()
|
||||
|
||||
def pretty_ci_name(ci):
|
||||
return str(ci).split(".")[-1].replace("_", "-").lower()
|
||||
|
||||
def is_pr(ci):
|
||||
if ci == CI.TRAVIS:
|
||||
cond1 = os.getenv("TRAVIS_EVENT_TYPE", "pull_request") == "pull_request"
|
||||
cond2 = not (os.getenv("TRAVIS_REPO_SLUG", "").startswith("lief-project/") or os.getenv("TRAVIS_REPO_SLUG", "").startswith("romainthomas/LIEF"))
|
||||
return cond1 or cond2
|
||||
elif ci == CI.APPVEYOR:
|
||||
logger.info("%s - %s", os.getenv("APPVEYOR_PULL_REQUEST_NUMBER", -1), os.getenv("APPVEYOR_REPO_NAME", ""))
|
||||
pr_number = os.getenv("APPVEYOR_PULL_REQUEST_NUMBER", "")
|
||||
cond1 = len(pr_number) != 0 and int(pr_number) >= 0
|
||||
cond2 = not (os.getenv("APPVEYOR_REPO_NAME", "").startswith("lief-project/") or os.getenv("APPVEYOR_REPO_NAME", "").startswith("romainthomas/"))
|
||||
return cond1 or cond2
|
||||
elif ci == CI.CIRCLE_CI:
|
||||
cond1 = int(os.getenv("CIRCLE_PR_NUMBER", -1)) >= 0
|
||||
cond2 = os.getenv("CIRCLE_PROJECT_USERNAME", "") != "lief-project" and os.getenv("CIRCLE_PROJECT_USERNAME", "") != "romainthomas"
|
||||
return cond1 or cond2
|
||||
elif ci == CI.GITHUB_ACTIONS:
|
||||
cond1 = os.getenv("GITHUB_HEAD_REF", "") != ""
|
||||
cond2 = not (os.getenv("GITHUB_REPOSITORY", "").startswith("lief-project/") or os.getenv("GITHUB_REPOSITORY", "").startswith("romainthomas/LIEF"))
|
||||
return cond1 or cond2
|
||||
elif ci == CI.LOCAL:
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_branch(ci):
|
||||
if ci == CI.TRAVIS:
|
||||
return os.getenv("TRAVIS_BRANCH")
|
||||
elif ci == CI.APPVEYOR:
|
||||
return os.getenv("APPVEYOR_REPO_BRANCH")
|
||||
elif ci == CI.CIRCLE_CI:
|
||||
return os.getenv("CIRCLE_BRANCH")
|
||||
elif ci == CI.GITHUB_ACTIONS:
|
||||
return os.getenv("GITHUB_REF").replace("refs/heads/", "")
|
||||
elif ci == CI.LOCAL:
|
||||
return os.getenv("CI_BRANCH")
|
||||
return None
|
||||
|
||||
def get_ci_workdir(ci):
|
||||
if ci == CI.CIRCLE_CI:
|
||||
return os.getenv("CIRCLE_WORKING_DIRECTORY")
|
||||
elif ci == CI.TRAVIS:
|
||||
return os.getenv("TRAVIS_BUILD_DIR")
|
||||
elif ci == CI.APPVEYOR:
|
||||
return os.getenv("APPVEYOR_BUILD_FOLDER")
|
||||
elif ci == CI.GITHUB_ACTIONS:
|
||||
return os.getenv("GITHUB_WORKSPACE")
|
||||
elif ci == CI.LOCAL:
|
||||
return os.getenv("CI_WORKING_DIR")
|
||||
else:
|
||||
logger.critical("Unsupported CI to resolve working directory")
|
||||
sys.exit(1)
|
||||
|
||||
def get_tag(ci):
|
||||
if ci == CI.CIRCLE_CI:
|
||||
return os.getenv("CIRCLE_TAG", "")
|
||||
elif ci == CI.TRAVIS:
|
||||
return os.getenv("TRAVIS_TAG", "")
|
||||
elif ci == CI.APPVEYOR:
|
||||
if "APPVEYOR_REPO_TAG_NAME" in os.environ:
|
||||
return os.getenv("APPVEYOR_REPO_TAG_NAME", "")
|
||||
return ""
|
||||
elif ci == CI.GITHUB_ACTIONS:
|
||||
ref = os.getenv("GITHUB_REF", "")
|
||||
logger.info("Github Action tag: {}".format(ref))
|
||||
if ref.startswith("refs/tags/"):
|
||||
return ref.replace("refs/tags/", "")
|
||||
return ""
|
||||
elif ci == CI.LOCAL:
|
||||
return os.getenv("CI_TAG")
|
||||
else:
|
||||
logger.critical("Unsupported CI to resolve working directory")
|
||||
sys.exit(1)
|
||||
import argparse
|
||||
import boto3
|
||||
import functools
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import tomli
|
||||
|
||||
LOG_LEVEL = logging.INFO
|
||||
|
||||
CURRENTDIR = Path(__file__).resolve().parent
|
||||
REPODIR = CURRENTDIR.parent
|
||||
ASSET_DIR = CURRENTDIR / "assets"
|
||||
CONFIG_DIR = CURRENTDIR / "config"
|
||||
LIEF_S3_KEY = os.getenv("LIEF_S3_KEY", None)
|
||||
LIEF_S3_SECRET = os.getenv("LIEF_S3_SECRET", None)
|
||||
OWNED_ORGS = ["lief-project/", "romainthomas/"]
|
||||
RELEASE_KEYWRD = "release-"
|
||||
|
||||
DEFAULT_CONFIG = CONFIG_DIR / "gh-ci.toml"
|
||||
DEFAULT_TEMPLATE = (ASSET_DIR / "index.j2").read_text()
|
||||
|
||||
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
|
||||
logging.getLogger().setLevel(LOG_LEVEL)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
CURRENT_CI = CI.UNKNOWN
|
||||
|
||||
# Detect CI
|
||||
# ===========================================
|
||||
if os.getenv("TRAVIS", None) is not None:
|
||||
CURRENT_CI = CI.TRAVIS
|
||||
elif os.getenv("APPVEYOR", None) is not None:
|
||||
CURRENT_CI = CI.APPVEYOR
|
||||
elif os.getenv("GITHUB_ACTIONS", None) is not None:
|
||||
CURRENT_CI = CI.GITHUB_ACTIONS
|
||||
elif os.getenv("GITLAB_CI", None) is not None:
|
||||
CURRENT_CI = CI.GITLAB_CI
|
||||
elif os.getenv("CI_LOCAL", "") == "true":
|
||||
CURRENT_CI = CI.LOCAL
|
||||
else:
|
||||
logger.error("Can't detect CI!")
|
||||
sys.exit(1)
|
||||
|
||||
CI_PRETTY_NAME = pretty_ci_name(CURRENT_CI)
|
||||
logger.info("CI: %s", CI_PRETTY_NAME)
|
||||
|
||||
ALLOWED_BRANCHES = {"master", "deploy", "devel"}
|
||||
BRANCH_NAME = get_branch(CURRENT_CI)
|
||||
TAG_NAME = get_tag(CURRENT_CI)
|
||||
IS_TAGGED = TAG_NAME is not None and len(TAG_NAME) > 0
|
||||
|
||||
logger.info("Branch: %s", BRANCH_NAME)
|
||||
logger.info("Tag: %s", TAG_NAME)
|
||||
|
||||
if BRANCH_NAME.startswith("release-"):
|
||||
logger.info("Branch release")
|
||||
elif BRANCH_NAME not in ALLOWED_BRANCHES and not IS_TAGGED:
|
||||
logger.info("Skip deployment for branch '%s'", BRANCH_NAME)
|
||||
sys.exit(0)
|
||||
|
||||
if is_pr(CURRENT_CI):
|
||||
logger.info("Skip pull request")
|
||||
sys.exit(0)
|
||||
|
||||
CURRENTDIR = pathlib.Path(__file__).resolve().parent
|
||||
REPODIR = CURRENTDIR.parent
|
||||
|
||||
# According to Scaleway S3 documentation, the endpoint
|
||||
# should starts with '<bucket>'.s3.<region>.scw.cloud
|
||||
# Nevertheless boto3 uses /{Bucket} endpoints suffix
|
||||
# which create issues (see: https://stackoverflow.com/a/70383653)
|
||||
LIEF_S3_REGION = "fr-par"
|
||||
LIEF_S3_ENDPOINT = "https://s3.{region}.scw.cloud".format(region=LIEF_S3_REGION)
|
||||
LIEF_S3_BUCKET = "lief"
|
||||
LIEF_S3_KEY = os.getenv("LIEF_S3_KEY", None)
|
||||
LIEF_S3_SECRET = os.getenv("LIEF_S3_SECRET", None)
|
||||
|
||||
if LIEF_S3_KEY is None or len(LIEF_S3_KEY) == 0:
|
||||
logger.error("LIEF_S3_KEY is not set!")
|
||||
sys.exit(1)
|
||||
|
||||
if LIEF_S3_SECRET is None or len(LIEF_S3_SECRET) == 0:
|
||||
logger.error("LIEF_S3_SECRET is not set!")
|
||||
sys.exit(1)
|
||||
|
||||
CI_CWD = pathlib.Path(get_ci_workdir(CURRENT_CI))
|
||||
class S3Manager:
|
||||
def __init__(self, dirname: str, bucket: str,
|
||||
region: str, endpoint: str,
|
||||
dry_run: bool = False):
|
||||
self._s3_dirname: str = dirname
|
||||
self._s3_bucket: str = bucket
|
||||
self._s3_region: str = region
|
||||
self._s3_endpoint: str = endpoint
|
||||
self._dry_run: bool = dry_run
|
||||
|
||||
if CI_CWD is None:
|
||||
logger.error("Can't resolve CI working dir")
|
||||
sys.exit(1)
|
||||
logger.info("[S3] Bucket : %s", self._s3_bucket)
|
||||
logger.info("[S3] Region : %s", self._s3_region)
|
||||
logger.info("[S3] Endpoint: %s", self._s3_endpoint)
|
||||
logger.info("[S3] Dir : %s", self._s3_dirname)
|
||||
|
||||
DIST_DIR = REPODIR / "dist"
|
||||
BUILD_DIR = REPODIR / "build"
|
||||
def change_dir(self, dirname: str):
|
||||
self._s3_dirname = dirname
|
||||
|
||||
logger.info("Working directory: %s", CI_CWD)
|
||||
@property
|
||||
def s3_lief_sdk(self) -> str:
|
||||
return f"{self._s3_dirname}/sdk"
|
||||
|
||||
INDEX_TEMPLATE = r"""
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<title>Links for lief</title>
|
||||
<body>
|
||||
<h1>Links for lief</h1>
|
||||
% for path, filename in files:
|
||||
<a href="/${path}">${filename}</a><br />
|
||||
% endfor
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
@property
|
||||
def s3_lief_wheel(self) -> str:
|
||||
return f"{self._s3_dirname}/lief"
|
||||
|
||||
SKIP_LIST = ["index.html"]
|
||||
@property
|
||||
def url(self):
|
||||
return f"https://{self._s3_bucket}.s3-website.{self._s3_region}.scw.cloud/{self._s3_dirname}"
|
||||
|
||||
s3 = boto3.resource(
|
||||
's3',
|
||||
region_name=LIEF_S3_REGION,
|
||||
use_ssl=True,
|
||||
endpoint_url=LIEF_S3_ENDPOINT,
|
||||
aws_access_key_id=LIEF_S3_KEY,
|
||||
aws_secret_access_key=LIEF_S3_SECRET
|
||||
)
|
||||
@functools.lru_cache(maxsize=1)
|
||||
def s3(self) -> boto3.Session:
|
||||
s3_res = boto3.resource(
|
||||
's3',
|
||||
region_name=self._s3_region,
|
||||
use_ssl=True,
|
||||
endpoint_url=self._s3_endpoint,
|
||||
aws_access_key_id=LIEF_S3_KEY,
|
||||
aws_secret_access_key=LIEF_S3_SECRET
|
||||
)
|
||||
return s3_res
|
||||
|
||||
@classmethod
|
||||
def from_config(cls, config):
|
||||
pass
|
||||
|
||||
def _s3_push(self, file: Path, dst: str):
|
||||
logger.info("Uploading %s to %s", file, dst)
|
||||
try:
|
||||
obj = self.s3().Object(self._s3_bucket, dst)
|
||||
if not self._dry_run:
|
||||
obj.put(Body=file.read_bytes())
|
||||
else:
|
||||
logger.info("[--] put: %s/%s - %s", self._s3_bucket, dst, file.as_posix())
|
||||
return 0
|
||||
except ClientError as e:
|
||||
logger.error("S3 push failed: %s", e)
|
||||
return 1
|
||||
|
||||
def push_wheel(self, file: str):
|
||||
wheel_file = Path(file)
|
||||
if not wheel_file.is_file():
|
||||
logger.error("'%s' is not a valid file!", wheel_file)
|
||||
return
|
||||
|
||||
dst = f"{self.s3_lief_wheel}/{wheel_file.name}"
|
||||
self._s3_push(wheel_file, dst)
|
||||
|
||||
def push_sdk(self, file: str):
|
||||
sdk_path = Path(file)
|
||||
if not sdk_path.is_file():
|
||||
logger.error("'%s' is not a valid file!", sdk_path)
|
||||
return
|
||||
|
||||
dst = f"{self.s3_lief_sdk}/{sdk_path.name}"
|
||||
self._s3_push(sdk_path, dst)
|
||||
|
||||
def push_content(self, content: str, dst: str):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tmp_path = Path(tmp)
|
||||
index = tmp_path / "index.html"
|
||||
index.write_text(content)
|
||||
self._s3_push(index, dst)
|
||||
|
||||
def process_sdk_wheels(self, directory: Path, maxdepth: int = 0,
|
||||
depth: int = 0, recurse: bool = True):
|
||||
logger.info("Processing directory: %s", directory)
|
||||
for item in directory.iterdir():
|
||||
if item.is_dir() and recurse:
|
||||
if 0 < maxdepth < depth:
|
||||
logger.debug("Maximum iteration depth reached")
|
||||
else:
|
||||
self.process_sdk_wheels(item, maxdepth, depth + 1, recurse)
|
||||
elif item.is_file():
|
||||
extension = item.suffix
|
||||
if extension in (".zip", ".gz"):
|
||||
logger.info("[SDK ] Uploading '%s'", item.as_posix())
|
||||
self.push_sdk(item.as_posix())
|
||||
elif extension in (".whl", ):
|
||||
logger.info("[WHEEL] Uploading '%s'", item.as_posix())
|
||||
self.push_wheel(item.as_posix())
|
||||
|
||||
|
||||
def push_wheel(file: str, dir_name: str):
|
||||
wheel_file = pathlib.Path(file)
|
||||
dst = f"{dir_name}/lief/{wheel_file.name}"
|
||||
logger.info("Uploading %s to %s", file, dst)
|
||||
try:
|
||||
obj = s3.Object(LIEF_S3_BUCKET, dst)
|
||||
obj.put(Body=wheel_file.read_bytes())
|
||||
return 0
|
||||
except ClientError as e:
|
||||
logger.error("S3 push failed: %s", e)
|
||||
return 1
|
||||
def upload_wheels_sdk(self, src_dir: Path, maxdepth: int):
|
||||
logger.info("Looking for wheels and sdk from: %s", src_dir)
|
||||
self.process_sdk_wheels(src_dir, maxdepth=maxdepth, recurse=True)
|
||||
|
||||
wheels_index = self.generate_index(self.s3_lief_wheel,
|
||||
DEFAULT_TEMPLATE,
|
||||
skiplist=("index.html", ))
|
||||
|
||||
sdk_index = self.generate_index(self.s3_lief_sdk, DEFAULT_TEMPLATE,
|
||||
skiplist=("index.html", ))
|
||||
|
||||
self.push_content(wheels_index, f"{self.s3_lief_wheel}/index.html")
|
||||
self.push_content(sdk_index, f"{self.s3_lief_sdk}/index.html")
|
||||
|
||||
logger.info("Done!")
|
||||
logger.info("URL: %s/%s", self.url, "sdk")
|
||||
logger.info("URL: %s/%s", self.url, "lief")
|
||||
|
||||
def s3_list(self, dirname: str) -> list[Any]:
|
||||
if self._dry_run:
|
||||
return []
|
||||
return self.s3().Bucket(self._s3_bucket).objects.filter(Prefix=dirname)
|
||||
|
||||
def generate_index(self, dirname: str, template: str, skiplist=None):
|
||||
files = self.s3_list(dirname)
|
||||
selected_files = []
|
||||
for s3_object in files:
|
||||
filename = Path(s3_object.key).name
|
||||
if skiplist is not None and filename in skiplist:
|
||||
continue
|
||||
selected_files.append((s3_object.key, filename))
|
||||
return Template(template).render(files=selected_files)
|
||||
|
||||
class GithubDeploy:
|
||||
def __init__(self, branches: list[str],
|
||||
main_branches: list[str],
|
||||
default_dir: str,
|
||||
s3_manager: S3Manager):
|
||||
self.s3_manager: S3Manager = s3_manager
|
||||
|
||||
self._branches: list[str] = branches
|
||||
self._main_branches: list[str] = main_branches
|
||||
self._default_dir: str = default_dir
|
||||
|
||||
|
||||
def push_sdk(file: str, dir_name: str):
|
||||
sdk_file = pathlib.Path(file)
|
||||
dst = f"{dir_name}/sdk/{sdk_file.name}"
|
||||
logger.info("Uploading %s to %s", file, dst)
|
||||
try:
|
||||
obj = s3.Object(LIEF_S3_BUCKET, dst)
|
||||
obj.put(Body=sdk_file.read_bytes())
|
||||
return 0
|
||||
except ClientError as e:
|
||||
logger.error("S3 push failed: %s", e)
|
||||
return 1
|
||||
@classmethod
|
||||
def from_config(cls, config_file: Path):
|
||||
with open(config_file, "rb") as f:
|
||||
toml_config = tomli.load(f)
|
||||
|
||||
def filename(object):
|
||||
return pathlib.Path(object.key).name
|
||||
if "lief" not in toml_config:
|
||||
logger.warning("Missing lief entries in '%s'", config_file)
|
||||
return None
|
||||
lief_conf = toml_config["lief"]
|
||||
|
||||
def generate_sdk_index(dir_name: str):
|
||||
files = s3.Bucket(LIEF_S3_BUCKET).objects.filter(Prefix=f'{dir_name}/sdk')
|
||||
tmpl_info = [(object.key, filename(object)) for object in files if filename(object) not in SKIP_LIST]
|
||||
html = Template(INDEX_TEMPLATE).render(files=tmpl_info)
|
||||
return html
|
||||
if "s3" not in lief_conf:
|
||||
logger.warning("Missing lief.s3 entries in '%s'", config_file)
|
||||
return None
|
||||
|
||||
def generate_pypi_index(dir_name: str):
|
||||
files = s3.Bucket(LIEF_S3_BUCKET).objects.filter(Prefix=f'{dir_name}/lief')
|
||||
tmpl_info = [(object.key, filename(object)) for object in files if filename(object) not in SKIP_LIST]
|
||||
html = Template(INDEX_TEMPLATE).render(files=tmpl_info)
|
||||
return html
|
||||
if "deploy" not in lief_conf:
|
||||
logger.warning("Missing lief.deploy entries in '%s'", config_file)
|
||||
return None
|
||||
|
||||
dir_name = "latest"
|
||||
branches = lief_conf["deploy"]["branches"]
|
||||
main_branches = lief_conf["deploy"]["main-branches"]
|
||||
default_dir = lief_conf["deploy"]["default-dir"]
|
||||
s3_config = lief_conf["s3"]
|
||||
s3_region = s3_config["region"]
|
||||
s3_bucket = s3_config["bucket"]
|
||||
s3_endpoint = s3_config["endpoint"]
|
||||
|
||||
if BRANCH_NAME != "master":
|
||||
dir_name = "{}".format(BRANCH_NAME.replace("/", "-").replace("_", "-"))
|
||||
s3_manager = S3Manager(default_dir, s3_bucket, s3_region, s3_endpoint)
|
||||
return cls(branches, main_branches, default_dir, s3_manager)
|
||||
|
||||
if IS_TAGGED:
|
||||
dir_name = str(TAG_NAME)
|
||||
@staticmethod
|
||||
def branch() -> Optional[str]:
|
||||
ref = os.getenv("GITHUB_REF")
|
||||
if ref is None:
|
||||
return None
|
||||
return ref.replace("refs/heads/", "")
|
||||
|
||||
for file in DIST_DIR.glob("*.whl"):
|
||||
logger.info("[WHEEL] Uploading '%s'", file.as_posix())
|
||||
push_wheel(file.as_posix(), dir_name)
|
||||
@staticmethod
|
||||
def is_pr() -> bool:
|
||||
head_ref = os.getenv("GITHUB_HEAD_REF", "")
|
||||
repo_path = os.getenv("GITHUB_REPOSITORY", "")
|
||||
is_owned_repo = any(repo_path.startswith(org) for org in OWNED_ORGS)
|
||||
return head_ref != "" or not is_owned_repo
|
||||
|
||||
for file in itertools.chain(BUILD_DIR.glob("*.zip"), BUILD_DIR.glob("*.tar.gz")):
|
||||
logger.info("[SDK ] Uploading '%s'", file.as_posix())
|
||||
push_sdk(file.as_posix(), dir_name)
|
||||
@staticmethod
|
||||
def is_tagged() -> bool:
|
||||
tag = GithubDeploy.tag_name()
|
||||
return tag is not None and len(tag) > 0
|
||||
|
||||
sdk_index = generate_sdk_index(dir_name)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tmp = pathlib.Path(tmp)
|
||||
index = (tmp / "index.html")
|
||||
index.write_text(sdk_index)
|
||||
push_sdk(index.as_posix(), dir_name)
|
||||
@staticmethod
|
||||
def tag_name() -> Optional[str]:
|
||||
ref = os.getenv("GITHUB_REF", "")
|
||||
logger.info("Github Action tag: %s", ref)
|
||||
if ref.startswith("refs/tags/"):
|
||||
return ref.replace("refs/tags/", "")
|
||||
return ""
|
||||
|
||||
pypi_index = generate_pypi_index(dir_name)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tmp = pathlib.Path(tmp)
|
||||
index = (tmp / "index.html")
|
||||
index.write_text(pypi_index)
|
||||
push_wheel(index.as_posix(), dir_name)
|
||||
@staticmethod
|
||||
def workspace() -> str:
|
||||
return os.getenv("GITHUB_WORKSPACE", "")
|
||||
|
||||
logger.info("Done!")
|
||||
def is_main_branch(self, name: str) -> bool:
|
||||
return name in self._main_branches
|
||||
|
||||
def deploy(self, directories: list[str]):
|
||||
s3dir = None
|
||||
if GithubDeploy.is_tagged():
|
||||
s3dir = GithubDeploy.tag_name()
|
||||
else:
|
||||
branch = GithubDeploy.branch()
|
||||
if branch is None:
|
||||
logger.warning("Can't resolve the branch name")
|
||||
sys.exit(1)
|
||||
|
||||
if branch.startswith(RELEASE_KEYWRD):
|
||||
_, s3dir = branch.split(RELEASE_KEYWRD)
|
||||
elif self.is_main_branch(branch):
|
||||
s3dir = self._default_dir
|
||||
else:
|
||||
s3dir = branch.replace("/", "-").replace("_", "-")
|
||||
if s3dir is None:
|
||||
logger.error("Target directory is not set")
|
||||
sys.exit(1)
|
||||
logger.info("s3dir: %s", s3dir)
|
||||
self.s3_manager.change_dir(s3dir)
|
||||
for dirname in directories:
|
||||
dirpath = Path(dirname).resolve().absolute().expanduser()
|
||||
self.s3_manager.upload_wheels_sdk(dirpath, maxdepth=1)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--config", "-c")
|
||||
parser.add_argument("--dry-run", "-n", action="store_true", default=False)
|
||||
parser.add_argument("directories", nargs="+")
|
||||
|
||||
args = parser.parse_args()
|
||||
config_path = None
|
||||
if args.config is not None:
|
||||
config_path = Path(args.config)
|
||||
else:
|
||||
config_path = DEFAULT_CONFIG
|
||||
|
||||
if not config_path.is_file():
|
||||
logger.error("'%s' is not a valid config path")
|
||||
sys.exit(1)
|
||||
|
||||
gh_deploy = GithubDeploy.from_config(config_path)
|
||||
gh_deploy.deploy(args.directories)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
sys.exit(0)
|
||||
|
||||
@@ -1,69 +1,79 @@
|
||||
name: 'Android'
|
||||
on: push
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
build-sdk:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ['arm', 'arm64']
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v1.1.0
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: android-${{ runner.os }}-${{ steps.get-date.outputs.date }}
|
||||
key: android-${{ runner.os }}-${{ matrix.arch }}-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
android-${{ runner.os }}-
|
||||
- name: Build ARM SDK
|
||||
android-${{ runner.os }}-${{ matrix.arch }}
|
||||
- name: Build SDK [${{ matrix.arch }}]
|
||||
shell: bash
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
docker run \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
docker run \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-v $GITHUB_WORKSPACE:/work \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
--rm liefproject/android-arm bash /work/scripts/docker/android-arm.sh
|
||||
- name: Build AArch64 SDK
|
||||
shell: bash
|
||||
run: |
|
||||
docker run \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-v $GITHUB_WORKSPACE:/work \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
--rm liefproject/android-arm64 bash /work/scripts/docker/android-aarch64.sh
|
||||
-v $HOME/.ccache:/ccache \
|
||||
--rm liefproject/android-${ARCH} bash /work/scripts/docker/android-${ARCH}.sh
|
||||
- name: 'Upload Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: android-sdk
|
||||
name: android-sdk-${{ matrix.arch }}
|
||||
path: build/*.tar.gz
|
||||
retention-days: 3
|
||||
deploy:
|
||||
if: ${{ always() }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-sdk
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: ${{ runner.temp }}/artifacts
|
||||
- name: Display artifacts
|
||||
run: ls -R
|
||||
working-directory: ${{ runner.temp }}/artifacts
|
||||
- name: Deploy
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
shell: bash
|
||||
run: |
|
||||
docker run \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-e GITHUB_ACTIONS="true" \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e GITHUB_REF=$GITHUB_REF \
|
||||
docker run --rm \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $RUNNER_TEMP:/runner_tmp \
|
||||
-e GITHUB_ACTIONS="true" \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e GITHUB_REF=$GITHUB_REF \
|
||||
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
|
||||
-e LIEF_S3_KEY=$LIEF_S3_KEY \
|
||||
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
|
||||
--rm \
|
||||
liefproject/deploy python3 /src/.github/deploy.py
|
||||
-e LIEF_S3_KEY=$LIEF_S3_KEY \
|
||||
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
|
||||
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
name: code-check
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'LIEF branch'
|
||||
default: 'master'
|
||||
required: false
|
||||
type: string
|
||||
push:
|
||||
branches:
|
||||
- test/code-check
|
||||
jobs:
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: liefproject/code-check
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
GH_BRANCH: ${{ inputs.branch }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: lief-project/code-check
|
||||
token: ${{ secrets.LIEF_CLONE_TOKEN }}
|
||||
- name: Print info
|
||||
run: |
|
||||
echo ${GH_BRANCH}
|
||||
- name: Running LIEF coverage
|
||||
run: ./lief-coverage --debug
|
||||
+39
-13
@@ -1,17 +1,20 @@
|
||||
name: 'iOS'
|
||||
on: push
|
||||
on: workflow_dispatch
|
||||
|
||||
env:
|
||||
python-version: '3.10'
|
||||
|
||||
jobs:
|
||||
osx-sdk:
|
||||
ios-sdk:
|
||||
runs-on: macos-11.0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python 3.9
|
||||
uses: actions/setup-python@v2
|
||||
- name: Set up Python ${{ env.python-version }}
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: 3.9
|
||||
python-version: ${{ env.python-version }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
brew install cmake ninja ccache
|
||||
@@ -19,23 +22,23 @@ jobs:
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: Setup cache dir
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/.ccache
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v1.1.0
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
path: ${{ runner.temp }}/.ccache
|
||||
key: ios-${{ runner.os }}-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
ios-${{ runner.os }}-
|
||||
ios-${{ runner.os }}
|
||||
- name: Build iOS SDK
|
||||
shell: bash
|
||||
env:
|
||||
CCACHE_DIR: ~/.ccache
|
||||
CCACHE_DIR: ${{ runner.temp }}/.ccache
|
||||
CCACHE_MAXSIZE: 10.0G
|
||||
CCACHE_CPP2: 1
|
||||
CCACHE_COMPRESS: 1
|
||||
@@ -47,14 +50,37 @@ jobs:
|
||||
name: ios-sdk
|
||||
path: build/*.tar.gz
|
||||
retention-days: 3
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ always() }}
|
||||
needs: ios-sdk
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: ${{ runner.temp }}/artifacts
|
||||
- name: Display artifacts
|
||||
run: ls -R
|
||||
working-directory: ${{ runner.temp }}/artifacts
|
||||
- name: Deploy
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install --upgrade requests mako boto3
|
||||
python .github/deploy.py
|
||||
docker run --rm \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $RUNNER_TEMP:/runner_tmp \
|
||||
-e GITHUB_ACTIONS="true" \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e GITHUB_REF=$GITHUB_REF \
|
||||
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
|
||||
-e LIEF_S3_KEY=$LIEF_S3_KEY \
|
||||
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
|
||||
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,84 +1,129 @@
|
||||
name: 'Linux AArch64'
|
||||
on: push
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
linux-sdk:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.7, 3.8, 3.9]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v1.1.0
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: linux-aarch64-${{ runner.os }}-${{ steps.get-date.outputs.date }}
|
||||
key: linux-aarch64-${{ runner.os }}-sdk-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
linux-aarch64-${{ runner.os }}-
|
||||
linux-aarch64-${{ runner.os }}-sdk
|
||||
- name: Build SDK
|
||||
if: matrix.python-version == '3.9'
|
||||
shell: bash
|
||||
run: |
|
||||
docker run \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-v $GITHUB_WORKSPACE:/work \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
--rm liefproject/manylinux2014-aarch64 bash /work/scripts/docker/linux-aarch64.sh
|
||||
- name: Build Python ${{ matrix.python-version }} wheel
|
||||
shell: bash
|
||||
env:
|
||||
PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
run: |
|
||||
PYTHON_VERSION2=$(echo "${PYTHON_VERSION}" | sed 's/\.//') # Transform 3.8 -> 38
|
||||
docker run \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-e PYTHON_BINARY=/opt/python/cp${PYTHON_VERSION2}-cp${PYTHON_VERSION2}/bin/python${PYTHON_VERSION} \
|
||||
-v $GITHUB_WORKSPACE:/work \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
--rm liefproject/manylinux2014-aarch64 bash /work/scripts/docker/manylinux2014-aarch64.sh
|
||||
mkdir -p $RUNNER_TEMP/lief-install
|
||||
docker run --name lief_sdk --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-v $GITHUB_WORKSPACE:/work \
|
||||
-v $RUNNER_TEMP/lief-install:/install \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
liefproject/manylinux2014-aarch64 bash /work/scripts/docker/linux-aarch64.sh
|
||||
- name: 'Upload SDK Artifact'
|
||||
if: matrix.python-version == '3.9'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux-aarch64-sdk
|
||||
path: build/*.tar.gz
|
||||
retention-days: 3
|
||||
- name: 'Upload Python Wheel Artifact - ${{ matrix.python-version }}'
|
||||
- name: 'Upload Install Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux-aarch64-wheel-${{ matrix.python-version }}
|
||||
name: linux-aarch64-install
|
||||
path: ${{ runner.temp }}/lief-install
|
||||
retention-days: 1
|
||||
wheels:
|
||||
runs-on: ubuntu-latest
|
||||
needs: linux-sdk
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.8, 3.9, '3.10', '3.11']
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: linux-aarch64-${{ runner.os }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
linux-aarch64-${{ runner.os }}-${{ matrix.python-version }}
|
||||
- name: Download LIEF install dir
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: linux-aarch64-install
|
||||
path: ${{ runner.temp }}/lief-install
|
||||
- name: Python ${{ matrix.python-version }} -- Wheel
|
||||
shell: bash
|
||||
env:
|
||||
PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
run: |
|
||||
PYTHON_VERSION_ALT=$(echo "${PYTHON_VERSION}" | sed 's/\.//') # Transform 3.8 -> 38
|
||||
docker run --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-e PYTHON_VERSION=$PYTHON_VERSION_ALT \
|
||||
-e PYTHON_BINARY=/opt/python/cp${PYTHON_VERSION_ALT}-cp${PYTHON_VERSION_ALT}/bin/python${PYTHON_VERSION} \
|
||||
-v $GITHUB_WORKSPACE:/work \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
-v $RUNNER_TEMP/lief-install:/install \
|
||||
liefproject/manylinux2014-aarch64 bash /work/scripts/docker/manylinux2014-aarch64.sh
|
||||
- name: 'Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux-aarch64-python${{ matrix.python-version }}-wheel
|
||||
path: dist/*.whl
|
||||
retention-days: 3
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ always() }}
|
||||
needs: [linux-sdk, wheels]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: ${{ runner.temp }}/artifacts
|
||||
- name: Display artifacts
|
||||
run: ls -R
|
||||
working-directory: ${{ runner.temp }}/artifacts
|
||||
- name: Deploy
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
shell: bash
|
||||
run: |
|
||||
docker run \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-e GITHUB_ACTIONS="true" \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e GITHUB_REF=$GITHUB_REF \
|
||||
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
|
||||
-e LIEF_S3_KEY=$LIEF_S3_KEY \
|
||||
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
|
||||
--rm \
|
||||
liefproject/deploy python3 /src/.github/deploy.py
|
||||
|
||||
docker run --rm \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $RUNNER_TEMP:/runner_tmp \
|
||||
-e GITHUB_ACTIONS="true" \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e GITHUB_REF=$GITHUB_REF \
|
||||
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
|
||||
-e LIEF_S3_KEY=$LIEF_S3_KEY \
|
||||
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
|
||||
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
|
||||
|
||||
|
||||
|
||||
+139
-114
@@ -1,152 +1,177 @@
|
||||
name: 'Linux x86-64'
|
||||
on: push
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
linux-sdk:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v1.1.0
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: linux-x86-64-${{ runner.os }}-${{ steps.get-date.outputs.date }}
|
||||
key: linux-x86-64-${{ runner.os }}-sdk-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
linux-x86-64-${{ runner.os }}-
|
||||
- name: Build Python 3.6 wheel
|
||||
shell: bash
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
PYTHON_VERSION: 36
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-e PYTHON_VERSION=$PYTHON_VERSION \
|
||||
-e PYTHON_BINARY=/opt/python/cp36-cp36m/bin/python3.6 \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
liefproject/manylinux_2_24_x86_64 bash /src/scripts/docker/run_linux.sh
|
||||
- name: Build Python 3.7 wheel
|
||||
shell: bash
|
||||
env:
|
||||
PYTHON_VERSION: 37
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-e PYTHON_VERSION=$PYTHON_VERSION \
|
||||
-e PYTHON_BINARY=/opt/python/cp37-cp37m/bin/python3.7 \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
liefproject/manylinux_2_24_x86_64 bash /src/scripts/docker/run_linux_test.sh
|
||||
- name: Build Python 3.8 wheel
|
||||
shell: bash
|
||||
env:
|
||||
PYTHON_VERSION: 38
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-e PYTHON_VERSION=$PYTHON_VERSION \
|
||||
-e PYTHON_BINARY=/opt/python/cp38-cp38/bin/python3.8 \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
liefproject/manylinux_2_24_x86_64 bash /src/scripts/docker/run_linux.sh
|
||||
- name: Build Python 3.9 wheel
|
||||
shell: bash
|
||||
env:
|
||||
PYTHON_VERSION: 39
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-e PYTHON_VERSION=$PYTHON_VERSION \
|
||||
-e PYTHON_BINARY=/opt/python/cp39-cp39/bin/python3.9 \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
liefproject/manylinux_2_24_x86_64 bash /src/scripts/docker/run_linux.sh
|
||||
- name: Build Python 3.10 wheel
|
||||
shell: bash
|
||||
env:
|
||||
PYTHON_VERSION: 310
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-e PYTHON_VERSION=$PYTHON_VERSION \
|
||||
-e PYTHON_BINARY=/opt/python/cp310-cp310/bin/python3.10 \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
liefproject/manylinux_2_24_x86_64 bash /src/scripts/docker/run_linux.sh
|
||||
linux-x86-64-${{ runner.os }}-sdk
|
||||
- name: Build SDK
|
||||
shell: bash
|
||||
run: |
|
||||
docker run --name lief_sdk --rm \
|
||||
-e PYTHON_BINARY=/opt/python/cp39-cp39/bin/python3.9 \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
liefproject/manylinux_2_24_x86_64 bash /src/scripts/docker/run_linux_sdk.sh
|
||||
mkdir -p $RUNNER_TEMP/lief-install
|
||||
docker run --name lief_sdk --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $RUNNER_TEMP/lief-install:/install \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux_sdk.sh
|
||||
- name: 'Upload SDK Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux-x86-64-sdk
|
||||
path: build/*.tar.gz
|
||||
retention-days: 3
|
||||
- name: 'Upload SDK Artifact'
|
||||
- name: 'Upload Install Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux-x86-64-python-wheel
|
||||
name: linux-x86-64-install
|
||||
path: ${{ runner.temp }}/lief-install
|
||||
retention-days: 1
|
||||
testing:
|
||||
if: "!contains(github.event.commits[0].message, '[skip-test]')"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: linux-x86-64-${{ runner.os }}-test-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
linux-x86-64-${{ runner.os }}-test
|
||||
- name: Python 3.8 -- Wheel & Test
|
||||
shell: bash
|
||||
env:
|
||||
PYTHON_VERSION: 38
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-e PYTHON_VERSION=$PYTHON_VERSION \
|
||||
-e PYTHON_BINARY=/opt/python/cp38-cp38/bin/python3.8 \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux_test.sh
|
||||
pywheels:
|
||||
runs-on: ubuntu-latest
|
||||
needs: linux-sdk
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: linux-x86-64-${{ runner.os }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
linux-x86-64-${{ runner.os }}-${{ matrix.python-version }}
|
||||
- name: Download LIEF install dir
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: linux-x86-64-install
|
||||
path: ${{ runner.temp }}/lief-install
|
||||
- name: Python ${{ matrix.python-version }} -- Wheel
|
||||
shell: bash
|
||||
env:
|
||||
PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
run: |
|
||||
PYTHON_VERSION_ALT=$(echo "${PYTHON_VERSION}" | sed 's/\.//') # Transform 3.8 -> 38
|
||||
docker run --rm \
|
||||
-e CCACHE_COMPRESS=1 \
|
||||
-e CCACHE_MAXSIZE=10.0G \
|
||||
-e CCACHE_CPP2=1 \
|
||||
-e CCACHE_DIR=/ccache \
|
||||
-e PYTHON_VERSION=$PYTHON_VERSION_ALT \
|
||||
-e PYTHON_BINARY=/opt/python/cp${PYTHON_VERSION_ALT}-cp${PYTHON_VERSION_ALT}/bin/python${PYTHON_VERSION} \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $HOME/.ccache:/ccache \
|
||||
-v $RUNNER_TEMP/lief-install:/install \
|
||||
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux.sh
|
||||
- name: 'Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux-x86-64-python${{ matrix.python-version }}-wheel
|
||||
path: dist/*.whl
|
||||
retention-days: 3
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ always() }}
|
||||
needs: [linux-sdk, pywheels]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: ${{ runner.temp }}/artifacts
|
||||
- name: Display artifacts
|
||||
run: ls -R
|
||||
working-directory: ${{ runner.temp }}/artifacts
|
||||
- name: Deploy
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
shell: bash
|
||||
run: |
|
||||
docker run \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-e GITHUB_ACTIONS="true" \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e GITHUB_REF=$GITHUB_REF \
|
||||
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
|
||||
-e LIEF_S3_KEY=$LIEF_S3_KEY \
|
||||
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
|
||||
--rm \
|
||||
liefproject/deploy python3 /src/.github/deploy.py
|
||||
docker run --rm \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $RUNNER_TEMP:/runner_tmp \
|
||||
-e GITHUB_ACTIONS="true" \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e GITHUB_REF=$GITHUB_REF \
|
||||
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
|
||||
-e LIEF_S3_KEY=$LIEF_S3_KEY \
|
||||
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
|
||||
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
|
||||
documentation:
|
||||
needs: [deploy]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: liefproject/manylinux_2_28_x86_64
|
||||
env:
|
||||
CIRCLE_CI_URL: "https://circleci.com/api/v2/project/gh/lief-project/doc/pipeline"
|
||||
CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
|
||||
steps:
|
||||
- name: Trigger documentation
|
||||
if: github.ref == 'refs/heads/master'
|
||||
env:
|
||||
CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e CIRCLE_CI_TOKEN=$CIRCLE_CI_TOKEN \
|
||||
liefproject/manylinux_2_24_x86_64 \
|
||||
bash -c "curl --request POST --url https://circleci.com/api/v2/project/gh/lief-project/doc/pipeline --header 'Circle-Token: ${CIRCLE_CI_TOKEN}' --header 'content-type: application/json'";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
curl --request POST --url ${CIRCLE_CI_URL} \
|
||||
--header "Circle-Token: ${CIRCLE_CI_TOKEN}" \
|
||||
--header 'content-type: application/json' \
|
||||
--data '{"parameters":{"lief-branch":"master"}}'
|
||||
|
||||
+169
-49
@@ -1,18 +1,136 @@
|
||||
name: 'macOS'
|
||||
on: push
|
||||
on: workflow_dispatch
|
||||
|
||||
env:
|
||||
python-test-version: '3.10'
|
||||
|
||||
jobs:
|
||||
osx-sdk:
|
||||
runs-on: macos-11.0
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
brew install cmake ninja ccache
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: Setup cache dir
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p $RUNNER_TEMP/.ccache
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ runner.temp }}/.ccache
|
||||
key: osx-${{ runner.os }}-sdk-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
osx-${{ runner.os }}-sdk
|
||||
- name: Build SDK
|
||||
shell: bash
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: "11.0"
|
||||
CCACHE_DIR: ${{ runner.temp }}/.ccache
|
||||
CCACHE_MAXSIZE: 10.0G
|
||||
CCACHE_CPP2: 1
|
||||
CCACHE_COMPRESS: 1
|
||||
run: |
|
||||
bash scripts/osx/package_sdk.sh
|
||||
- name: 'Upload SDK Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: osx-sdk
|
||||
path: build/*.tar.gz
|
||||
retention-days: 3
|
||||
- name: 'Upload install artifact [arm64]'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: osx-arm64-install
|
||||
path: install/arm64
|
||||
retention-days: 1
|
||||
- name: 'Upload install artifact [x64]'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: osx-x64-install
|
||||
path: install/x64
|
||||
retention-days: 1
|
||||
osx-testing:
|
||||
runs-on: macos-11.0
|
||||
if: "!contains(github.event.commits[0].message, '[skip-test]')"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ env.python-test-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ env.python-test-version }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
brew install cmake ninja ccache
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: Setup cache dir
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p $RUNNER_TEMP/.ccache
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ runner.temp }}/.ccache
|
||||
key: osx-${{ runner.os }}-test-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
osx-${{ runner.os }}-test
|
||||
- name: Upgrade pip
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools
|
||||
- name: Build Python 3.10 with tests
|
||||
shell: bash
|
||||
env:
|
||||
LIEF_SAMPLES_DIR: "/tmp/samples"
|
||||
BUILD_DIR: "/tmp/lief-build"
|
||||
MACOSX_TARGET: "11.7"
|
||||
MACOSX_DEPLOYMENT_TARGET: "11.0"
|
||||
CCACHE_DIR: ${{ runner.temp }}/.ccache
|
||||
CCACHE_MAXSIZE: 10.0G
|
||||
CCACHE_CPP2: 1
|
||||
CCACHE_COMPRESS: 1
|
||||
run: |
|
||||
python -m pip install -r tests/requirements.txt
|
||||
python tests/dl_samples.py ${LIEF_SAMPLES_DIR}
|
||||
cd api/python
|
||||
PYLIEF_CONF=${GITHUB_WORKSPACE}/scripts/osx/osx-testing-x64.toml \
|
||||
python ./setup.py build \
|
||||
--build-base=${BUILD_DIR}/base \
|
||||
--build-temp=${BUILD_DIR}/temp \
|
||||
install --user
|
||||
cd ${GITHUB_WORKSPACE}
|
||||
python tests/run_pytest.py
|
||||
python tests/run_tools_check.py ${BUILD_DIR}/temp
|
||||
ctest --output-on-failure --test-dir ${BUILD_DIR}/temp
|
||||
wheels:
|
||||
runs-on: macos-11.0
|
||||
needs: osx-sdk
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
|
||||
python-version: [3.8, 3.9, '3.10', '3.11']
|
||||
arch: ['x64', 'arm64']
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install system dependencies
|
||||
@@ -22,73 +140,75 @@ jobs:
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: Setup cache dir
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/.ccache
|
||||
mkdir -p $RUNNER_TEMP/.ccache
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v1.1.0
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: osx-${{ runner.os }}-${{ steps.get-date.outputs.date }}
|
||||
path: ${{ runner.temp }}/.ccache
|
||||
key: osx-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
osx-${{ runner.os }}-
|
||||
- name: Build Python ${{ matrix.python-version }} wheel and Test
|
||||
osx-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.python-version }}
|
||||
- name: Upgrade pip
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools
|
||||
- name: Download LIEF install dir
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: osx-${{ matrix.arch }}-install
|
||||
path: ~/lief-${{ matrix.arch }}-install
|
||||
- name: Build Python ${{ matrix.python-version }} [${{ matrix.arch }}]
|
||||
shell: bash
|
||||
if: matrix.python-version == '3.6'
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.14"
|
||||
CCACHE_DIR: ~/.ccache
|
||||
MACOSX_DEPLOYMENT_TARGET: "11.0"
|
||||
CCACHE_DIR: ${{ runner.temp }}/.ccache
|
||||
CCACHE_MAXSIZE: 10.0G
|
||||
CCACHE_CPP2: 1
|
||||
CCACHE_COMPRESS: 1
|
||||
PYLIEF_CONF: "${{ github.workspace }}/scripts/osx/py-${{ matrix.arch }}.toml"
|
||||
run: |
|
||||
python ./setup.py --ninja --lief-test build bdist_wheel --skip-build --plat-name=macosx_${MACOSX_DEPLOYMENT_TARGET}_x86_64
|
||||
- name: Build Python ${{ matrix.python-version }} wheel
|
||||
shell: bash
|
||||
if: matrix.python-version != '3.6'
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.14"
|
||||
CCACHE_DIR: ~/.ccache
|
||||
CCACHE_MAXSIZE: 10.0G
|
||||
CCACHE_CPP2: 1
|
||||
CCACHE_COMPRESS: 1
|
||||
run: |
|
||||
python ./setup.py --ninja build bdist_wheel --skip-build --plat-name=macosx_${MACOSX_DEPLOYMENT_TARGET}_x86_64
|
||||
- name: Build SDK
|
||||
shell: bash
|
||||
if: matrix.python-version == '3.9' # Build the SDk only with Python 3.9
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.14"
|
||||
CCACHE_DIR: ~/.ccache
|
||||
CCACHE_MAXSIZE: 10.0G
|
||||
CCACHE_CPP2: 1
|
||||
CCACHE_COMPRESS: 1
|
||||
run: |
|
||||
bash scripts/osx/package_sdk.sh
|
||||
- name: 'Upload SDK Artifact'
|
||||
if: matrix.python-version == '3.9' # Build the SDk only with Python 3.9
|
||||
python -m pip -vv wheel --wheel-dir=dist/ api/python
|
||||
- name: 'Upload Python wheel artifact - ${{ matrix.python-version }}'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: osx-sdk
|
||||
path: build/*.tar.gz
|
||||
retention-days: 3
|
||||
- name: 'Upload Python Wheel Artifact - ${{ matrix.python-version }}'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: osx-wheel-${{ matrix.python-version }}
|
||||
name: osx-wheel-${{ matrix.arch }}-${{ matrix.python-version }}
|
||||
path: dist/*.whl
|
||||
retention-days: 3
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ always() }}
|
||||
needs: [osx-sdk, wheels]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: ${{ runner.temp }}/artifacts
|
||||
- name: Display artifacts
|
||||
run: ls -R
|
||||
working-directory: ${{ runner.temp }}/artifacts
|
||||
- name: Deploy
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install --upgrade requests mako boto3
|
||||
python .github/deploy.py
|
||||
|
||||
docker run --rm \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $RUNNER_TEMP:/runner_tmp \
|
||||
-e GITHUB_ACTIONS="true" \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e GITHUB_REF=$GITHUB_REF \
|
||||
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
|
||||
-e LIEF_S3_KEY=$LIEF_S3_KEY \
|
||||
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
|
||||
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
name: LIEF PR
|
||||
on: [pull_request, workflow_dispatch]
|
||||
|
||||
env:
|
||||
python-osx-version: '3.10'
|
||||
python-win-version: '3.10'
|
||||
|
||||
jobs:
|
||||
osx:
|
||||
runs-on: macos-11.0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ env.python-osx-version }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
brew install cmake ninja ccache
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
- name: Build with Python ${{ env.python-osx-version }} & Test
|
||||
shell: bash
|
||||
env:
|
||||
LIEF_SAMPLES_DIR: "/tmp/samples"
|
||||
BUILD_DIR: "/tmp/lief-build"
|
||||
run: |
|
||||
python -m pip install -r tests/requirements.txt
|
||||
python tests/dl_samples.py ${LIEF_SAMPLES_DIR}
|
||||
cd api/python
|
||||
PYLIEF_CONF=${GITHUB_WORKSPACE}/scripts/osx/osx-testing-x64.toml \
|
||||
python ./setup.py build \
|
||||
--build-base=${BUILD_DIR}/base \
|
||||
--build-temp=${BUILD_DIR}/temp \
|
||||
install --user
|
||||
cd ${GITHUB_WORKSPACE}
|
||||
python tests/run_pytest.py
|
||||
python tests/run_tools_check.py ${BUILD_DIR}/temp
|
||||
ctest --output-on-failure --test-dir ${BUILD_DIR}/temp
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build & Test
|
||||
shell: bash
|
||||
env:
|
||||
PYTHON_VERSION: 39
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e PYTHON_VERSION=$PYTHON_VERSION \
|
||||
-e PYTHON_BINARY=/opt/python/cp39-cp39/bin/python3.9 \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux_test.sh
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ env.python-win-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ env.python-win-version }}
|
||||
architecture: x64
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
python -m pip install --upgrade pip setuptools
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Set env variables
|
||||
run: |
|
||||
chcp 65001 #set code page to utf-8
|
||||
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
|
||||
echo ("BUILD_DIR=" + $env:RUNNER_TEMP + "/lief-build") >> $env:GITHUB_ENV
|
||||
echo ("PYLIEF_CONF=" + $env:GITHUB_WORKSPACE + "/scripts/windows/py-x64-test.toml") >> $env:GITHUB_ENV
|
||||
- name: Build Python ${{ env.python-win-version }}
|
||||
run: |
|
||||
python -m pip install -r tests/requirements.txt
|
||||
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
|
||||
cd api/python
|
||||
python ./setup.py build ^
|
||||
--build-base=%BUILD_DIR%/base ^
|
||||
--build-temp=%BUILD_DIR%/temp ^
|
||||
install --user
|
||||
shell: cmd
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd %GITHUB_WORKSPACE%
|
||||
python tests/run_pytest.py
|
||||
ctest --output-on-failure --test-dir %BUILD_DIR%/temp/Release
|
||||
shell: cmd
|
||||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
name: 'sanitize'
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '**'
|
||||
schedule:
|
||||
- cron: '0 0 * * 1'
|
||||
workflow_dispatch:
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
gcc:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: compile
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
name: LIEF Windows
|
||||
on: workflow_dispatch
|
||||
|
||||
env:
|
||||
python-test-version: '3.10'
|
||||
python-version: '3.9'
|
||||
|
||||
jobs:
|
||||
build-sdk:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ['x64', 'x86']
|
||||
fail-fast: false
|
||||
env:
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
SCCACHE_DIR: ${{ vars.SCCACHE_DIR }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ env.python-version }}
|
||||
architecture: ${{ matrix.arch }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
choco install sccache
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: Setup sccache
|
||||
uses: actions/cache@v3
|
||||
continue-on-error: false
|
||||
with:
|
||||
path: ${{ vars.SCCACHE_DIR }}
|
||||
key: ${{ runner.os }}-${{ matrix.arch }}-sccache-sdk-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.arch }}-sccache-sdk
|
||||
- name: Start sccache server
|
||||
run: sccache --start-server
|
||||
- name: Build SDK
|
||||
run: |
|
||||
python ./scripts/windows/package_sdk.py
|
||||
- name: 'Upload SDK artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: windows-${{ matrix.arch }}-sdk
|
||||
path: build/*.zip
|
||||
retention-days: 3
|
||||
- name: 'Upload install artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: windows-${{ matrix.arch }}-install
|
||||
path: ${{ runner.temp }}/lief-install
|
||||
retention-days: 1
|
||||
- name: sccache stats
|
||||
run: sccache --show-stats
|
||||
- name: stop sccache server
|
||||
run: sccache --stop-server || true
|
||||
tests:
|
||||
runs-on: windows-2019
|
||||
if: "!contains(github.event.commits[0].message, '[skip-test]')"
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ['x64']
|
||||
fail-fast: false
|
||||
env:
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
SCCACHE_DIR: ${{ vars.SCCACHE_DIR }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ env.python-test-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ env.python-test-version }}
|
||||
architecture: ${{ matrix.arch }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
choco install sccache
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: Setup sccache
|
||||
uses: actions/cache@v3
|
||||
continue-on-error: false
|
||||
with:
|
||||
path: ${{ vars.SCCACHE_DIR }}
|
||||
key: ${{ runner.os }}-${{ matrix.arch }}-sccache-test-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.arch }}-sccache-test
|
||||
- name: Start sccache server
|
||||
run: sccache --start-server
|
||||
- name: Set arch specific env
|
||||
if: matrix.arch == 'x64'
|
||||
run: |
|
||||
echo "ARCH=x64" >> $env:GITHUB_ENV
|
||||
- name: Set arch specific env
|
||||
if: matrix.arch == 'x86'
|
||||
run: |
|
||||
echo "ARCH=x86" >> $env:GITHUB_ENV
|
||||
- name: Set Python config (${{ matrix.arch }})
|
||||
run: |
|
||||
echo ("PYLIEF_CONF=" + $env:GITHUB_WORKSPACE + "/scripts/windows/py-" + $env:ARCH + "-test.toml") >> $env:GITHUB_ENV
|
||||
- name: Set env variables
|
||||
run: |
|
||||
chcp 65001 #set code page to utf-8
|
||||
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
|
||||
echo ("BUILD_DIR=" + $env:RUNNER_TEMP + "/lief-build") >> $env:GITHUB_ENV
|
||||
- name: Build Python ${{ env.python-test-version }}
|
||||
run: |
|
||||
python -m pip install -r tests/requirements.txt
|
||||
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
|
||||
cd api/python
|
||||
python ./setup.py build ^
|
||||
--build-base=%BUILD_DIR%/base ^
|
||||
--build-temp=%BUILD_DIR%/temp ^
|
||||
install --user
|
||||
shell: cmd
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd %GITHUB_WORKSPACE%
|
||||
python tests/run_pytest.py
|
||||
ctest --output-on-failure --test-dir %BUILD_DIR%/temp/Release
|
||||
shell: cmd
|
||||
- name: sccache stats
|
||||
run: sccache --show-stats
|
||||
- name: stop sccache server
|
||||
run: sccache --stop-server || true
|
||||
wheels:
|
||||
runs-on: windows-2019
|
||||
needs: build-sdk
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.8, 3.9, '3.10', '3.11', '3.12-dev']
|
||||
arch: ['x86', 'x64']
|
||||
fail-fast: false
|
||||
env:
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
SCCACHE_DIR: ${{ vars.SCCACHE_DIR }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: ${{ matrix.arch }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
choco install sccache
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: Save sccache
|
||||
uses: actions/cache@v3
|
||||
continue-on-error: false
|
||||
with:
|
||||
path: ${{ vars.SCCACHE_DIR }}
|
||||
key: ${{ runner.os }}-${{ matrix.arch }}-sccache-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.arch }}-sccache-${{ matrix.python-version }}
|
||||
- name: Download LIEF install dir
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: windows-${{ matrix.arch }}-install
|
||||
path: ~/lief-${{ matrix.arch }}-install
|
||||
- name: Start sccache server
|
||||
run: sccache --start-server
|
||||
- name: Upgrade pip
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
shell: cmd
|
||||
- name: Set arch specific env
|
||||
if: matrix.arch == 'x64'
|
||||
run: |
|
||||
echo "ARCH=x64" >> $env:GITHUB_ENV
|
||||
- name: Set arch specific env
|
||||
if: matrix.arch == 'x86'
|
||||
run: |
|
||||
echo "ARCH=x86" >> $env:GITHUB_ENV
|
||||
- name: Set Python config (${{ matrix.arch }})
|
||||
run: |
|
||||
echo ("PYLIEF_CONF=" + $env:GITHUB_WORKSPACE + "/scripts/windows/py-" + $env:ARCH + ".toml") >> $env:GITHUB_ENV
|
||||
- name: Set env variables
|
||||
run: |
|
||||
chcp 65001 #set code page to utf-8
|
||||
- name: Build Python ${{ matrix.python-version }}
|
||||
run: |
|
||||
python -m pip -vv wheel --wheel-dir=dist/ api/python
|
||||
shell: cmd
|
||||
- name: 'Upload Python artifacts [${{ matrix.python-version }}]'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: windows-${{ matrix.arch }}-wheel-${{ matrix.python-version }}
|
||||
path: dist/*.whl
|
||||
retention-days: 3
|
||||
deploy:
|
||||
if: ${{ always() }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-sdk, wheels]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: ${{ runner.temp }}/artifacts
|
||||
- name: Deploy
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
shell: bash
|
||||
run: |
|
||||
docker run --rm \
|
||||
-v $GITHUB_WORKSPACE:/src \
|
||||
-v $RUNNER_TEMP:/runner_tmp \
|
||||
-e GITHUB_ACTIONS="true" \
|
||||
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
|
||||
-e GITHUB_REF=$GITHUB_REF \
|
||||
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
|
||||
-e LIEF_S3_KEY=$LIEF_S3_KEY \
|
||||
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
|
||||
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
name: LIEF PR Windows Tests
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.8]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
python -m pip install --upgrade pip setuptools
|
||||
python -m pip install wheel mako
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Build and Test
|
||||
run: |
|
||||
python ./setup.py --ninja --lief-test bdist_wheel
|
||||
shell: cmd
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
name: LIEF Windows Quick
|
||||
on: workflow_dispatch
|
||||
|
||||
env:
|
||||
python-version: '3.9'
|
||||
|
||||
jobs:
|
||||
quick-test:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x64, x86]
|
||||
fail-fast: false
|
||||
env:
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
SCCACHE_DIR: ${{ vars.SCCACHE_DIR }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ env.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ env.python-version }}
|
||||
architecture: ${{ matrix.python-version }}
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
choco install sccache
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- name: Save sccache
|
||||
uses: actions/cache@v3
|
||||
continue-on-error: false
|
||||
with:
|
||||
path: ${{ vars.SCCACHE_DIR }}
|
||||
key: ${{ runner.os }}-${{ matrix.arch }}-quick-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.arch }}-quick
|
||||
- name: Start sccache server
|
||||
run: sccache --start-server
|
||||
- name: Set env variables
|
||||
run: |
|
||||
chcp 65001 #set code page to utf-8
|
||||
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
|
||||
- name: Upgrade pip
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
shell: cmd
|
||||
- name: Build Python ${{ env.python-version }}
|
||||
run: |
|
||||
python -m pip install -r tests/requirements.txt
|
||||
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
|
||||
python -m pip -vv install api/python
|
||||
shell: cmd
|
||||
- name: Run tests
|
||||
run: |
|
||||
python ./tests/run_pytest.py
|
||||
shell: cmd
|
||||
- name: sccache stats
|
||||
run: sccache --show-stats
|
||||
- name: sccache server
|
||||
run: sccache --stop-server || true
|
||||
@@ -1,116 +0,0 @@
|
||||
|
||||
name: LIEF Windows x64
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release-**'
|
||||
tags:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
|
||||
fail-fast: false
|
||||
env:
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
SCCACHE_DIR: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x64
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
choco install sccache
|
||||
python -m pip install --upgrade pip setuptools
|
||||
python -m pip install wheel mako
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
shell: bash
|
||||
- name: Save sccache
|
||||
uses: actions/cache@v2
|
||||
continue-on-error: false
|
||||
with:
|
||||
path: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
|
||||
key: ${{ runner.os }}-x64-sccache-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-x64-sccache-
|
||||
- name: Start sccache server
|
||||
run: sccache --start-server
|
||||
- name: ⛓ Build Python ${{ matrix.python-version }} & Test
|
||||
if: matrix.python-version == 3.6
|
||||
run: |
|
||||
python ./setup.py --ninja --lief-test bdist_wheel
|
||||
shell: cmd
|
||||
- name: ❱ Build Python ${{ matrix.python-version }}
|
||||
if: matrix.python-version != 3.6
|
||||
run: |
|
||||
python ./setup.py --ninja bdist_wheel
|
||||
shell: cmd
|
||||
- name: ❱ Build SDK
|
||||
if: matrix.python-version == 3.9
|
||||
run: |
|
||||
python ./scripts/windows/package_sdk.py
|
||||
- name: 'Upload SDK Artifact'
|
||||
if: matrix.python-version == 3.9
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: windows-x64-sdk
|
||||
path: build/*.zip
|
||||
retention-days: 3
|
||||
- name: 'Upload Python Wheel Artifact - ${{ matrix.python-version }}'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: windows-x64-wheel-${{ matrix.python-version }}
|
||||
path: dist/*.whl
|
||||
retention-days: 3
|
||||
- name: 📊 Print sccache stats
|
||||
run: sccache --show-stats
|
||||
- name: 🛑 Stop sccache server
|
||||
run: sccache --stop-server || true
|
||||
- name: Setup WSL
|
||||
uses: Vampire/setup-wsl@v1
|
||||
with:
|
||||
distribution: Debian
|
||||
use-cache: 'true'
|
||||
wsl-shell-user: root
|
||||
set-as-default: 'true'
|
||||
wsl-conf: |
|
||||
[automount]
|
||||
options = "metadata"
|
||||
additional-packages:
|
||||
ca-certificates
|
||||
curl
|
||||
locales
|
||||
python3 python3-pip
|
||||
git
|
||||
openssl
|
||||
ssh
|
||||
- shell: wsl-bash {0}
|
||||
name: Deploy
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
GITHUB_ACTIONS: "true"
|
||||
GITHUB_WORKSPACE: ${{ env.GITHUB_WORKSPACE }}
|
||||
GITHUB_REF: ${{ env.GITHUB_REF }}
|
||||
GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
|
||||
WSLENV: LIEF_S3_KEY:LIEF_S3_SECRET:GITHUB_ACTIONS:GITHUB_WORKSPACE:GITHUB_REF:GITHUB_REPOSITORY
|
||||
run: |
|
||||
python3 -m pip install --no-cache-dir --upgrade pip setuptools requests mako wheel boto3
|
||||
python3 .github/deploy.py
|
||||
@@ -1,62 +0,0 @@
|
||||
|
||||
name: LIEF Windows x64 Quick
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
- '!master'
|
||||
- '!release-**'
|
||||
tags-ignore:
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.9]
|
||||
env:
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
SCCACHE_DIR: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x64
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
choco install sccache
|
||||
python -m pip install --upgrade pip setuptools
|
||||
python -m pip install wheel mako
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
shell: bash
|
||||
- name: Save sccache
|
||||
uses: actions/cache@v2
|
||||
continue-on-error: false
|
||||
with:
|
||||
path: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
|
||||
key: ${{ runner.os }}-x64-sccache-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-x64-sccache-
|
||||
- name: Start sccache server
|
||||
run: sccache --start-server
|
||||
- name: ⛓ Build Python ${{ matrix.python-version }} & Test
|
||||
run: |
|
||||
python ./setup.py --ninja --lief-test bdist_wheel
|
||||
shell: cmd
|
||||
- name: 📊 Print sccache stats
|
||||
run: sccache --show-stats
|
||||
- name: 🛑 Stop sccache server
|
||||
run: sccache --stop-server || true
|
||||
@@ -1,116 +0,0 @@
|
||||
|
||||
name: LIEF Windows x86
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release-**'
|
||||
tags:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
|
||||
fail-fast: false
|
||||
env:
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
SCCACHE_DIR: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x86
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
choco install sccache
|
||||
python -m pip install --upgrade pip setuptools
|
||||
python -m pip install wheel mako
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
shell: bash
|
||||
- name: Save sccache
|
||||
uses: actions/cache@v2
|
||||
continue-on-error: false
|
||||
with:
|
||||
path: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
|
||||
key: ${{ runner.os }}-x86-sccache-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-x86-sccache-
|
||||
- name: Start sccache server
|
||||
run: sccache --start-server
|
||||
- name: ⛓ Build Python ${{ matrix.python-version }} & Test
|
||||
if: matrix.python-version == 3.6
|
||||
run: |
|
||||
python ./setup.py --ninja --lief-test bdist_wheel --plat-name=win32
|
||||
shell: cmd
|
||||
- name: ❱ Build Python ${{ matrix.python-version }}
|
||||
if: matrix.python-version != 3.6
|
||||
run: |
|
||||
python ./setup.py --ninja bdist_wheel --plat-name=win32
|
||||
shell: cmd
|
||||
- name: ❱ Build SDK
|
||||
if: matrix.python-version == 3.9
|
||||
run: |
|
||||
python ./scripts/windows/package_sdk.py
|
||||
- name: 'Upload SDK Artifact'
|
||||
if: matrix.python-version == 3.9
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: windows-x86-sdk
|
||||
path: build/*.zip
|
||||
retention-days: 3
|
||||
- name: 'Upload Python Wheel Artifact - ${{ matrix.python-version }}'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: windows-x86-wheel-${{ matrix.python-version }}
|
||||
path: dist/*.whl
|
||||
retention-days: 3
|
||||
- name: 📊 Print sccache stats
|
||||
run: sccache --show-stats
|
||||
- name: 🛑 Stop sccache server
|
||||
run: sccache --stop-server || true
|
||||
- name: Setup WSL
|
||||
uses: Vampire/setup-wsl@v1
|
||||
with:
|
||||
distribution: Debian
|
||||
use-cache: 'true'
|
||||
wsl-shell-user: root
|
||||
set-as-default: 'true'
|
||||
wsl-conf: |
|
||||
[automount]
|
||||
options = "metadata"
|
||||
additional-packages:
|
||||
ca-certificates
|
||||
curl
|
||||
locales
|
||||
python3 python3-pip
|
||||
git
|
||||
openssl
|
||||
ssh
|
||||
- shell: wsl-bash {0}
|
||||
name: Deploy
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
GITHUB_ACTIONS: "true"
|
||||
GITHUB_WORKSPACE: ${{ env.GITHUB_WORKSPACE }}
|
||||
GITHUB_REF: ${{ env.GITHUB_REF }}
|
||||
GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
|
||||
WSLENV: LIEF_S3_KEY:LIEF_S3_SECRET:GITHUB_ACTIONS:GITHUB_WORKSPACE:GITHUB_REF:GITHUB_REPOSITORY
|
||||
run: |
|
||||
python3 -m pip install --no-cache-dir --upgrade pip setuptools requests mako wheel boto3
|
||||
python3 .github/deploy.py
|
||||
@@ -1,62 +0,0 @@
|
||||
|
||||
name: LIEF Windows x86 Quick
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
- '!master'
|
||||
- '!release-**'
|
||||
tags-ignore:
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.9]
|
||||
env:
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
SCCACHE_DIR: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x86
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
choco install sccache
|
||||
python -m pip install --upgrade pip setuptools
|
||||
python -m pip install wheel mako
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
toolset: "14.16"
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
shell: bash
|
||||
- name: Save sccache
|
||||
uses: actions/cache@v2
|
||||
continue-on-error: false
|
||||
with:
|
||||
path: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
|
||||
key: ${{ runner.os }}-x86-sccache-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-x86-sccache-
|
||||
- name: Start sccache server
|
||||
run: sccache --start-server
|
||||
- name: ⛓ Build Python ${{ matrix.python-version }} & Test
|
||||
run: |
|
||||
python ./setup.py --ninja --lief-test bdist_wheel
|
||||
shell: cmd
|
||||
- name: 📊 Print sccache stats
|
||||
run: sccache --show-stats
|
||||
- name: 🛑 Stop sccache server
|
||||
run: sccache --stop-server || true
|
||||
@@ -0,0 +1,5 @@
|
||||
build/
|
||||
*.so
|
||||
*.whl
|
||||
lief.egg-info/
|
||||
dist/
|
||||
+164
-164
@@ -1,19 +1,18 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
endif()
|
||||
|
||||
# Enable https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# Modules
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
|
||||
set(IS_WIN_CROSS_COMPILE 0)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_CROSSCOMPILING)
|
||||
set(IS_WIN_CROSS_COMPILE 1)
|
||||
endif()
|
||||
|
||||
|
||||
if(WIN32 OR ${IS_WIN_CROSS_COMPILE})
|
||||
include(ChooseMSVCCRT)
|
||||
endif()
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckCCompilerFlag)
|
||||
include(ExternalProject)
|
||||
@@ -28,7 +27,7 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git"
|
||||
include(LIEFGit)
|
||||
else()
|
||||
set(LIEF_VERSION_MAJOR "0")
|
||||
set(LIEF_VERSION_MINOR "13")
|
||||
set(LIEF_VERSION_MINOR "14")
|
||||
set(LIEF_VERSION_PATCH "0")
|
||||
endif()
|
||||
|
||||
@@ -39,6 +38,36 @@ project(
|
||||
VERSION ${LIEF_VERSION_MAJOR}.${LIEF_VERSION_MINOR}.${LIEF_VERSION_PATCH})
|
||||
message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION}")
|
||||
|
||||
# Select the MSVC runtime based on the LIEF_USE_CRT_XXX variable
|
||||
if(MSVC)
|
||||
foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
|
||||
string(TOUPPER "${build_type}" build)
|
||||
if(DEFINED "LIEF_USE_CRT_${build}")
|
||||
set(runtime "${LIEF_USE_CRT_${build}}")
|
||||
if(build_type STREQUAL Debug)
|
||||
set(default_runtime MDd)
|
||||
else()
|
||||
set(default_runtime MD)
|
||||
endif()
|
||||
if(runtime AND NOT "${runtime}" STREQUAL "${default_runtime}")
|
||||
if(runtime STREQUAL "MT")
|
||||
set(runtime_library "MultiThreaded")
|
||||
elseif(runtime STREQUAL "MD")
|
||||
set(runtime_library "MultiThreadedDLL")
|
||||
elseif(runtime STREQUAL "MTd")
|
||||
set(runtime_library "MultiThreadedDebug")
|
||||
elseif(runtime STREQUAL "MDd")
|
||||
set(runtime_library "MultiThreadedDebugDLL")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported value LIEF_USE_CRT_${build}=${runtime}")
|
||||
endif()
|
||||
message(STATUS "LIEF_CRT_${build}: ${runtime}")
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}$<$<CONFIG:${build_type}>:${runtime_library}>")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# LIEF options
|
||||
# =============
|
||||
include(LIEFOptions)
|
||||
@@ -108,7 +137,6 @@ set(LIBLIEF_SOURCE_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/errors.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/hash_stream.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/logging.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/exception.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/iostream.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal_utils.cpp"
|
||||
@@ -130,7 +158,6 @@ set(LIEF_INC_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/span.hpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/ELF.hpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Abstract.hpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/exception.hpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iostream.hpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iterators.hpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/LIEF.hpp"
|
||||
@@ -176,7 +203,10 @@ source_group("Source Files" FILES ${LIBLIEF_SOURCE_FILES})
|
||||
source_group("Header Files\\visitors" FILES ${LIEF_VISITOR_INCLUDE_FILES})
|
||||
|
||||
add_library(LIB_LIEF ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES})
|
||||
add_library(LIEF::LIEF ALIAS LIB_LIEF)
|
||||
|
||||
if(NOT LIEF_PY_LIEF_EXT)
|
||||
add_library(LIEF::LIEF ALIAS LIB_LIEF)
|
||||
endif()
|
||||
|
||||
if(NOT LIEF_OPT_MBEDTLS_EXTERNAL)
|
||||
set_source_files_properties(${mbedtls_src_crypto} PROPERTIES GENERATED TRUE)
|
||||
@@ -209,9 +239,8 @@ if(WINDOWS AND BUILD_SHARED_LIBS)
|
||||
target_link_libraries(LIB_LIEF ws2_32)
|
||||
endif()
|
||||
|
||||
if(MSVC OR ${IS_WIN_CROSS_COMPILE})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
|
||||
if(MSVC)
|
||||
add_compile_options(/bigobj)
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug AND WINDOWS)
|
||||
@@ -228,9 +257,6 @@ if(BUILD_SHARED_LIBS OR LIEF_FORCE_API_EXPORTS)
|
||||
else()
|
||||
target_compile_definitions(LIB_LIEF PRIVATE -DLIEF_STATIC)
|
||||
endif()
|
||||
if(LIEF_SUPPORT_CXX14)
|
||||
target_compile_features(LIB_LIEF PRIVATE cxx_std_14)
|
||||
endif()
|
||||
|
||||
# Abstract part
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/src/Abstract/CMakeLists.txt")
|
||||
@@ -266,16 +292,13 @@ endif()
|
||||
# =====================
|
||||
|
||||
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_DISABLE_DEFAULT_LOGGER
|
||||
SPDLOG_NO_EXCEPTIONS
|
||||
SPDLOG_FUNCTION=)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_NO_EXCEPTIONS SPDLOG_NO_THREAD_ID)
|
||||
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_NO_THREAD_ID)
|
||||
endif()
|
||||
|
||||
# Frozen Configuration
|
||||
# ====================
|
||||
if(LIEF_FROZEN_ENABLED)
|
||||
endif()
|
||||
|
||||
# OAT part
|
||||
# ========
|
||||
@@ -333,7 +356,7 @@ list(APPEND LIEF_PUBLIC_INCLUDE_DIR
|
||||
list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${LIEF_PUBLIC_INCLUDE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/LIEF.pc.in ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/LIEF.pc.in ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
|
||||
@ONLY)
|
||||
|
||||
target_include_directories(LIB_LIEF
|
||||
@@ -372,29 +395,28 @@ if(LIEF_FROZEN_ENABLED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# =======================================
|
||||
# Leaf
|
||||
# Expected
|
||||
# =======================================
|
||||
if(LIEF_EXTERNAL_LEAF)
|
||||
message(STATUS "Using external LEAF version")
|
||||
if(LIEF_EXTERNAL_LEAF_DIR)
|
||||
message(STATUS "External LEAF include dir: ${LIEF_EXTERNAL_LEAF_DIR}")
|
||||
target_include_directories(LIB_LIEF SYSTEM PUBLIC
|
||||
"$<BUILD_INTERFACE:${LIEF_EXTERNAL_LEAF_DIR}>")
|
||||
endif()
|
||||
if(LIEF_EXTERNAL_EXPECTED)
|
||||
message(STATUS "Using external Expected version")
|
||||
find_package(tl-expected REQUIRED)
|
||||
target_link_libraries(LIB_LIEF PUBLIC tl::expected)
|
||||
else()
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/leaf.hpp
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/expected.hpp
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy_directory ${LEAF_SRC_DIR}/
|
||||
${CMAKE_COMMAND} -E copy_directory ${EXPECTED_SRC_DIR}/include/tl/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/
|
||||
DEPENDS lief_leaf)
|
||||
DEPENDS lief_expected)
|
||||
|
||||
target_sources(LIB_LIEF PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/leaf.hpp)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/expected.hpp)
|
||||
endif()
|
||||
|
||||
|
||||
# =======================================
|
||||
# utfcpp
|
||||
# =======================================
|
||||
@@ -438,10 +460,12 @@ else()
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/span.hpp)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
target_link_libraries(LIB_LIEF PRIVATE lief_spdlog)
|
||||
|
||||
if(ANDROID AND BUILD_SHARED_LIBS AND LIEF_LOGGING)
|
||||
target_link_libraries(LIB_LIEF PUBLIC log)
|
||||
endif()
|
||||
|
||||
# Flags definition
|
||||
# ----------------
|
||||
|
||||
@@ -449,7 +473,7 @@ target_link_libraries(LIB_LIEF PRIVATE lief_spdlog)
|
||||
set_target_properties(
|
||||
LIB_LIEF
|
||||
PROPERTIES POSITION_INDEPENDENT_CODE ON
|
||||
CXX_STANDARD 11
|
||||
CXX_STANDARD 17
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
C_VISIBILITY_PRESET hidden)
|
||||
@@ -464,15 +488,6 @@ endif()
|
||||
|
||||
target_compile_definitions(LIB_LIEF PUBLIC -D_GLIBCXX_USE_CXX11_ABI=1)
|
||||
|
||||
# Enable support for MD2 and MD4 for parsing the Authenticode sigs of older
|
||||
# executables. Also, some older signed executables use certs with the
|
||||
# SpcSpAgencyInfo Critical Extension, which mbed TLS doesn't support, so set
|
||||
# MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION to have it skip this
|
||||
# extension.
|
||||
add_definitions(-DMBEDTLS_FS_IO -DMBEDTLS_PEM_PARSE_C -DMBEDTLS_BIGNUM_C
|
||||
-DMBEDTLS_X509_CRT_PARSE_C -DMBEDTLS_PEM_WRITE_C
|
||||
-DMBEDTLS_PKCS1_V15 -DMBEDTLS_PKCS1_V21)
|
||||
|
||||
# LIEF Sanitizer options
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
set(SANITIZER_FLAGS -fno-omit-frame-pointer -g -O1)
|
||||
@@ -541,36 +556,16 @@ if(LIEF_FUZZING)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/fuzzing")
|
||||
endif()
|
||||
|
||||
# Compile Flags
|
||||
# =============
|
||||
include(LIEFCompilerFlags)
|
||||
|
||||
# Profiling flags
|
||||
# ---------------
|
||||
if(LIEF_PROFILING)
|
||||
set(PROFILING_FLAGS
|
||||
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc
|
||||
-fno-builtin-free -fno-omit-frame-pointer -g)
|
||||
target_compile_options(LIB_LIEF PUBLIC ${PROFILING_FLAGS})
|
||||
|
||||
add_executable(elf_profiler profiling/elf_profiler.cpp)
|
||||
target_compile_options(elf_profiler PUBLIC ${PROFILING_FLAGS})
|
||||
target_link_libraries(elf_profiler PRIVATE LIB_LIEF)
|
||||
|
||||
add_executable(macho_profiler profiling/macho_profiler.cpp)
|
||||
target_compile_options(macho_profiler PUBLIC ${PROFILING_FLAGS})
|
||||
target_link_libraries(macho_profiler PRIVATE LIB_LIEF)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/profiling")
|
||||
endif()
|
||||
|
||||
# Coverage flags
|
||||
# --------------
|
||||
if(LIEF_COVERAGE)
|
||||
target_compile_options(LIB_LIEF PRIVATE -g -O0 --coverage -fprofile-arcs
|
||||
-ftest-coverage)
|
||||
target_link_libraries(LIB_LIEF gcov)
|
||||
endif()
|
||||
|
||||
set_target_properties(LIB_LIEF PROPERTIES OUTPUT_NAME LIEF EXPORT_NAME LIEF CLEAN_DIRECT_OUTPUT 1)
|
||||
set_target_properties(LIB_LIEF PROPERTIES
|
||||
OUTPUT_NAME LIEF
|
||||
EXPORT_NAME LIEF
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
|
||||
|
||||
# Set a default build type if none was specified
|
||||
@@ -615,18 +610,6 @@ if(LIEF_DOC)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/doc)
|
||||
endif()
|
||||
|
||||
# Find Package Config
|
||||
# ======================
|
||||
configure_file(
|
||||
LIEFConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
|
||||
@ONLY)
|
||||
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
# Post-build operations
|
||||
# ======================
|
||||
if(BUILD_SHARED_LIBS AND CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
@@ -649,84 +632,101 @@ if(BUILD_SHARED_LIBS AND CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Install Prefix
|
||||
# ======================
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND UNIX)
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(CMAKE_INSTALL_PREFIX
|
||||
"/usr"
|
||||
CACHE PATH "Install path prefix prepended on to install directories."
|
||||
FORCE)
|
||||
elseif(APPLE)
|
||||
set(CMAKE_INSTALL_PREFIX
|
||||
"/usr/local"
|
||||
CACHE PATH "" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
# Generate install target and package
|
||||
# =======================================
|
||||
if(LIEF_INSTALL)
|
||||
|
||||
# Installation
|
||||
# ======================
|
||||
# Find Package Config
|
||||
# ======================
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LIEFConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
|
||||
@ONLY)
|
||||
|
||||
if(UNIX)
|
||||
include(GNUInstallDirs)
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
else()
|
||||
if(WIN32)
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
set(CMAKE_INSTALL_DATADIR "share")
|
||||
set(CMAKE_INSTALL_INCLUDEDIR "include")
|
||||
set(CMAKE_INSTALL_BINDIR "bin")
|
||||
set(CMAKE_INSTALL_DATAROOTDIR "share")
|
||||
message(STATUS "Setting installation destination on Windows to: ${CMAKE_INSTALL_PREFIX}")
|
||||
else()
|
||||
message(FATAL_ERROR "System not UNIX nor WIN32 - not implemented yet")
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
# Install Prefix
|
||||
# ======================
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND UNIX)
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(CMAKE_INSTALL_PREFIX
|
||||
"/usr"
|
||||
CACHE PATH "Install path prefix prepended on to install directories."
|
||||
FORCE)
|
||||
elseif(APPLE)
|
||||
set(CMAKE_INSTALL_PREFIX
|
||||
"/usr/local"
|
||||
CACHE PATH "" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Installation
|
||||
# ======================
|
||||
|
||||
if(UNIX)
|
||||
include(GNUInstallDirs)
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
else()
|
||||
if(WIN32)
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
set(CMAKE_INSTALL_DATADIR "share")
|
||||
set(CMAKE_INSTALL_INCLUDEDIR "include")
|
||||
set(CMAKE_INSTALL_BINDIR "bin")
|
||||
set(CMAKE_INSTALL_DATAROOTDIR "share")
|
||||
message(STATUS "Setting installation destination on Windows to: ${CMAKE_INSTALL_PREFIX}")
|
||||
else()
|
||||
message(FATAL_ERROR "System not UNIX nor WIN32 - not implemented yet")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS LIB_LIEF lief_spdlog
|
||||
EXPORT LIEFExport
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
install(
|
||||
DIRECTORY ${LIEF_PUBLIC_INCLUDE_DIR}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
COMPONENT headers
|
||||
FILES_MATCHING
|
||||
REGEX "(.*).(hpp|h|def|inc)$")
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/LIEF/cmake
|
||||
COMPONENT config)
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
||||
COMPONENT libraries)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(lib_type shared)
|
||||
else()
|
||||
set(lib_type static)
|
||||
endif()
|
||||
|
||||
install(
|
||||
EXPORT LIEFExport
|
||||
NAMESPACE LIEF::
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/LIEF/cmake
|
||||
FILE LIEFExport-${lib_type}.cmake
|
||||
COMPONENT config)
|
||||
|
||||
export(
|
||||
EXPORT LIEFExport
|
||||
NAMESPACE LIEF::
|
||||
FILE LIEFExport-${lib_type}.cmake)
|
||||
|
||||
# Package
|
||||
# ======================
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/package")
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS LIB_LIEF lief_spdlog
|
||||
EXPORT LIEFExport
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
install(
|
||||
DIRECTORY ${LIEF_PUBLIC_INCLUDE_DIR}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
COMPONENT headers
|
||||
FILES_MATCHING
|
||||
REGEX "(.*).(hpp|h|def|inc)$")
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/LIEF/cmake
|
||||
COMPONENT config)
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
||||
COMPONENT libraries)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(lib_type shared)
|
||||
else()
|
||||
set(lib_type static)
|
||||
endif()
|
||||
|
||||
install(
|
||||
EXPORT LIEFExport
|
||||
NAMESPACE LIEF::
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/LIEF/cmake
|
||||
FILE LIEFExport-${lib_type}.cmake
|
||||
COMPONENT config)
|
||||
|
||||
export(
|
||||
EXPORT LIEFExport
|
||||
NAMESPACE LIEF::
|
||||
FILE LIEFExport-${lib_type}.cmake)
|
||||
|
||||
# Package
|
||||
# ======================
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/package")
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
# Docker file used to compile LIEF on Linux x86-64 compliant with Python tag: manylinux1
|
||||
# docker build -t liefproject/manylinux1_x86_64:latest -f ./Dockerfile .
|
||||
FROM quay.io/pypa/manylinux1_x86_64:2020-12-30-e2b3664
|
||||
|
||||
RUN yum update -y \
|
||||
&& yum install -y ccache \
|
||||
&& yum clean all
|
||||
|
||||
RUN /opt/python/cp37-cp37m/bin/pip install cmake==3.13.3 ninja==1.10.0.post2
|
||||
ENV PATH=$PATH:/opt/python/cp37-cp37m/bin/
|
||||
|
||||
RUN curl --output /tmp/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2 -L https://github.com/squeaky-pl/centos-devtools/releases/download/6.3/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2 && \
|
||||
echo "ca3e9f92411507018c839c8cc2b496f14956a49fcf6df0cdcb356de7161bcbc5 /tmp/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2" | sha256sum --check --status && \
|
||||
tar -C / -xj -f /tmp/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2 && \
|
||||
rm -rf /tmp/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2
|
||||
|
||||
ENV CC=/opt/devtools-6.3/bin/gcc
|
||||
ENV CXX=/opt/devtools-6.3/bin/g++
|
||||
ENV CXXFLAGS="-static-libstdc++ -static-libgcc"
|
||||
|
||||
WORKDIR /src
|
||||
@@ -186,8 +186,8 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2017 - 2022 R. Thomas
|
||||
Copyright 2017 - 2022 Quarkslab
|
||||
Copyright 2017 - 2023 R. Thomas
|
||||
Copyright 2017 - 2023 Quarkslab
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
include README.md LICENSE setup.cfg CMakeLists.txt LIEF.pc.in LIEFConfig.cmake.in
|
||||
|
||||
# Examples
|
||||
recursive-include examples *
|
||||
|
||||
# LIEF Sources
|
||||
recursive-include src *
|
||||
recursive-include include *
|
||||
|
||||
recursive-include third-party *
|
||||
recursive-include cmake *
|
||||
recursive-include scripts *
|
||||
|
||||
# Bindings
|
||||
recursive-include api *
|
||||
prune api/python/build
|
||||
|
||||
# Global exclude
|
||||
recursive-exclude *.egg-info *.so
|
||||
|
||||
# Install script
|
||||
recursive-include package *
|
||||
|
||||
# Documentation
|
||||
recursive-include doc *
|
||||
|
||||
@@ -3,32 +3,32 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://gitter.im/lief-project">
|
||||
<img src="https://img.shields.io/gitter/room/gitterHQ/gitter.svg?style=flat-square">
|
||||
<a href="https://discord.gg/7hRFGWYedu">
|
||||
<img src="https://img.shields.io/discord/1117013848914931762">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/lief-project/LIEF/actions?query=workflow%3A%22Linux+x86-64%22">
|
||||
<img alt="Linux x86-64 CI status" src="https://img.shields.io/github/workflow/status/lief-project/LIEF/Linux%20x86-64/master?label=Linux%20x86-64&logo=github">
|
||||
<a href="https://github.com/lief-project/LIEF/actions/workflows/linux-x86-64.yml">
|
||||
<img alt="Linux x86-64 CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/linux-x86-64.yml?branch=master&label=Linux%20x86-64&logo=github">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/lief-project/LIEF/actions?query=workflow%3A%22Linux+AArch64%22">
|
||||
<img alt="Linux AArch64 CI status" src="https://img.shields.io/github/workflow/status/lief-project/LIEF/Linux%20AArch64/master?label=Linux%20AArch64&logo=github">
|
||||
<a href="https://github.com/lief-project/LIEF/actions/workflows/linux-aarch64.yml">
|
||||
<img alt="Linux AArch64 CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/linux-aarch64.yml?branch=master&label=Linux%20AArch64&logo=github">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/lief-project/LIEF/actions?query=workflow%3AAndroid">
|
||||
<img alt="Android CI status" src="https://img.shields.io/github/workflow/status/lief-project/LIEF/Android/master?label=Android&logo=github">
|
||||
<a href="https://github.com/lief-project/LIEF/actions/workflows/android.yml">
|
||||
<img alt="Android CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/android.yml?branch=master&label=Android&logo=github">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/lief-project/LIEF/actions?query=workflow%3AmacOS">
|
||||
<img alt="macOS CI status" src="https://img.shields.io/github/workflow/status/lief-project/LIEF/macOS/master?label=macOS&logo=github">
|
||||
<a href="https://github.com/lief-project/LIEF/actions/workflows/osx.yml">
|
||||
<img alt="macOS CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/osx.yml?branch=master&label=macOS&logo=github">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/lief-project/LIEF/actions?query=workflow%3AiOS">
|
||||
<img alt="iOS CI status" src="https://img.shields.io/github/workflow/status/lief-project/LIEF/iOS/master?label=iOS&logo=github">
|
||||
<a href="https://github.com/lief-project/LIEF/actions/workflows/ios.yml">
|
||||
<img alt="iOS CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/ios.yml?branch=master&label=iOS&logo=github">
|
||||
</a>
|
||||
|
||||
<a href="https://ci.appveyor.com/project/Romain/lief/branch/master">
|
||||
<img alt="Windows CI status" src="https://img.shields.io/appveyor/build/Romain/LIEF/master?label=Windows&logo=appveyor">
|
||||
<a href="https://github.com/lief-project/LIEF/actions/workflows/windows-all.yml">
|
||||
<img alt="Windows CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/windows-all.yml?branch=master&label=Windows&logo=github">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/lief-project/LIEF/releases">
|
||||
@@ -36,7 +36,7 @@
|
||||
</a>
|
||||
|
||||
<a href="https://twitter.com/LIEF_project">
|
||||
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/lief_project?color=1da1f2&label=Follow&logo=twitter&logoColor=white&style=flat-square">
|
||||
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/lief_project">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<p align="center">
|
||||
<a href="https://lief-project.github.io/blog/"><b>Blog</b></a> •
|
||||
<a href="https://lief-project.github.io/doc/latest/index.html"><b>Documentation</b></a> •
|
||||
<a href="#about-A"><b>About</b></a>
|
||||
<a href="#user-content-about-1"><b>About</b></a>
|
||||
</p>
|
||||
<br />
|
||||
|
||||
@@ -105,7 +105,7 @@ pip install lief
|
||||
To install nightly build:
|
||||
|
||||
```console
|
||||
pip install [--user] --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief==0.13.0.dev0
|
||||
pip install [--user] --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief==0.14.0.dev0
|
||||
```
|
||||
|
||||
### Packages
|
||||
@@ -113,7 +113,7 @@ pip install [--user] --index-url https://lief.s3-website.fr-par.scw.cloud/latest
|
||||
- **Nightly**:
|
||||
* SDK: https://lief.s3-website.fr-par.scw.cloud/latest/sdk
|
||||
* Python Wheels: https://lief.s3-website.fr-par.scw.cloud/latest/lief
|
||||
- **v0.12.0**: https://github.com/lief-project/LIEF/releases/tag/0.12.0
|
||||
- **v0.13.2**: https://github.com/lief-project/LIEF/releases/tag/0.13.2
|
||||
|
||||
Here are guides to install or integrate LIEF:
|
||||
|
||||
@@ -149,27 +149,18 @@ print(binary)
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// ELF
|
||||
try {
|
||||
std::unique_ptr<LIEF::ELF::Binary> elf = LIEF::ELF::Parser::parse("/bin/ls");
|
||||
std::cout << *elf << std::endl;
|
||||
} catch (const LIEF::exception& err) {
|
||||
std::cerr << err.what() << std::endl;
|
||||
if (std::unique_ptr<const LIEF::ELF::Binary> elf = LIEF::ELF::Parser::parse("/bin/ls")) {
|
||||
std::cout << *elf << '\n';
|
||||
}
|
||||
|
||||
// PE
|
||||
try {
|
||||
std::unique_ptr<LIEF::PE::Binary> pe = LIEF::PE::Parser::parse("C:\\Windows\\explorer.exe");
|
||||
std::cout << *pe << std::endl;
|
||||
} catch (const LIEF::exception& err) {
|
||||
std::cerr << err.what() << std::endl;
|
||||
if (std::unique_ptr<const LIEF::PE::Binary> pe = LIEF::PE::Parser::parse("C:\\Windows\\explorer.exe")) {
|
||||
std::cout << *pe << '\n';
|
||||
}
|
||||
|
||||
// Mach-O
|
||||
try {
|
||||
std::unique_ptr<LIEF::MachO::FatBinary> macho = LIEF::MachO::Parser::parse("/bin/ls");
|
||||
std::cout << *macho << std::endl;
|
||||
} catch (const LIEF::exception& err) {
|
||||
std::cerr << err.what() << std::endl;
|
||||
if (std::unique_ptr<LIEF::MachO::FatBinary> macho = LIEF::MachO::Parser::parse("/bin/ls")) {
|
||||
std::cout << *macho << '\n';
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -206,7 +197,7 @@ int main(int argc, char** argv) {
|
||||
## Contact
|
||||
|
||||
* **Mail**: contact at lief re
|
||||
* **Gitter**: [lief-project](https://gitter.im/lief-project)
|
||||
* **Discord**: [LIEF](https://discord.gg/7hRFGWYedu)
|
||||
|
||||
## About
|
||||
|
||||
@@ -216,19 +207,18 @@ Romain Thomas ([@rh0main](https://twitter.com/rh0main)) - [Quarkslab](https://ww
|
||||
|
||||
### License
|
||||
|
||||
LIEF is provided under the [Apache 2.0 license](https://github.com/lief-project/LIEF/blob/0.12.0/LICENSE).
|
||||
LIEF is provided under the [Apache 2.0 license](https://github.com/lief-project/LIEF/blob/0.13.0/LICENSE).
|
||||
|
||||
### Bibtex
|
||||
|
||||
```latex
|
||||
```bibtex
|
||||
@MISC {LIEF,
|
||||
author = "Romain Thomas",
|
||||
title = "LIEF - Library to Instrument Executable Formats",
|
||||
howpublished = "https://lief.quarkslab.com/",
|
||||
month = "April",
|
||||
year = "2017",
|
||||
month = "apr",
|
||||
year = "2017"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,7 +36,6 @@ namespace LIEF {
|
||||
namespace ELF {
|
||||
void init_c_binary(Elf_Binary_t* c_binary, Binary* binary) {
|
||||
c_binary->handler = reinterpret_cast<void*>(binary);
|
||||
c_binary->name = binary->name().c_str();
|
||||
c_binary->type = static_cast<enum LIEF_ELF_ELF_CLASS>(binary->type());
|
||||
c_binary->interpreter = nullptr;
|
||||
if (binary->has_interpreter()) {
|
||||
@@ -65,6 +64,11 @@ void init_c_binary(Elf_Binary_t* c_binary, Binary* binary) {
|
||||
|
||||
Elf_Binary_t* elf_parse(const char *file) {
|
||||
Binary* binary = Parser::parse(file).release();
|
||||
|
||||
if (binary == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto* c_binary = static_cast<Elf_Binary_t*>(malloc(sizeof(Elf_Binary_t)));
|
||||
memset(c_binary, 0, sizeof(Elf_Binary_t));
|
||||
init_c_binary(c_binary, binary);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -162,9 +162,9 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
|
||||
{
|
||||
c_binary->dynamic_entries[i] =
|
||||
static_cast<Elf_DynamicEntry_t*>(malloc(sizeof(Elf_DynamicEntry_t)));
|
||||
c_binary->dynamic_entries[i]->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
|
||||
c_binary->dynamic_entries[i]->tag = static_cast<uint64_t>(entry.tag());
|
||||
c_binary->dynamic_entries[i]->value = entry.value();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,14 +208,24 @@ void destroy_dynamic_entries(Elf_Binary_t* c_binary) {
|
||||
case DYNAMIC_TAGS::DT_FINI_ARRAY:
|
||||
case DYNAMIC_TAGS::DT_PREINIT_ARRAY:
|
||||
{
|
||||
free(reinterpret_cast<Elf_DynamicEntry_Array_t*>(dynamic_entries[idx]));
|
||||
Elf_DynamicEntry_Array_t* entry_array=reinterpret_cast<Elf_DynamicEntry_Array_t*>(dynamic_entries[idx]);
|
||||
free(entry_array->array);
|
||||
free(entry_array);
|
||||
break;
|
||||
}
|
||||
|
||||
case DYNAMIC_TAGS::DT_FLAGS:
|
||||
{
|
||||
Elf_DynamicEntry_Flags_t* entry_flags=reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]);
|
||||
free(entry_flags->flags);
|
||||
free(entry_flags);
|
||||
break;
|
||||
}
|
||||
case DYNAMIC_TAGS::DT_FLAGS_1:
|
||||
{
|
||||
free(reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]));
|
||||
Elf_DynamicEntry_Flags_t* entry_flags=reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]);
|
||||
free(entry_flags->flags_1);
|
||||
free(entry_flags);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,9 +28,6 @@ void init_c_sections(Elf_Binary_t* c_binary, Binary* binary) {
|
||||
Section& b_section = sections[i];
|
||||
c_binary->sections[i] = static_cast<Elf_Section_t*>(malloc(sizeof(Elf_Section_t)));
|
||||
span<const uint8_t> section_content = b_section.content();
|
||||
auto* content = static_cast<uint8_t*>(malloc(section_content.size() * sizeof(uint8_t)));
|
||||
std::copy(std::begin(section_content), std::end(section_content),
|
||||
content);
|
||||
|
||||
c_binary->sections[i]->name = b_section.fullname().c_str();
|
||||
c_binary->sections[i]->flags = b_section.flags();
|
||||
@@ -42,9 +39,10 @@ void init_c_sections(Elf_Binary_t* c_binary, Binary* binary) {
|
||||
c_binary->sections[i]->info = b_section.information();
|
||||
c_binary->sections[i]->alignment = b_section.alignment();
|
||||
c_binary->sections[i]->entry_size = b_section.entry_size();
|
||||
c_binary->sections[i]->content = content;
|
||||
c_binary->sections[i]->size = section_content.size();
|
||||
c_binary->sections[i]->entropy = b_section.entropy();
|
||||
c_binary->sections[i]->content = !section_content.empty() ?
|
||||
const_cast<uint8_t*>(section_content.data()) : nullptr;
|
||||
}
|
||||
c_binary->sections[sections.size()] = nullptr;
|
||||
|
||||
@@ -56,7 +54,6 @@ void destroy_sections(Elf_Binary_t* c_binary) {
|
||||
|
||||
Elf_Section_t **sections = c_binary->sections;
|
||||
for (size_t idx = 0; sections[idx] != nullptr; ++idx) {
|
||||
free(sections[idx]->content);
|
||||
free(sections[idx]);
|
||||
}
|
||||
free(c_binary->sections);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,11 +27,6 @@ void init_c_segments(Elf_Binary_t* c_binary, Binary* binary) {
|
||||
Segment& segment = segments[i];
|
||||
|
||||
span<const uint8_t> segment_content = segment.content();
|
||||
auto* content = static_cast<uint8_t*>(malloc(segment_content.size() * sizeof(uint8_t)));
|
||||
std::copy(
|
||||
std::begin(segment_content),
|
||||
std::end(segment_content),
|
||||
content);
|
||||
|
||||
c_binary->segments[i] = static_cast<Elf_Segment_t*>(malloc(sizeof(Elf_Segment_t)));
|
||||
c_binary->segments[i]->type = static_cast<enum LIEF_ELF_SEGMENT_TYPES>(segment.type());
|
||||
@@ -41,7 +36,8 @@ void init_c_segments(Elf_Binary_t* c_binary, Binary* binary) {
|
||||
c_binary->segments[i]->offset = segment.file_offset();
|
||||
c_binary->segments[i]->alignment = segment.alignment();
|
||||
c_binary->segments[i]->size = segment_content.size();
|
||||
c_binary->segments[i]->content = content;
|
||||
c_binary->segments[i]->content = !segment_content.empty() ?
|
||||
const_cast<uint8_t*>(segment_content.data()) : nullptr;
|
||||
}
|
||||
|
||||
c_binary->segments[segments.size()] = nullptr;
|
||||
@@ -54,7 +50,6 @@ void destroy_segments(Elf_Binary_t* c_binary) {
|
||||
|
||||
Elf_Segment_t **segments = c_binary->segments;
|
||||
for (size_t idx = 0; segments[idx] != nullptr; ++idx) {
|
||||
free(segments[idx]->content);
|
||||
free(segments[idx]);
|
||||
}
|
||||
free(c_binary->segments);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,6 @@ namespace MachO {
|
||||
void init_c_binary(Macho_Binary_t* c_binary, Binary* binary) {
|
||||
|
||||
c_binary->handler = reinterpret_cast<void*>(binary);
|
||||
c_binary->name = binary->name().c_str();
|
||||
c_binary->imagebase = binary->imagebase();
|
||||
init_c_header(c_binary, binary);
|
||||
init_c_commands(c_binary, binary);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
+12
-4
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,11 +25,16 @@ using namespace LIEF::MachO;
|
||||
|
||||
Macho_Binary_t** macho_parse(const char *file) {
|
||||
FatBinary* fat = Parser::parse(file).release();
|
||||
if (fat == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t nb_bin = fat->size();
|
||||
|
||||
auto** c_macho_binaries = static_cast<Macho_Binary_t**>(
|
||||
malloc((fat->size() + 1) * sizeof(Macho_Binary_t**)));
|
||||
|
||||
for (size_t i = 0; i < fat->size(); ++i) {
|
||||
for (size_t i = 0; i < nb_bin; ++i) {
|
||||
Binary* binary = fat->at(i);
|
||||
if (binary != nullptr) {
|
||||
c_macho_binaries[i] = static_cast<Macho_Binary_t*>(malloc(sizeof(Macho_Binary_t)));
|
||||
@@ -37,7 +42,10 @@ Macho_Binary_t** macho_parse(const char *file) {
|
||||
}
|
||||
}
|
||||
|
||||
c_macho_binaries[fat->size()] = nullptr;
|
||||
fat->release_all_binaries();
|
||||
|
||||
c_macho_binaries[nb_bin] = nullptr;
|
||||
delete fat;
|
||||
|
||||
return c_macho_binaries;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
+7
-3
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,7 +34,6 @@ namespace LIEF {
|
||||
namespace PE {
|
||||
|
||||
void init_c_binary(Pe_Binary_t* c_binary, Binary* binary) {
|
||||
c_binary->name = binary->name().c_str();
|
||||
c_binary->handler = reinterpret_cast<void*>(binary);
|
||||
|
||||
init_c_dos_header(c_binary, binary);
|
||||
@@ -51,6 +50,11 @@ void init_c_binary(Pe_Binary_t* c_binary, Binary* binary) {
|
||||
|
||||
Pe_Binary_t* pe_parse(const char *file) {
|
||||
Binary* binary = Parser::parse(file).release();
|
||||
|
||||
if (binary == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto* c_binary = static_cast<Pe_Binary_t*>(malloc(sizeof(Pe_Binary_t)));
|
||||
std::memset(c_binary, 0, sizeof(Pe_Binary_t));
|
||||
init_c_binary(c_binary, binary);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef C_LIEF_ELF_H_
|
||||
#define C_LIEF_ELF_H_
|
||||
|
||||
//! @defgroup elf_c_api ELF C API
|
||||
/** @defgroup elf_c_api ELF C API */
|
||||
|
||||
#include "LIEF/ELF/Binary.h"
|
||||
#include "LIEF/ELF/Symbol.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,44 +34,44 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct Elf_DynamicEntry_t {
|
||||
enum LIEF_ELF_DYNAMIC_TAGS tag;
|
||||
uint64_t value;
|
||||
uint64_t tag;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
struct Elf_DynamicEntry_Library_t {
|
||||
enum LIEF_ELF_DYNAMIC_TAGS tag;
|
||||
uint64_t value;
|
||||
const char* name;
|
||||
uint64_t tag;
|
||||
uint64_t value;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
struct Elf_DynamicEntry_SharedObject_t {
|
||||
enum LIEF_ELF_DYNAMIC_TAGS tag;
|
||||
uint64_t value;
|
||||
const char* name;
|
||||
uint64_t tag;
|
||||
uint64_t value;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
struct Elf_DynamicEntry_Array_t {
|
||||
enum LIEF_ELF_DYNAMIC_TAGS tag;
|
||||
uint64_t value;
|
||||
uint64_t* array;
|
||||
uint64_t tag;
|
||||
uint64_t value;
|
||||
uint64_t* array;
|
||||
};
|
||||
|
||||
struct Elf_DynamicEntry_Rpath_t {
|
||||
enum LIEF_ELF_DYNAMIC_TAGS tag;
|
||||
uint64_t value;
|
||||
const char* rpath;
|
||||
uint64_t tag;
|
||||
uint64_t value;
|
||||
const char* rpath;
|
||||
};
|
||||
|
||||
struct Elf_DynamicEntry_RunPath_t {
|
||||
enum LIEF_ELF_DYNAMIC_TAGS tag;
|
||||
uint64_t value;
|
||||
const char* runpath;
|
||||
uint64_t tag;
|
||||
uint64_t value;
|
||||
const char* runpath;
|
||||
};
|
||||
|
||||
|
||||
struct Elf_DynamicEntry_Flags_t {
|
||||
enum LIEF_ELF_DYNAMIC_TAGS tag;
|
||||
uint64_t value;
|
||||
uint64_t tag;
|
||||
uint64_t value;
|
||||
enum LIEF_ELF_DYNAMIC_FLAGS *flags;
|
||||
enum LIEF_ELF_DYNAMIC_FLAGS_1 *flags_1;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _LIEF_EN(N) LIEF_ELF_##N // enum LIEF_N {
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_ELF_##N // enum LIEF_N {
|
||||
#define _LIEF_EI(X) LIEF_ELF_##X // LIEF_X
|
||||
#define _LIEF_EN(N) LIEF_ELF_##N
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_ELF_##N
|
||||
#define _LIEF_EI(X) LIEF_ELF_##X
|
||||
|
||||
#include "LIEF/ELF/enums.inc"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef C_LIEF_MACHO_H_
|
||||
#define C_LIEF_MACHO_H_
|
||||
|
||||
//! @defgroup macho_c_api MachO C API
|
||||
/** @defgroup macho_c_api MachO C API */
|
||||
|
||||
#include "LIEF/MachO/Binary.h"
|
||||
#include "LIEF/MachO/Symbol.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,7 +24,7 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "LIEF/visibility.h"
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "LIEF/MachO/Symbol.h"
|
||||
#include "LIEF/MachO/Section.h"
|
||||
#include "LIEF/MachO/Segment.h"
|
||||
#include "LIEF/MachO/enums.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -18,9 +18,9 @@ extern "C" {
|
||||
#undef _LIEF_EI
|
||||
#endif
|
||||
|
||||
#define _LIEF_EN(N) LIEF_MACHO_##N // enum LIEF_N {
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_MACHO_##N // enum LIEF_N {
|
||||
#define _LIEF_EI(X) LIEF_MACHO_##X // LIEF_X
|
||||
#define _LIEF_EN(N) LIEF_MACHO_##N
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_MACHO_##N
|
||||
#define _LIEF_EI(X) LIEF_MACHO_##X
|
||||
|
||||
#include "LIEF/MachO/enums.inc"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef C_LIEF_PE_H_
|
||||
#define C_LIEF_PE_H_
|
||||
|
||||
//! @defgroup pe_c_api PE C API
|
||||
/** @defgroup pe_c_api PE C API */
|
||||
|
||||
#include "LIEF/PE/Binary.h"
|
||||
#include "LIEF/PE/EnumToString.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright 2017 - 2022 R. Thomas
|
||||
* Copyright 2017 - 2022 Quarkslab
|
||||
/* Copyright 2017 - 2023 R. Thomas
|
||||
* Copyright 2017 - 2023 Quarkslab
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user