forked from xt-sys/xtchain
Compare commits
110
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ecef29aa4 | ||
|
|
2d4dffe38f
|
||
|
|
124ef802b3
|
||
|
|
ad326019fd
|
||
|
|
079af46983
|
||
|
|
17fb344798
|
||
|
|
d5595e2a7f
|
||
|
|
317fedec34
|
||
|
|
703df71191
|
||
|
|
4f66ebfd88
|
||
|
|
ba0a50682f
|
||
|
|
3b394fc175
|
||
|
|
97491fb72a
|
||
|
|
ef1065278b
|
||
|
|
391a58dffc
|
||
|
|
bd4b7763d4
|
||
|
|
33ce9e38d2
|
||
|
|
409aa4ffb4
|
||
|
|
b951abd511
|
||
|
|
2171eaeed6
|
||
|
|
7075a9ad58
|
||
|
|
9025a85bcc
|
||
|
|
3342b87fd0
|
||
|
|
cd4b20b701
|
||
|
|
fc120f4f33
|
||
|
|
b8d5a76ee7
|
||
|
|
009d4a3421
|
||
|
|
460d5820da
|
||
|
|
83e84c3ebf
|
||
|
|
eeb1953d87
|
||
|
|
e9707563d7
|
||
|
|
11d0593c9e
|
||
|
|
22a5abd279
|
||
|
|
8c047d6083
|
||
|
|
1832a39ed3
|
||
|
|
2a00526666
|
||
|
|
1f72016fc2
|
||
|
|
a522cdc583
|
||
|
|
37230435aa
|
||
|
|
737dda2960
|
||
|
|
0d468bf245
|
||
|
|
b0baae79ba
|
||
|
|
ecd243ed0d
|
||
|
|
b9d0458a65
|
||
|
|
7fb2227034
|
||
|
|
0e49773bf4
|
||
|
|
5684623164
|
||
|
|
14f2f7cf1f
|
||
|
|
37e38daf36
|
||
|
|
b65a92d147
|
||
|
|
173b6d6dd0
|
||
|
|
2da20a4eba
|
||
|
|
c9ef8a6484
|
||
|
|
be63d61cf4
|
||
|
|
9fd40e9617
|
||
|
|
116d309962
|
||
|
|
6845594e6a
|
||
|
|
69ae9afb88
|
||
|
|
3ae3ceaabb
|
||
|
|
361c0a1cdb
|
||
|
|
d6531be5ee
|
||
|
|
771d3783fa
|
||
|
|
2e7c7ec1d7
|
||
|
|
99f0b83ac7
|
||
|
|
9cc7d052dd
|
||
|
|
abefcf8fe2
|
||
|
|
015bc8a666
|
||
|
|
546d8718d2
|
||
|
|
a65685de5c
|
||
|
|
f9af39e058
|
||
|
|
9b7d73e0e9
|
||
|
|
8eb76f6b90
|
||
|
|
00c659911d
|
||
|
|
b1de0a02b6
|
||
|
|
36df8e42e6
|
||
|
|
7d802e0835
|
||
|
|
1904f94583
|
||
|
|
3096bf9255
|
||
|
|
fdd5e32ea0
|
||
|
|
3a35c39c8e
|
||
|
|
9e200f0139
|
||
|
|
80bbcab65d
|
||
|
|
952db3582a
|
||
|
|
04edfa61dd
|
||
|
|
d7d7ac54b6
|
||
|
|
757c207121
|
||
|
|
7be4e21ea1
|
||
|
|
1d621de2be
|
||
|
|
ca2ba1345c
|
||
|
|
dbf05e76f3
|
||
|
|
323e7d0ce1
|
||
|
|
69ab76846e
|
||
|
|
5c901f2d31
|
||
|
|
7529ec4918
|
||
|
|
c9e595cbb0
|
||
|
|
91b34c1656
|
||
|
|
4cc4e3fa3c
|
||
|
|
a5c591db22
|
||
|
|
f34719b83a
|
||
|
|
50cc5fb1a0
|
||
|
|
51284f1845
|
||
|
|
17fb057dce
|
||
|
|
1fe8fdaca9
|
||
|
|
84f02ccf72
|
||
|
|
31d2bc7e7e
|
||
|
|
1dd591ba93
|
||
|
|
cfd2192e63
|
||
|
|
cf334d86dd
|
||
|
|
ff2c349be3
|
||
|
|
9f712e2ebc
|
@@ -0,0 +1,29 @@
|
|||||||
|
name: Builds
|
||||||
|
run-name: ${{ github.actor }} runs Gitea Actions
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
XTchain:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target: [linux, windows]
|
||||||
|
build: [full, minimal]
|
||||||
|
runs-on: oscw
|
||||||
|
container:
|
||||||
|
image: codingworkshop/oscw-runner:latest
|
||||||
|
steps:
|
||||||
|
- name: Clone repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Build XTchain
|
||||||
|
run: |
|
||||||
|
if [ "${{ matrix.build }}" == "minimal" ]; then
|
||||||
|
./build.sh --jobs=10 --target=${{ matrix.target }} --minimal
|
||||||
|
else
|
||||||
|
./build.sh --jobs=10 --target=${{ matrix.target }}
|
||||||
|
fi
|
||||||
|
- name: Publish binaries
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
env:
|
||||||
|
OSCW_GITHUB_USERNAME: ${{ secrets.OSCW_GITHUB_USERNAME }}
|
||||||
|
OSCW_GITHUB_PASSWORD: ${{ secrets.OSCW_GITHUB_PASSWORD }}
|
||||||
|
run: github_publish $OSCW_GITHUB_USERNAME $OSCW_GITHUB_PASSWORD $(ls xtchain-*-${{ matrix.target }}.*)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
binaries/*
|
||||||
|
sources/*
|
||||||
|
xtchain-*.zst
|
||||||
+636
@@ -0,0 +1,636 @@
|
|||||||
|
# GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/)
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||||
|
document, but changing it is not allowed.
|
||||||
|
|
||||||
|
## Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for software and
|
||||||
|
other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed to take
|
||||||
|
away your freedom to share and change the works. By contrast, the GNU General
|
||||||
|
Public License is intended to guarantee your freedom to share and change all
|
||||||
|
versions of a program--to make sure it remains free software for all its users.
|
||||||
|
We, the Free Software Foundation, use the GNU General Public License for most
|
||||||
|
of our software; it applies also to any other work released this way by its
|
||||||
|
authors. You can apply it to your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not price. Our
|
||||||
|
General Public Licenses are designed to make sure that you have the freedom to
|
||||||
|
distribute copies of free software (and charge for them if you wish), that you
|
||||||
|
receive source code or can get it if you want it, that you can change the
|
||||||
|
software or use pieces of it in new free programs, and that you know you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you these rights
|
||||||
|
or asking you to surrender the rights. Therefore, you have certain
|
||||||
|
responsibilities if you distribute copies of the software, or if you modify it:
|
||||||
|
responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether gratis or for
|
||||||
|
a fee, you must pass on to the recipients the same freedoms that you received.
|
||||||
|
You must make sure that they, too, receive or can get the source code. And you
|
||||||
|
must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
|
||||||
|
1. assert copyright on the software, and
|
||||||
|
2. offer you this License giving you legal permission to copy, distribute
|
||||||
|
and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains that
|
||||||
|
there is no warranty for this free software. For both users' and authors' sake,
|
||||||
|
the GPL requires that modified versions be marked as changed, so that their
|
||||||
|
problems will not be attributed erroneously to authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run modified
|
||||||
|
versions of the software inside them, although the manufacturer can do so. This
|
||||||
|
is fundamentally incompatible with the aim of protecting users' freedom to
|
||||||
|
change the software. The systematic pattern of such abuse occurs in the area of
|
||||||
|
products for individuals to use, which is precisely where it is most
|
||||||
|
unacceptable. Therefore, we have designed this version of the GPL to prohibit
|
||||||
|
the practice for those products. If such problems arise substantially in other
|
||||||
|
domains, we stand ready to extend this provision to those domains in future
|
||||||
|
versions of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents. States
|
||||||
|
should not allow patents to restrict development and use of software on
|
||||||
|
general-purpose computers, but in those that do, we wish to avoid the special
|
||||||
|
danger that patents applied to a free program could make it effectively
|
||||||
|
proprietary. To prevent this, the GPL assures that patents cannot be used to
|
||||||
|
render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and modification
|
||||||
|
follow.
|
||||||
|
|
||||||
|
## TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
### 0. Definitions.
|
||||||
|
|
||||||
|
*This License* refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
*Copyright* also means copyright-like laws that apply to other kinds of works,
|
||||||
|
such as semiconductor masks.
|
||||||
|
|
||||||
|
*The Program* refers to any copyrightable work licensed under this License.
|
||||||
|
Each licensee is addressed as *you*. *Licensees* and *recipients* may be
|
||||||
|
individuals or organizations.
|
||||||
|
|
||||||
|
To *modify* a work means to copy from or adapt all or part of the work in a
|
||||||
|
fashion requiring copyright permission, other than the making of an exact copy.
|
||||||
|
The resulting work is called a *modified version* of the earlier work or a work
|
||||||
|
*based on* the earlier work.
|
||||||
|
|
||||||
|
A *covered work* means either the unmodified Program or a work based on the
|
||||||
|
Program.
|
||||||
|
|
||||||
|
To *propagate* a work means to do anything with it that, without permission,
|
||||||
|
would make you directly or secondarily liable for infringement under applicable
|
||||||
|
copyright law, except executing it on a computer or modifying a private copy.
|
||||||
|
Propagation includes copying, distribution (with or without modification),
|
||||||
|
making available to the public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To *convey* a work means any kind of propagation that enables other parties to
|
||||||
|
make or receive copies. Mere interaction with a user through a computer
|
||||||
|
network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays *Appropriate Legal Notices* to the
|
||||||
|
extent that it includes a convenient and prominently visible feature that
|
||||||
|
|
||||||
|
1. displays an appropriate copyright notice, and
|
||||||
|
2. tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the work
|
||||||
|
under this License, and how to view a copy of this License.
|
||||||
|
|
||||||
|
If the interface presents a list of user commands or options, such as a menu, a
|
||||||
|
prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
### 1. Source Code.
|
||||||
|
|
||||||
|
The *source code* for a work means the preferred form of the work for making
|
||||||
|
modifications to it. *Object code* means any non-source form of a work.
|
||||||
|
|
||||||
|
A *Standard Interface* means an interface that either is an official standard
|
||||||
|
defined by a recognized standards body, or, in the case of interfaces specified
|
||||||
|
for a particular programming language, one that is widely used among developers
|
||||||
|
working in that language.
|
||||||
|
|
||||||
|
The *System Libraries* of an executable work include anything, other than the
|
||||||
|
work as a whole, that (a) is included in the normal form of packaging a Major
|
||||||
|
Component, but which is not part of that Major Component, and (b) serves only
|
||||||
|
to enable use of the work with that Major Component, or to implement a Standard
|
||||||
|
Interface for which an implementation is available to the public in source code
|
||||||
|
form. A *Major Component*, in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system (if any) on
|
||||||
|
which the executable work runs, or a compiler used to produce the work, or an
|
||||||
|
object code interpreter used to run it.
|
||||||
|
|
||||||
|
The *Corresponding Source* for a work in object code form means all the source
|
||||||
|
code needed to generate, install, and (for an executable work) run the object
|
||||||
|
code and to modify the work, including scripts to control those activities.
|
||||||
|
However, it does not include the work's System Libraries, or general-purpose
|
||||||
|
tools or generally available free programs which are used unmodified in
|
||||||
|
performing those activities but which are not part of the work. For example,
|
||||||
|
Corresponding Source includes interface definition files associated with source
|
||||||
|
files for the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require, such as
|
||||||
|
by intimate data communication or control flow between those subprograms and
|
||||||
|
other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can regenerate
|
||||||
|
automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same work.
|
||||||
|
|
||||||
|
### 2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of copyright on
|
||||||
|
the Program, and are irrevocable provided the stated conditions are met. This
|
||||||
|
License explicitly affirms your unlimited permission to run the unmodified
|
||||||
|
Program. The output from running a covered work is covered by this License only
|
||||||
|
if the output, given its content, constitutes a covered work. This License
|
||||||
|
acknowledges your rights of fair use or other equivalent, as provided by
|
||||||
|
copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey, without
|
||||||
|
conditions so long as your license otherwise remains in force. You may convey
|
||||||
|
covered works to others for the sole purpose of having them make modifications
|
||||||
|
exclusively for you, or provide you with facilities for running those works,
|
||||||
|
provided that you comply with the terms of this License in conveying all
|
||||||
|
material for which you do not control copyright. Those thus making or running
|
||||||
|
the covered works for you must do so exclusively on your behalf, under your
|
||||||
|
direction and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the
|
||||||
|
conditions stated below. Sublicensing is not allowed; section 10 makes it
|
||||||
|
unnecessary.
|
||||||
|
|
||||||
|
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological measure
|
||||||
|
under any applicable law fulfilling obligations under article 11 of the WIPO
|
||||||
|
copyright treaty adopted on 20 December 1996, or similar laws prohibiting or
|
||||||
|
restricting circumvention of such measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention is
|
||||||
|
effected by exercising rights under this License with respect to the covered
|
||||||
|
work, and you disclaim any intention to limit operation or modification of the
|
||||||
|
work as a means of enforcing, against the work's users, your or third parties'
|
||||||
|
legal rights to forbid circumvention of technological measures.
|
||||||
|
|
||||||
|
### 4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you receive it,
|
||||||
|
in any medium, provided that you conspicuously and appropriately publish on
|
||||||
|
each copy an appropriate copyright notice; keep intact all notices stating that
|
||||||
|
this License and any non-permissive terms added in accord with section 7 apply
|
||||||
|
to the code; keep intact all notices of the absence of any warranty; and give
|
||||||
|
all recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey, and you may
|
||||||
|
offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
### 5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to produce it
|
||||||
|
from the Program, in the form of source code under the terms of section 4,
|
||||||
|
provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
- a) The work must carry prominent notices stating that you modified it, and
|
||||||
|
giving a relevant date.
|
||||||
|
- b) The work must carry prominent notices stating that it is released under
|
||||||
|
this License and any conditions added under section 7. This requirement
|
||||||
|
modifies the requirement in section 4 to *keep intact all notices*.
|
||||||
|
- c) You must license the entire work, as a whole, under this License to
|
||||||
|
anyone who comes into possession of a copy. This License will therefore
|
||||||
|
apply, along with any applicable section 7 additional terms, to the whole
|
||||||
|
of the work, and all its parts, regardless of how they are packaged. This
|
||||||
|
License gives no permission to license the work in any other way, but it
|
||||||
|
does not invalidate such permission if you have separately received it.
|
||||||
|
- d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your work need
|
||||||
|
not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent works,
|
||||||
|
which are not by their nature extensions of the covered work, and which are not
|
||||||
|
combined with it such as to form a larger program, in or on a volume of a
|
||||||
|
storage or distribution medium, is called an *aggregate* if the compilation and
|
||||||
|
its resulting copyright are not used to limit the access or legal rights of the
|
||||||
|
compilation's users beyond what the individual works permit. Inclusion of a
|
||||||
|
covered work in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
### 6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms of sections 4
|
||||||
|
and 5, provided that you also convey the machine-readable Corresponding Source
|
||||||
|
under the terms of this License, in one of these ways:
|
||||||
|
|
||||||
|
- a) Convey the object code in, or embodied in, a physical product (including
|
||||||
|
a physical distribution medium), accompanied by the Corresponding Source
|
||||||
|
fixed on a durable physical medium customarily used for software
|
||||||
|
interchange.
|
||||||
|
- b) Convey the object code in, or embodied in, a physical product (including
|
||||||
|
a physical distribution medium), accompanied by a written offer, valid for
|
||||||
|
at least three years and valid for as long as you offer spare parts or
|
||||||
|
customer support for that product model, to give anyone who possesses the
|
||||||
|
object code either
|
||||||
|
1. a copy of the Corresponding Source for all the software in the product
|
||||||
|
that is covered by this License, on a durable physical medium
|
||||||
|
customarily used for software interchange, for a price no more than your
|
||||||
|
reasonable cost of physically performing this conveying of source, or
|
||||||
|
2. access to copy the Corresponding Source from a network server at no
|
||||||
|
charge.
|
||||||
|
- c) Convey individual copies of the object code with a copy of the written
|
||||||
|
offer to provide the Corresponding Source. This alternative is allowed only
|
||||||
|
occasionally and noncommercially, and only if you received the object code
|
||||||
|
with such an offer, in accord with subsection 6b.
|
||||||
|
- d) Convey the object code by offering access from a designated place
|
||||||
|
(gratis or for a charge), and offer equivalent access to the Corresponding
|
||||||
|
Source in the same way through the same place at no further charge. You
|
||||||
|
need not require recipients to copy the Corresponding Source along with the
|
||||||
|
object code. If the place to copy the object code is a network server, the
|
||||||
|
Corresponding Source may be on a different server operated by you or a
|
||||||
|
third party) that supports equivalent copying facilities, provided you
|
||||||
|
maintain clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the Corresponding
|
||||||
|
Source, you remain obligated to ensure that it is available for as long as
|
||||||
|
needed to satisfy these requirements.
|
||||||
|
- e) Convey the object code using peer-to-peer transmission, provided you
|
||||||
|
inform other peers where the object code and Corresponding Source of the
|
||||||
|
work are being offered to the general public at no charge under subsection
|
||||||
|
6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded from the
|
||||||
|
Corresponding Source as a System Library, need not be included in conveying the
|
||||||
|
object code work.
|
||||||
|
|
||||||
|
A *User Product* is either
|
||||||
|
|
||||||
|
1. a *consumer product*, which means any tangible personal property which is
|
||||||
|
normally used for personal, family, or household purposes, or
|
||||||
|
2. anything designed or sold for incorporation into a dwelling.
|
||||||
|
|
||||||
|
In determining whether a product is a consumer product, doubtful cases shall be
|
||||||
|
resolved in favor of coverage. For a particular product received by a
|
||||||
|
particular user, *normally used* refers to a typical or common use of that
|
||||||
|
class of product, regardless of the status of the particular user or of the way
|
||||||
|
in which the particular user actually uses, or expects or is expected to use,
|
||||||
|
the product. A product is a consumer product regardless of whether the product
|
||||||
|
has substantial commercial, industrial or non-consumer uses, unless such uses
|
||||||
|
represent the only significant mode of use of the product.
|
||||||
|
|
||||||
|
*Installation Information* for a User Product means any methods, procedures,
|
||||||
|
authorization keys, or other information required to install and execute
|
||||||
|
modified versions of a covered work in that User Product from a modified
|
||||||
|
version of its Corresponding Source. The information must suffice to ensure
|
||||||
|
that the continued functioning of the modified object code is in no case
|
||||||
|
prevented or interfered with solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as part of a
|
||||||
|
transaction in which the right of possession and use of the User Product is
|
||||||
|
transferred to the recipient in perpetuity or for a fixed term (regardless of
|
||||||
|
how the transaction is characterized), the Corresponding Source conveyed under
|
||||||
|
this section must be accompanied by the Installation Information. But this
|
||||||
|
requirement does not apply if neither you nor any third party retains the
|
||||||
|
ability to install modified object code on the User Product (for example, the
|
||||||
|
work has been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates for a
|
||||||
|
work that has been modified or installed by the recipient, or for the User
|
||||||
|
Product in which it has been modified or installed. Access to a network may be
|
||||||
|
denied when the modification itself materially and adversely affects the
|
||||||
|
operation of the network or violates the rules and protocols for communication
|
||||||
|
across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided, in accord
|
||||||
|
with this section must be in a format that is publicly documented (and with an
|
||||||
|
implementation available to the public in source code form), and must require
|
||||||
|
no special password or key for unpacking, reading or copying.
|
||||||
|
|
||||||
|
### 7. Additional Terms.
|
||||||
|
|
||||||
|
*Additional permissions* are terms that supplement the terms of this License by
|
||||||
|
making exceptions from one or more of its conditions. Additional permissions
|
||||||
|
that are applicable to the entire Program shall be treated as though they were
|
||||||
|
included in this License, to the extent that they are valid under applicable
|
||||||
|
law. If additional permissions apply only to part of the Program, that part may
|
||||||
|
be used separately under those permissions, but the entire Program remains
|
||||||
|
governed by this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option remove any
|
||||||
|
additional permissions from that copy, or from any part of it. (Additional
|
||||||
|
permissions may be written to require their own removal in certain cases when
|
||||||
|
you modify the work.) You may place additional permissions on material, added
|
||||||
|
by you to a covered work, for which you have or can give appropriate copyright
|
||||||
|
permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you add to a
|
||||||
|
covered work, you may (if authorized by the copyright holders of that material)
|
||||||
|
supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
- a) Disclaiming warranty or limiting liability differently from the terms of
|
||||||
|
sections 15 and 16 of this License; or
|
||||||
|
- b) Requiring preservation of specified reasonable legal notices or author
|
||||||
|
attributions in that material or in the Appropriate Legal Notices displayed
|
||||||
|
by works containing it; or
|
||||||
|
- c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in reasonable
|
||||||
|
ways as different from the original version; or
|
||||||
|
- d) Limiting the use for publicity purposes of names of licensors or authors
|
||||||
|
of the material; or
|
||||||
|
- e) Declining to grant rights under trademark law for use of some trade
|
||||||
|
names, trademarks, or service marks; or
|
||||||
|
- f) Requiring indemnification of licensors and authors of that material by
|
||||||
|
anyone who conveys the material (or modified versions of it) with
|
||||||
|
contractual assumptions of liability to the recipient, for any liability
|
||||||
|
that these contractual assumptions directly impose on those licensors and
|
||||||
|
authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered *further restrictions*
|
||||||
|
within the meaning of section 10. If the Program as you received it, or any
|
||||||
|
part of it, contains a notice stating that it is governed by this License along
|
||||||
|
with a term that is a further restriction, you may remove that term. If a
|
||||||
|
license document contains a further restriction but permits relicensing or
|
||||||
|
conveying under this License, you may add to a covered work material governed
|
||||||
|
by the terms of that license document, provided that the further restriction
|
||||||
|
does not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you must place,
|
||||||
|
in the relevant source files, a statement of the additional terms that apply to
|
||||||
|
those files, or a notice indicating where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the form of a
|
||||||
|
separately written license, or stated as exceptions; the above requirements
|
||||||
|
apply either way.
|
||||||
|
|
||||||
|
### 8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly provided
|
||||||
|
under this License. Any attempt otherwise to propagate or modify it is void,
|
||||||
|
and will automatically terminate your rights under this License (including any
|
||||||
|
patent licenses granted under the third paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license from a
|
||||||
|
particular copyright holder is reinstated
|
||||||
|
|
||||||
|
- a) provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and
|
||||||
|
- b) permanently, if the copyright holder fails to notify you of the
|
||||||
|
violation by some reasonable means prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is reinstated
|
||||||
|
permanently if the copyright holder notifies you of the violation by some
|
||||||
|
reasonable means, this is the first time you have received notice of violation
|
||||||
|
of this License (for any work) from that copyright holder, and you cure the
|
||||||
|
violation prior to 30 days after your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the licenses
|
||||||
|
of parties who have received copies or rights from you under this License. If
|
||||||
|
your rights have been terminated and not permanently reinstated, you do not
|
||||||
|
qualify to receive new licenses for the same material under section 10.
|
||||||
|
|
||||||
|
### 9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run a copy
|
||||||
|
of the Program. Ancillary propagation of a covered work occurring solely as a
|
||||||
|
consequence of using peer-to-peer transmission to receive a copy likewise does
|
||||||
|
not require acceptance. However, nothing other than this License grants you
|
||||||
|
permission to propagate or modify any covered work. These actions infringe
|
||||||
|
copyright if you do not accept this License. Therefore, by modifying or
|
||||||
|
propagating a covered work, you indicate your acceptance of this License to do
|
||||||
|
so.
|
||||||
|
|
||||||
|
### 10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically receives a
|
||||||
|
license from the original licensors, to run, modify and propagate that work,
|
||||||
|
subject to this License. You are not responsible for enforcing compliance by
|
||||||
|
third parties with this License.
|
||||||
|
|
||||||
|
An *entity transaction* is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered work
|
||||||
|
results from an entity transaction, each party to that transaction who receives
|
||||||
|
a copy of the work also receives whatever licenses to the work the party's
|
||||||
|
predecessor in interest had or could give under the previous paragraph, plus a
|
||||||
|
right to possession of the Corresponding Source of the work from the
|
||||||
|
predecessor in interest, if the predecessor has it or can get it with
|
||||||
|
reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the rights
|
||||||
|
granted or affirmed under this License. For example, you may not impose a
|
||||||
|
license fee, royalty, or other charge for exercise of rights granted under this
|
||||||
|
License, and you may not initiate litigation (including a cross-claim or
|
||||||
|
counterclaim in a lawsuit) alleging that any patent claim is infringed by
|
||||||
|
making, using, selling, offering for sale, or importing the Program or any
|
||||||
|
portion of it.
|
||||||
|
|
||||||
|
### 11. Patents.
|
||||||
|
|
||||||
|
A *contributor* is a copyright holder who authorizes use under this License of
|
||||||
|
the Program or a work on which the Program is based. The work thus licensed is
|
||||||
|
called the contributor's *contributor version*.
|
||||||
|
|
||||||
|
A contributor's *essential patent claims* are all patent claims owned or
|
||||||
|
controlled by the contributor, whether already acquired or hereafter acquired,
|
||||||
|
that would be infringed by some manner, permitted by this License, of making,
|
||||||
|
using, or selling its contributor version, but do not include claims that would
|
||||||
|
be infringed only as a consequence of further modification of the contributor
|
||||||
|
version. For purposes of this definition, *control* includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of this
|
||||||
|
License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
|
||||||
|
license under the contributor's essential patent claims, to make, use, sell,
|
||||||
|
offer for sale, import and otherwise run, modify and propagate the contents of
|
||||||
|
its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a *patent license* is any express agreement
|
||||||
|
or commitment, however denominated, not to enforce a patent (such as an express
|
||||||
|
permission to practice a patent or covenant not to sue for patent
|
||||||
|
infringement). To *grant* such a patent license to a party means to make such
|
||||||
|
an agreement or commitment not to enforce a patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license, and the
|
||||||
|
Corresponding Source of the work is not available for anyone to copy, free of
|
||||||
|
charge and under the terms of this License, through a publicly available
|
||||||
|
network server or other readily accessible means, then you must either
|
||||||
|
|
||||||
|
1. cause the Corresponding Source to be so available, or
|
||||||
|
2. arrange to deprive yourself of the benefit of the patent license for this
|
||||||
|
particular work, or
|
||||||
|
3. arrange, in a manner consistent with the requirements of this License, to
|
||||||
|
extend the patent license to downstream recipients.
|
||||||
|
|
||||||
|
*Knowingly relying* means you have actual knowledge that, but for the patent
|
||||||
|
license, your conveying the covered work in a country, or your recipient's use
|
||||||
|
of the covered work in a country, would infringe one or more identifiable
|
||||||
|
patents in that country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or arrangement, you
|
||||||
|
convey, or propagate by procuring conveyance of, a covered work, and grant a
|
||||||
|
patent license to some of the parties receiving the covered work authorizing
|
||||||
|
them to use, propagate, modify or convey a specific copy of the covered work,
|
||||||
|
then the patent license you grant is automatically extended to all recipients
|
||||||
|
of the covered work and works based on it.
|
||||||
|
|
||||||
|
A patent license is *discriminatory* if it does not include within the scope of
|
||||||
|
its coverage, prohibits the exercise of, or is conditioned on the non-exercise
|
||||||
|
of one or more of the rights that are specifically granted under this License.
|
||||||
|
You may not convey a covered work if you are a party to an arrangement with a
|
||||||
|
third party that is in the business of distributing software, under which you
|
||||||
|
make payment to the third party based on the extent of your activity of
|
||||||
|
conveying the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory patent
|
||||||
|
license
|
||||||
|
|
||||||
|
- a) in connection with copies of the covered work conveyed by you (or copies
|
||||||
|
made from those copies), or
|
||||||
|
- b) primarily for and in connection with specific products or compilations
|
||||||
|
that contain the covered work, unless you entered into that arrangement, or
|
||||||
|
that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting any implied
|
||||||
|
license or other defenses to infringement that may otherwise be available to
|
||||||
|
you under applicable patent law.
|
||||||
|
|
||||||
|
### 12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not excuse
|
||||||
|
you from the conditions of this License. If you cannot convey a covered work so
|
||||||
|
as to satisfy simultaneously your obligations under this License and any other
|
||||||
|
pertinent obligations, then as a consequence you may not convey it at all. For
|
||||||
|
example, if you agree to terms that obligate you to collect a royalty for
|
||||||
|
further conveying from those to whom you convey the Program, the only way you
|
||||||
|
could satisfy both those terms and this License would be to refrain entirely
|
||||||
|
from conveying the Program.
|
||||||
|
|
||||||
|
### 13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have permission to
|
||||||
|
link or combine any covered work with a work licensed under version 3 of the
|
||||||
|
GNU Affero General Public License into a single combined work, and to convey
|
||||||
|
the resulting work. The terms of this License will continue to apply to the
|
||||||
|
part which is the covered work, but the special requirements of the GNU Affero
|
||||||
|
General Public License, section 13, concerning interaction through a network
|
||||||
|
will apply to the combination as such.
|
||||||
|
|
||||||
|
### 14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of the GNU
|
||||||
|
General Public License from time to time. Such new versions will be similar in
|
||||||
|
spirit to the present version, but may differ in detail to address new problems
|
||||||
|
or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program specifies
|
||||||
|
that a certain numbered version of the GNU General Public License *or any later
|
||||||
|
version* applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that numbered version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Program does not specify a version number
|
||||||
|
of the GNU General Public License, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions of the
|
||||||
|
GNU General Public License can be used, that proxy's public statement of
|
||||||
|
acceptance of a version permanently authorizes you to choose that version for
|
||||||
|
the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different permissions.
|
||||||
|
However, no additional obligations are imposed on any author or copyright
|
||||||
|
holder as a result of your choosing to follow a later version.
|
||||||
|
|
||||||
|
### 15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
|
||||||
|
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
|
||||||
|
PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||||
|
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
|
||||||
|
QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||||
|
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||||
|
CORRECTION.
|
||||||
|
|
||||||
|
### 16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
|
||||||
|
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS
|
||||||
|
PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
|
||||||
|
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
|
||||||
|
THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
|
||||||
|
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
|
||||||
|
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY
|
||||||
|
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
### 17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided above cannot
|
||||||
|
be given local legal effect according to their terms, reviewing courts shall
|
||||||
|
apply local law that most closely approximates an absolute waiver of all civil
|
||||||
|
liability in connection with the Program, unless a warranty or assumption of
|
||||||
|
liability accompanies a copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
## END OF TERMS AND CONDITIONS ###
|
||||||
|
|
||||||
|
### How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest possible
|
||||||
|
use to the public, the best way to achieve this is to make it free software
|
||||||
|
which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to attach
|
||||||
|
them to the start of each source file to most effectively state the exclusion
|
||||||
|
of warranty; and each file should have at least the *copyright* line and a
|
||||||
|
pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short notice like
|
||||||
|
this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w` and `show c` should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands might
|
||||||
|
be different; for a GUI interface, you would use an *about box*.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school, if
|
||||||
|
any, to sign a *copyright disclaimer* for the program, if necessary. For more
|
||||||
|
information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may consider
|
||||||
|
it more useful to permit linking proprietary applications with the library. If
|
||||||
|
this is what you want to do, use the GNU Lesser General Public License instead
|
||||||
|
of this License. But first, please read
|
||||||
|
[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html).
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<p align=center>
|
||||||
|
<a href="https://git.codingworkshop.eu.org/xt-sys/xtchain">
|
||||||
|
<img alt="GIT Repository" src="https://img.shields.io/badge/Source-GIT-purple">
|
||||||
|
</a>
|
||||||
|
<a href="https://git.codingworkshop.eu.org/xt-sys/xtchain/actions">
|
||||||
|
<img alt="Build Status" src="https://codingworkshop.eu.org/actions.php?project=xt-sys/xtchain">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/xt-sys/xtchain/releases">
|
||||||
|
<img alt="Releases" src="https://img.shields.io/github/v/release/xt-sys/xtchain?label=Release&color=blueviolet">
|
||||||
|
</a>
|
||||||
|
<a href="https://git.codingworkshop.eu.org/xt-sys/xtchain/src/branch/master/COPYING.md">
|
||||||
|
<img alt="License" src="https://img.shields.io/badge/License-GPLv3-blue.svg">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/sponsors/xt-sys/">
|
||||||
|
<img alt="Sponsors" src="https://img.shields.io/badge/Sponsor-%E2%9D%A4-red?logo=GitHub">
|
||||||
|
</a>
|
||||||
|
<a href="https://discord.com/invite/zBzJ5qMGX7">
|
||||||
|
<img alt="Discord" src="https://img.shields.io/badge/Chat-Join%20Discord-success">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## XT Toolchain
|
||||||
|
The XT Toolchain is a build environment based on LLVM/Clang/LLD. It currently supports C and C++, and includes
|
||||||
|
a variety of auxiliary tools such as IDL, message, and resource compilers. The XT Toolchain is the official
|
||||||
|
build system for compiling XT software, including the XT OS. It is currently available for Linux and Windows
|
||||||
|
host systems.
|
||||||
|
|
||||||
|
Key Benefits of using an LLVM-based Toolchain:
|
||||||
|
* Unified toolchain for multiple target architectures: i686, x86_64, armv7, and aarch64
|
||||||
|
* Support for generating debug information in PDB format
|
||||||
|
* Ability to target ARM/AArch64 architectures and produce ARM binaries
|
||||||
|
|
||||||
|
This toolchain includes the following software:
|
||||||
|
* CMake
|
||||||
|
* LLVM
|
||||||
|
* Ninja
|
||||||
|
* Wine
|
||||||
|
|
||||||
|
**Note:** This toolchain is based on the [LLVM MinGW Toolchain](https://github.com/mstorsjo/llvm-mingw).
|
||||||
|
|
||||||
|
## Licensing
|
||||||
|
The XTchain project includes scripts for building and assembling the toolchain, as well as the environment
|
||||||
|
shell. These components are licensed under the GNU GPLv3 license. This license applies only to the parts
|
||||||
|
provided directly by XTchain. For detailed information, please refer to the COPYING.md file.
|
||||||
|
|
||||||
|
The final pre-built toolchain is subject to the licenses of the individual third-party projects it includes.
|
||||||
|
A complete list of the external software used in this toolchain can be found in the README.md file.
|
||||||
-397
@@ -1,397 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Working Directories
|
|
||||||
BINDIR="$(pwd)/binaries"
|
|
||||||
PCHDIR="$(pwd)/patches"
|
|
||||||
SRCDIR="$(pwd)/sources"
|
|
||||||
WRKDIR="$(pwd)"
|
|
||||||
|
|
||||||
# Compiler Flags
|
|
||||||
CFLAGS="-march=x86-64 -mtune=generic -O2 -s -pipe"
|
|
||||||
CXXFLAGS="${CFLAGS}"
|
|
||||||
|
|
||||||
# Binutils Settings
|
|
||||||
BINUTILSDIR="${SRCDIR}/binutils"
|
|
||||||
BINUTILSTAG="binutils-2_35"
|
|
||||||
BINUTILSVCS="git://sourceware.org/git/binutils-gdb.git"
|
|
||||||
|
|
||||||
# CMake Settings
|
|
||||||
CMAKEDIR="${SRCDIR}/cmake"
|
|
||||||
CMAKETAG="v3.18.1"
|
|
||||||
CMAKEVCS="https://gitlab.kitware.com/cmake/cmake.git"
|
|
||||||
|
|
||||||
# GCC Settings
|
|
||||||
GCCDIR="${SRCDIR}/gcc"
|
|
||||||
GCCTAG="releases/gcc-9.3.0"
|
|
||||||
GCCVCS="git://gcc.gnu.org/git/gcc.git"
|
|
||||||
|
|
||||||
# Mingw-w64 Settings
|
|
||||||
MINGWDIR="${SRCDIR}/mingw-w64"
|
|
||||||
MINGWTAG="v6.0.0"
|
|
||||||
MINGWVCS="https://github.com/mirror/mingw-w64.git"
|
|
||||||
|
|
||||||
# Ninja Settings
|
|
||||||
NINJADIR="${SRCDIR}/ninja"
|
|
||||||
NINJATAG="v1.10.0"
|
|
||||||
NINJAVCS="https://github.com/ninja-build/ninja.git"
|
|
||||||
|
|
||||||
# Architecture Settings
|
|
||||||
ARCHS="i686 x86_64"
|
|
||||||
GENERIC="generic-w64-mingw32"
|
|
||||||
|
|
||||||
|
|
||||||
apply_patches()
|
|
||||||
{
|
|
||||||
local PACKAGE="${1}"
|
|
||||||
local VERSION="${2}"
|
|
||||||
if [ -d "${PCHDIR}/${PACKAGE}/${VERSION}" ]; then
|
|
||||||
PATCHES="$(find ${PCHDIR}/${PACKAGE}/${VERSION} -name '*.diff' -o -name '*.patch' | sort -n)"
|
|
||||||
echo ">>> Applying custom patches ..."
|
|
||||||
for PATCH in ${PATCHES}; do
|
|
||||||
if [ -f "${PATCH}" ] && [ -r "${PATCH}" ]; then
|
|
||||||
for PREFIX in {0..5}; do
|
|
||||||
if patch -i${PATCH} -p${PREFIX} --silent --dry-run >/dev/null; then
|
|
||||||
patch -i${PATCH} -p${PREFIX} --silent
|
|
||||||
echo ">>> Patch ${PATCH} applied ..."
|
|
||||||
break;
|
|
||||||
elif [ ${PREFIX} -ge 5 ]; then
|
|
||||||
echo "Patch ${PATCH} does not fit. Failed applying patch ..."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
binutils_build()
|
|
||||||
{
|
|
||||||
for ARCH in ${ARCHS}; do
|
|
||||||
echo ">>> Building BINUTILS for ${ARCH} ..."
|
|
||||||
[ -z ${CLEAN} ] || rm -rf ${BINUTILSDIR}/build-${ARCH}
|
|
||||||
mkdir -p ${BINUTILSDIR}/build-${ARCH}
|
|
||||||
cd ${BINUTILSDIR}/build-${ARCH}
|
|
||||||
../configure \
|
|
||||||
--target=${ARCH}-w64-mingw32 \
|
|
||||||
--prefix=${BINDIR} \
|
|
||||||
--with-sysroot=${BINDIR} \
|
|
||||||
--with-zlib=yes \
|
|
||||||
--disable-multilib \
|
|
||||||
--disable-nls \
|
|
||||||
--disable-werror \
|
|
||||||
--enable-gold \
|
|
||||||
--enable-lto \
|
|
||||||
--enable-plugins
|
|
||||||
make -j${CORES}
|
|
||||||
make install
|
|
||||||
done
|
|
||||||
cd ${WRKDIR}
|
|
||||||
}
|
|
||||||
|
|
||||||
binutils_fetch()
|
|
||||||
{
|
|
||||||
if [ ! -d ${BINUTILSDIR} ]; then
|
|
||||||
echo ">>> Downloading BINUTILS ..."
|
|
||||||
git clone ${BINUTILSVCS} ${BINUTILSDIR}
|
|
||||||
cd ${BINUTILSDIR}
|
|
||||||
git checkout tags/${BINUTILSTAG}
|
|
||||||
apply_patches ${BINUTILSDIR##*/} ${BINUTILSTAG}
|
|
||||||
cd ${WRKDIR}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
cmake_build()
|
|
||||||
{
|
|
||||||
echo ">>> Building CMAKE ..."
|
|
||||||
[ -z ${CLEAN} ] || rm -rf ${CMAKEDIR}/build-${GENERIC}
|
|
||||||
mkdir -p ${CMAKEDIR}/build-${GENERIC}
|
|
||||||
cd ${CMAKEDIR}/build-${GENERIC}
|
|
||||||
../bootstrap \
|
|
||||||
--prefix=${BINDIR} \
|
|
||||||
--parallel=${CORES} \
|
|
||||||
-- -DCMAKE_USE_OPENSSL=OFF
|
|
||||||
make -j${CORES}
|
|
||||||
make install
|
|
||||||
cd ${WRKDIR}
|
|
||||||
}
|
|
||||||
|
|
||||||
cmake_fetch()
|
|
||||||
{
|
|
||||||
if [ ! -d ${CMAKEDIR} ]; then
|
|
||||||
echo ">>> Downloading CMAKE ..."
|
|
||||||
git clone ${CMAKEVCS} ${CMAKEDIR}
|
|
||||||
cd ${CMAKEDIR}
|
|
||||||
git checkout tags/${CMAKETAG}
|
|
||||||
apply_patches ${CMAKEDIR##*/} ${CMAKETAG}
|
|
||||||
cd ${WRKDIR}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
gcc_build_phase1()
|
|
||||||
{
|
|
||||||
for ARCH in ${ARCHS}; do
|
|
||||||
echo ">>> Building GCC (phase1) for ${ARCH} ..."
|
|
||||||
[ -z ${CLEAN} ] || rm -rf ${GCCDIR}/build-${ARCH}
|
|
||||||
mkdir -p ${GCCDIR}/build-${ARCH}
|
|
||||||
cd ${GCCDIR}/build-${ARCH}
|
|
||||||
../configure \
|
|
||||||
--target=${ARCH}-w64-mingw32 \
|
|
||||||
--prefix=${BINDIR} \
|
|
||||||
--with-sysroot=${BINDIR} \
|
|
||||||
--with-pkgversion="FerretOS Build Environment" \
|
|
||||||
--without-zstd \
|
|
||||||
--disable-libstdcxx-verbose \
|
|
||||||
--disable-multilib \
|
|
||||||
--disable-nls \
|
|
||||||
--disable-shared \
|
|
||||||
--disable-werror \
|
|
||||||
--disable-win32-registry \
|
|
||||||
--enable-fully-dynamic-string \
|
|
||||||
--enable-languages=c,c++ \
|
|
||||||
--enable-lto \
|
|
||||||
--enable-sjlj-exceptions \
|
|
||||||
--enable-version-specific-runtime-libs
|
|
||||||
make -j${CORES} all-gcc
|
|
||||||
make install-gcc
|
|
||||||
make install-lto-plugin
|
|
||||||
done
|
|
||||||
cd ${WRKDIR}
|
|
||||||
}
|
|
||||||
|
|
||||||
gcc_build_phase2()
|
|
||||||
{
|
|
||||||
for ARCH in ${ARCHS}; do
|
|
||||||
echo ">>> Building GCC (phase2) for ${ARCH} ..."
|
|
||||||
cd ${GCCDIR}/build-${ARCH}
|
|
||||||
make -j${CORES}
|
|
||||||
make install
|
|
||||||
done
|
|
||||||
cd ${WRKDIR}
|
|
||||||
}
|
|
||||||
|
|
||||||
gcc_fetch()
|
|
||||||
{
|
|
||||||
if [ ! -d ${GCCDIR} ]; then
|
|
||||||
echo ">>> Downloading GCC ..."
|
|
||||||
git clone ${GCCVCS} ${GCCDIR}
|
|
||||||
cd ${GCCDIR}
|
|
||||||
git checkout tags/${GCCTAG}
|
|
||||||
apply_patches ${GCCDIR##*/} ${GCCTAG##*/}
|
|
||||||
./contrib/download_prerequisites
|
|
||||||
cd ${WRKDIR}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
mingw_build_crt()
|
|
||||||
{
|
|
||||||
for ARCH in ${ARCHS}; do
|
|
||||||
echo ">>> Building Mingw-w64 (CRT) for ${ARCH} ..."
|
|
||||||
[ -z ${CLEAN} ] || rm -rf ${MINGWDIR}/mingw-w64-crt/build-${ARCH}
|
|
||||||
mkdir -p ${MINGWDIR}/mingw-w64-crt/build-${ARCH}
|
|
||||||
cd ${MINGWDIR}/mingw-w64-crt/build-${ARCH}
|
|
||||||
case ${ARCH} in
|
|
||||||
i686)
|
|
||||||
FLAGS="--enable-lib32 --disable-lib64"
|
|
||||||
;;
|
|
||||||
x86_64)
|
|
||||||
FLAGS="--disable-lib32 --enable-lib64"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
ORIGPATH="${PATH}"
|
|
||||||
PATH="${BINDIR}/bin:${PATH}"
|
|
||||||
../configure \
|
|
||||||
--host=${ARCH}-w64-mingw32 \
|
|
||||||
--prefix=${BINDIR}/${ARCH}-w64-mingw32 \
|
|
||||||
--with-sysroot=${BINDIR} \
|
|
||||||
--with-default-msvcrt=msvcrt \
|
|
||||||
${FLAGS}
|
|
||||||
make -j${CORES}
|
|
||||||
make install
|
|
||||||
PATH="${ORIGPATH}"
|
|
||||||
done
|
|
||||||
cd ${WRKDIR}
|
|
||||||
}
|
|
||||||
|
|
||||||
mingw_build_headers()
|
|
||||||
{
|
|
||||||
echo ">>> Building Mingw-w64 (headers) ..."
|
|
||||||
[ -z ${CLEAN} ] || rm -rf ${MINGWDIR}/mingw-w64-headers/build-${GENERIC}
|
|
||||||
mkdir -p ${MINGWDIR}/mingw-w64-headers/build-${GENERIC}
|
|
||||||
cd ${MINGWDIR}/mingw-w64-headers/build-${GENERIC}
|
|
||||||
../configure \
|
|
||||||
--prefix=${BINDIR}/${GENERIC} \
|
|
||||||
--enable-idl \
|
|
||||||
--with-default-msvcrt=msvcrt \
|
|
||||||
--with-default-win32-winnt=0x502
|
|
||||||
make -j${CORES}
|
|
||||||
make install
|
|
||||||
mkdir -p ${BINDIR}/mingw
|
|
||||||
if [ ! -e ${BINDIR}/mingw/include ]; then
|
|
||||||
ln -sfn ../${GENERIC}/include ${BINDIR}/mingw/include
|
|
||||||
fi
|
|
||||||
for ARCH in ${ARCHS}; do
|
|
||||||
mkdir -p ${BINDIR}/${ARCH}-w64-mingw32
|
|
||||||
if [ ! -e ${BINDIR}/${ARCH}-w64-mingw32/include ]; then
|
|
||||||
ln -sfn ../${GENERIC}/include ${BINDIR}/${ARCH}-w64-mingw32/include
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
cd ${WRKDIR}
|
|
||||||
}
|
|
||||||
|
|
||||||
mingw_build_libs()
|
|
||||||
{
|
|
||||||
for LIB in libmangle winstorecompat; do
|
|
||||||
echo ">>> Building Mingw-w64 (libs) for ${ARCH} ..."
|
|
||||||
for ARCH in ${ARCHS}; do
|
|
||||||
[ -z ${CLEAN} ] || rm -rf ${MINGWDIR}/mingw-w64-libraries/${LIB}/build-${ARCH}
|
|
||||||
mkdir -p ${MINGWDIR}/mingw-w64-libraries/${LIB}/build-${ARCH}
|
|
||||||
cd ${MINGWDIR}/mingw-w64-libraries/${LIB}/build-${ARCH}
|
|
||||||
ORIGPATH="${PATH}"
|
|
||||||
PATH="${BINDIR}/bin:${PATH}"
|
|
||||||
../configure \
|
|
||||||
--host=${ARCH}-w64-mingw32 \
|
|
||||||
--prefix=${BINDIR}/${ARCH}-w64-mingw32 \
|
|
||||||
--libdir=${BINDIR}/${ARCH}-w64-mingw32/lib
|
|
||||||
make -j${CORES}
|
|
||||||
make install
|
|
||||||
PATH="${ORIGPATH}"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
cd ${WRKDIR}
|
|
||||||
}
|
|
||||||
|
|
||||||
mingw_build_tools()
|
|
||||||
{
|
|
||||||
for TOOL in gendef genidl genlib genpeimg widl; do
|
|
||||||
for ARCH in ${ARCHS}; do
|
|
||||||
echo ">>> Building Mingw-w64 (tools) for ${ARCH} ..."
|
|
||||||
[ -z ${CLEAN} ] || rm -rf ${MINGWDIR}/mingw-w64-tools/${TOOL}/build-${ARCH}
|
|
||||||
mkdir -p ${MINGWDIR}/mingw-w64-tools/${TOOL}/build-${ARCH}
|
|
||||||
cd ${MINGWDIR}/mingw-w64-tools/${TOOL}/build-${ARCH}
|
|
||||||
../configure \
|
|
||||||
--target=${ARCH}-w64-mingw32 \
|
|
||||||
--prefix=${BINDIR}
|
|
||||||
make -j${CORES}
|
|
||||||
make install
|
|
||||||
if [ -e ${BINDIR}/bin/${TOOL} ]; then
|
|
||||||
mv ${BINDIR}/bin/${TOOL} ${BINDIR}/bin/${ARCH}-w64-mingw32-${TOOL}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
cd ${WRKDIR}
|
|
||||||
}
|
|
||||||
|
|
||||||
mingw_fetch()
|
|
||||||
{
|
|
||||||
if [ ! -d ${MINGWDIR} ]; then
|
|
||||||
echo ">>> Downloading Mingw-w64 ..."
|
|
||||||
git clone ${MINGWVCS} ${MINGWDIR}
|
|
||||||
cd ${MINGWDIR}
|
|
||||||
git checkout tags/${MINGWTAG}
|
|
||||||
apply_patches ${MINGWDIR##*/} ${MINGWTAG}
|
|
||||||
cd ${WRKDIR}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
ninja_build()
|
|
||||||
{
|
|
||||||
echo ">>> Building NINJA ..."
|
|
||||||
[ -z ${CLEAN} ] || rm -rf ${NINJADIR}/build-${GENERIC}
|
|
||||||
mkdir -p ${NINJADIR}/build-${GENERIC}
|
|
||||||
cd ${NINJADIR}/build-${GENERIC}
|
|
||||||
../configure.py --bootstrap
|
|
||||||
install ninja ${BINDIR}/bin/
|
|
||||||
cd ${WRKDIR}
|
|
||||||
}
|
|
||||||
|
|
||||||
ninja_fetch()
|
|
||||||
{
|
|
||||||
if [ ! -d ${NINJADIR} ]; then
|
|
||||||
echo ">>> Downloading NINJA ..."
|
|
||||||
git clone ${NINJAVCS} ${NINJADIR}
|
|
||||||
cd ${NINJADIR}
|
|
||||||
git checkout tags/${NINJATAG}
|
|
||||||
apply_patches ${NINJADIR##*/} ${NINJATAG}
|
|
||||||
cd ${WRKDIR}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check if script launched as root
|
|
||||||
if [ "$(whoami)" = "root" ]; then
|
|
||||||
echo "This script cannot be run as root!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check number of CPU cores available
|
|
||||||
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
|
|
||||||
: ${CORES:=$(nproc 2>/dev/null)}
|
|
||||||
: ${CORES:=1}
|
|
||||||
|
|
||||||
# Create working directories
|
|
||||||
mkdir -p ${BINDIR}
|
|
||||||
mkdir -p ${SRCDIR}
|
|
||||||
|
|
||||||
# Export compiler flags
|
|
||||||
export CFLAGS
|
|
||||||
export CXXFLAGS
|
|
||||||
|
|
||||||
# Download Mingw-W64
|
|
||||||
mingw_fetch
|
|
||||||
|
|
||||||
# Build and install Mingw-W64 headers
|
|
||||||
mingw_build_headers
|
|
||||||
|
|
||||||
# Download Binutils
|
|
||||||
binutils_fetch
|
|
||||||
|
|
||||||
# Build and install Binutils
|
|
||||||
binutils_build
|
|
||||||
|
|
||||||
# Download GCC
|
|
||||||
gcc_fetch
|
|
||||||
|
|
||||||
# Build and install minimal GCC
|
|
||||||
gcc_build_phase1
|
|
||||||
|
|
||||||
# Build and install MSVCRT
|
|
||||||
mingw_build_crt
|
|
||||||
|
|
||||||
# Build and install GCC
|
|
||||||
gcc_build_phase2
|
|
||||||
|
|
||||||
# Build and install Mingw-W64 libraries
|
|
||||||
mingw_build_libs
|
|
||||||
|
|
||||||
# Build and install Mingw-W64 tools
|
|
||||||
mingw_build_tools
|
|
||||||
|
|
||||||
# Download CMake
|
|
||||||
cmake_fetch
|
|
||||||
|
|
||||||
# Build and install CMake
|
|
||||||
cmake_build
|
|
||||||
|
|
||||||
# Download Ninja
|
|
||||||
ninja_fetch
|
|
||||||
|
|
||||||
# Build and install Ninja
|
|
||||||
ninja_build
|
|
||||||
|
|
||||||
# Remove unneeded files to save disk space
|
|
||||||
echo ">>> Removing unneeded files to save disk space ..."
|
|
||||||
rm -rf ${BINDIR}/{doc,include,mingw,share/{bash-completion,emacs,gcc*,info,man,vim}}
|
|
||||||
|
|
||||||
# Copy all scripts
|
|
||||||
echo ">>> Copying scripts ..."
|
|
||||||
cp -apf ${WRKDIR}/scripts/* ${BINDIR}/
|
|
||||||
|
|
||||||
# Save FBE version
|
|
||||||
cd ${WRKDIR}
|
|
||||||
: ${FBEVER:=$(git describe --exact-match --tags 2>/dev/null)}
|
|
||||||
: ${FBEVER:=DEV}
|
|
||||||
echo "${FBEVER}" > ${BINDIR}/Version
|
|
||||||
|
|
||||||
# Prepare archive
|
|
||||||
echo ">>> Creating toolchain archive ..."
|
|
||||||
tar -I 'zstd -19' -cpf fbe-${FBEVER}-linux.tar.zst -C ${BINDIR} .
|
|
||||||
@@ -0,0 +1,497 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: build.sh
|
||||||
|
# DESCRIPTION: Toolchain crosscompilation and assembly script
|
||||||
|
# DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
# Aiken Harris <harraiken91@gmail.com>
|
||||||
|
|
||||||
|
# Working Directories
|
||||||
|
BINDIR="$(pwd)/binaries"
|
||||||
|
PCHDIR="$(pwd)/patches"
|
||||||
|
SRCDIR="$(pwd)/sources"
|
||||||
|
WRKDIR="$(pwd)"
|
||||||
|
|
||||||
|
# Architecture Settings
|
||||||
|
ARCHS="aarch64 armv7 i686 x86_64"
|
||||||
|
|
||||||
|
# Default Configuration
|
||||||
|
BUILD_JOBS=0
|
||||||
|
BUILD_MINIMAL=0
|
||||||
|
CLEAN_BUILD=0
|
||||||
|
ENABLE_LLVM_ASSEMBLY=0
|
||||||
|
LLVM_DYNAMIC_LINK=ON
|
||||||
|
SYSTEM_NAME=Linux
|
||||||
|
TARGET_SYSTEM=linux
|
||||||
|
|
||||||
|
# CMake Settings
|
||||||
|
CMAKEDIR="${SRCDIR}/cmake"
|
||||||
|
CMAKETAG="v4.1.1"
|
||||||
|
CMAKEVCS="https://gitlab.kitware.com/cmake/cmake.git"
|
||||||
|
|
||||||
|
# LLVM Settings
|
||||||
|
LLVMDIR="${SRCDIR}/llvm"
|
||||||
|
LLVMTAG="llvmorg-21.1.1"
|
||||||
|
LLVMVCS="https://github.com/llvm/llvm-project.git"
|
||||||
|
|
||||||
|
# Ninja Settings
|
||||||
|
NINJADIR="${SRCDIR}/ninja"
|
||||||
|
NINJATAG="v1.13.1"
|
||||||
|
NINJAVCS="https://github.com/ninja-build/ninja.git"
|
||||||
|
|
||||||
|
# Wine Settings
|
||||||
|
WINEDIR="${SRCDIR}/wine"
|
||||||
|
WINETAG="wine-10.15"
|
||||||
|
WINEVCS="https://github.com/wine-mirror/wine.git"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# This function applies a patches to the 3rd party project
|
||||||
|
apply_patches()
|
||||||
|
{
|
||||||
|
local PACKAGE="${1}"
|
||||||
|
local VERSION="${2}"
|
||||||
|
if [ -d "${PCHDIR}/${PACKAGE}/${VERSION}" ]; then
|
||||||
|
PATCHES="$(find ${PCHDIR}/${PACKAGE}/${VERSION} -name '*.diff' -o -name '*.patch' | sort -n)"
|
||||||
|
echo ">>> Applying custom patches ..."
|
||||||
|
for PATCH in ${PATCHES}; do
|
||||||
|
if [ -f "${PATCH}" ] && [ -r "${PATCH}" ]; then
|
||||||
|
for PREFIX in {0..5}; do
|
||||||
|
if patch -i${PATCH} -p${PREFIX} --silent --dry-run >/dev/null; then
|
||||||
|
patch -i${PATCH} -p${PREFIX} --silent
|
||||||
|
echo ">>> Patch ${PATCH} applied ..."
|
||||||
|
break;
|
||||||
|
elif [ ${PREFIX} -ge 5 ]; then
|
||||||
|
echo "Patch ${PATCH} does not fit. Failed applying patch ..."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function compiles and installs CMAKE
|
||||||
|
cmake_build()
|
||||||
|
{
|
||||||
|
local CMAKE_PARAMETERS=""
|
||||||
|
|
||||||
|
# Clean old build if necessary
|
||||||
|
[ "${CLEAN_BUILD}" -eq 1 ] && rm -rf ${WINEDIR}/build-${SYSTEM_NAME}
|
||||||
|
|
||||||
|
# Additional, target-specific configuration options
|
||||||
|
case "${SYSTEM_NAME}" in
|
||||||
|
Windows)
|
||||||
|
CMAKE_PARAMETERS="${CMAKE_PARAMETERS} -DCMAKE_C_COMPILER=${SYSTEM_HOST}-gcc -DCMAKE_CXX_COMPILER=${SYSTEM_HOST}-g++"
|
||||||
|
CMAKE_PARAMETERS="${CMAKE_PARAMETERS} -DCMAKE_RC_COMPILER=${SYSTEM_HOST}-windres"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Build CMake
|
||||||
|
echo ">>> Building CMAKE ..."
|
||||||
|
mkdir -p ${CMAKEDIR}/build-${SYSTEM_NAME}
|
||||||
|
cd ${CMAKEDIR}/build-${SYSTEM_NAME}
|
||||||
|
cmake \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
|
||||||
|
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
|
||||||
|
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${BINDIR} \
|
||||||
|
-DCMAKE_SYSTEM_NAME=${SYSTEM_NAME} \
|
||||||
|
-DCMAKE_USE_OPENSSL=OFF \
|
||||||
|
${CMAKE_PARAMETERS} \
|
||||||
|
..
|
||||||
|
cmake --build . --parallel ${BUILD_JOBS}
|
||||||
|
cmake --install .
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function downloads CMAKE from VCS
|
||||||
|
cmake_fetch()
|
||||||
|
{
|
||||||
|
if [ ! -d ${CMAKEDIR} ]; then
|
||||||
|
echo ">>> Downloading CMAKE ..."
|
||||||
|
git clone --depth 1 --branch ${CMAKETAG} ${CMAKEVCS} ${CMAKEDIR}
|
||||||
|
cd ${CMAKEDIR}
|
||||||
|
apply_patches ${CMAKEDIR##*/} ${CMAKETAG}
|
||||||
|
cd ${WRKDIR}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function compiles and install LLVM
|
||||||
|
llvm_build()
|
||||||
|
{
|
||||||
|
local CMAKE_PARAMETERS=""
|
||||||
|
local LLVM_ARCHS=()
|
||||||
|
|
||||||
|
# Clean old build if necessary
|
||||||
|
[ "${CLEAN_BUILD}" -eq 1 ] && rm -rf ${LLVMDIR}/llvm/build-${SYSTEM_NAME}
|
||||||
|
|
||||||
|
# Set supported architectures
|
||||||
|
for ARCH in ${ARCHS}; do
|
||||||
|
case ${ARCH} in
|
||||||
|
"aarch64")
|
||||||
|
LLVM_ARCHS+=( "AArch64" )
|
||||||
|
;;
|
||||||
|
"armv7")
|
||||||
|
LLVM_ARCHS+=( "ARM" )
|
||||||
|
;;
|
||||||
|
"i686"|"x86_64")
|
||||||
|
LLVM_ARCHS+=( "X86" )
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
LLVM_ARCHS=( $(for ARCH in ${LLVM_ARCHS[@]}; do echo ${ARCH}; done | sort -u) )
|
||||||
|
|
||||||
|
# Disable LLVM assembly files (like BLAKE3 support) if not specified otherwise
|
||||||
|
if [ "${ENABLE_LLVM_ASSEMBLY}" -ne 1 ]; then
|
||||||
|
CMAKE_PARAMETERS="${CMAKE_PARAMETERS} -DLLVM_DISABLE_ASSEMBLY_FILES=ON"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Additional, target-specific configuration options
|
||||||
|
case "${SYSTEM_NAME}" in
|
||||||
|
Windows)
|
||||||
|
CMAKE_PARAMETERS="${CMAKE_PARAMETERS} -DCMAKE_EXE_LINKER_FLAGS=-lpthread -DCMAKE_SHARED_LINKER_FLAGS=-lpthread"
|
||||||
|
CMAKE_PARAMETERS="${CMAKE_PARAMETERS} -DCMAKE_C_COMPILER_TARGET=${SYSTEM_HOST} -DCMAKE_CXX_COMPILER_TARGET=${SYSTEM_HOST}"
|
||||||
|
CMAKE_PARAMETERS="${CMAKE_PARAMETERS} -DCMAKE_RC_COMPILER=${SYSTEM_HOST}-windres -DLLVM_HOST_TRIPLE=${SYSTEM_HOST}"
|
||||||
|
CMAKE_PARAMETERS="${CMAKE_PARAMETERS} -DCMAKE_FIND_ROOT=$(dirname $(readlink -f $(command -v ${SYSTEM_HOST}-windres)))/../${SYSTEM_HOST}"
|
||||||
|
CMAKE_PARAMETERS="${CMAKE_PARAMETERS} -DCMAKE_CXX_FLAGS=-femulated-tls"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Build LLVM
|
||||||
|
echo ">>> Building LLVM ..."
|
||||||
|
cd ${LLVMDIR}/llvm/tools
|
||||||
|
for UTIL in clang lld; do
|
||||||
|
if [ ! -e ${UTIL} ]; then
|
||||||
|
ln -sf ../../${UTIL} .
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
mkdir -p ${LLVMDIR}/llvm/build-${SYSTEM_NAME}
|
||||||
|
cd ${LLVMDIR}/llvm/build-${SYSTEM_NAME}
|
||||||
|
cmake -G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE="Release" \
|
||||||
|
-DCMAKE_C_COMPILER=clang \
|
||||||
|
-DCMAKE_CXX_COMPILER=clang++ \
|
||||||
|
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
|
||||||
|
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
|
||||||
|
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \
|
||||||
|
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${BINDIR} \
|
||||||
|
-DCMAKE_SYSTEM_NAME="${SYSTEM_NAME}" \
|
||||||
|
-DLLDB_INCLUDE_TESTS=OFF \
|
||||||
|
-DLLVM_ENABLE_ASSERTIONS=OFF \
|
||||||
|
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb" \
|
||||||
|
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
|
||||||
|
-DLLVM_BUILD_INSTRUMENTED=OFF \
|
||||||
|
-DLLVM_LINK_LLVM_DYLIB=${LLVM_DYNAMIC_LINK} \
|
||||||
|
-DLLVM_TARGETS_TO_BUILD="$(echo ${LLVM_ARCHS[@]} | tr ' ' ';')" \
|
||||||
|
-DLLVM_TOOLCHAIN_TOOLS="llvm-addr2line;llvm-ar;llvm-as;llvm-cov;llvm-cvtres;llvm-cxxfilt;llvm-dlltool;llvm-lib;llvm-ml;llvm-nm;llvm-objdump;llvm-objcopy;llvm-pdbutil;llvm-profdata;llvm-ranlib;llvm-rc;llvm-readelf;llvm-readobj;llvm-size;llvm-strings;llvm-strip;llvm-symbolizer;llvm-windres" \
|
||||||
|
-DLLVM_USE_LINKER=lld \
|
||||||
|
-DLLDB_ENABLE_PYTHON=OFF \
|
||||||
|
${CMAKE_PARAMETERS} \
|
||||||
|
..
|
||||||
|
ninja -j ${BUILD_JOBS} install/strip
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function downloads LLVM from VCS
|
||||||
|
llvm_fetch()
|
||||||
|
{
|
||||||
|
if [ ! -d ${LLVMDIR} ]; then
|
||||||
|
echo ">>> Downloading LLVM ..."
|
||||||
|
git clone --depth 1 --branch ${LLVMTAG} ${LLVMVCS} ${LLVMDIR}
|
||||||
|
cd ${LLVMDIR}
|
||||||
|
apply_patches ${LLVMDIR##*/} ${LLVMTAG##*-}
|
||||||
|
cd ${WRKDIR}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function compiles and installs NINJA
|
||||||
|
ninja_build()
|
||||||
|
{
|
||||||
|
local EXTENSION=""
|
||||||
|
local NINJA_CXX_COMPILER=""
|
||||||
|
local NINJA_PLATFORM=""
|
||||||
|
|
||||||
|
# Clean old build if necessary
|
||||||
|
[ "${CLEAN_BUILD}" -eq 1 ] && rm -rf ${NINJADIR}/build-${SYSTEM_NAME}
|
||||||
|
|
||||||
|
# Additional, target-specific configuration options
|
||||||
|
case "${SYSTEM_NAME}" in
|
||||||
|
Windows)
|
||||||
|
EXTENSION=".exe"
|
||||||
|
NINJA_CXX_COMPILER="${SYSTEM_HOST}-g++"
|
||||||
|
NINJA_PLATFORM="mingw"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
NINJA_CXX_COMPILER="clang++"
|
||||||
|
NINJA_PLATFORM="linux"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Build Ninja
|
||||||
|
echo ">>> Building NINJA ..."
|
||||||
|
mkdir -p ${NINJADIR}/build-${SYSTEM_NAME}
|
||||||
|
cd ${NINJADIR}/build-${SYSTEM_NAME}
|
||||||
|
CXX=${NINJA_CXX_COMPILER} ../configure.py --platform=${NINJA_PLATFORM}
|
||||||
|
ninja -j ${BUILD_JOBS}
|
||||||
|
install ninja${EXTENSION} ${BINDIR}/bin/
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function downloads NINJA from VCS
|
||||||
|
ninja_fetch()
|
||||||
|
{
|
||||||
|
if [ ! -d ${NINJADIR} ]; then
|
||||||
|
echo ">>> Downloading NINJA ..."
|
||||||
|
git clone --depth 1 --branch ${NINJATAG} ${NINJAVCS} ${NINJADIR}
|
||||||
|
cd ${NINJADIR}
|
||||||
|
apply_patches ${NINJADIR##*/} ${NINJATAG}
|
||||||
|
cd ${WRKDIR}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Performs requirements check and prepares environment
|
||||||
|
prepare_environment()
|
||||||
|
{
|
||||||
|
# Verify that the number of build jobs is a positive integer
|
||||||
|
if [ -z "${BUILD_JOBS##*[!0-9]*}" ]; then
|
||||||
|
echo "ERROR: Invalid number of jobs provided. Please enter a positive integer."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify that all required tools are installed
|
||||||
|
for APP in {clang,clang++,cmake,lld,ninja,x86_64-w64-mingw32-windres}; do
|
||||||
|
which ${APP} &> /dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: ${APP} not found. Please install the required tool."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Set target-specific options
|
||||||
|
case "${TARGET_SYSTEM}" in
|
||||||
|
windows|*-mingw32)
|
||||||
|
SYSTEM_NAME="Windows"
|
||||||
|
SYSTEM_HOST="x86_64-w64-mingw32"
|
||||||
|
;;
|
||||||
|
linux|*-linux-*)
|
||||||
|
SYSTEM_NAME="Linux"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: Invalid target system specified. Please choose a valid target system."
|
||||||
|
exit 3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prints usage help
|
||||||
|
print_usage()
|
||||||
|
{
|
||||||
|
echo "USAGE: ${0} [--clean] [--enable-llvm-assembly] [--jobs=N] [--minimal] [--static-llvm] [--target={linux,windows}]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function compiles and install WINE tools
|
||||||
|
wine_build()
|
||||||
|
{
|
||||||
|
local CONFIGURE_PARAMETERS=""
|
||||||
|
local EXTENSION=""
|
||||||
|
|
||||||
|
# Clean old build if necessary
|
||||||
|
[ "${CLEAN_BUILD}" -eq 1 ] && rm -rf ${WINEDIR}/{build-${SYSTEM_NAME},build-tools}
|
||||||
|
|
||||||
|
# Additional, target-specific configuration options
|
||||||
|
case "${SYSTEM_NAME}" in
|
||||||
|
Windows)
|
||||||
|
CONFIGURE_PARAMETERS="${CONFIGURE_PARAMETERS} --host=${SYSTEM_HOST}"
|
||||||
|
EXTENSION=".exe"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Build Wine (first configuration builds makedep)
|
||||||
|
echo ">>> Building Wine ..."
|
||||||
|
mkdir -p ${WINEDIR}/{build-${SYSTEM_NAME},build-tools}
|
||||||
|
cd ${WINEDIR}/build-tools
|
||||||
|
../configure \
|
||||||
|
--enable-win64 \
|
||||||
|
--without-freetype \
|
||||||
|
--without-x
|
||||||
|
cd ${WINEDIR}/build-${SYSTEM_NAME}
|
||||||
|
../configure \
|
||||||
|
--enable-tools \
|
||||||
|
--enable-win64 \
|
||||||
|
--with-wine-tools=${WINEDIR}/build-tools \
|
||||||
|
--without-freetype \
|
||||||
|
--without-x \
|
||||||
|
${CONFIGURE_PARAMETERS}
|
||||||
|
for TOOL in widl wmc wrc; do
|
||||||
|
make -j ${BUILD_JOBS} tools/${TOOL}/all
|
||||||
|
cp tools/${TOOL}/${TOOL}${EXTENSION} ${BINDIR}/bin/
|
||||||
|
done
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function downloads WINE from VCS
|
||||||
|
wine_fetch()
|
||||||
|
{
|
||||||
|
if [ ! -d ${WINEDIR} ]; then
|
||||||
|
echo ">>> Downloading WINE ..."
|
||||||
|
git clone --depth 1 --branch ${WINETAG} ${WINEVCS} ${WINEDIR}
|
||||||
|
cd ${WINEDIR}
|
||||||
|
apply_patches ${WINEDIR##*/} ${WINETAG##*-}
|
||||||
|
cd ${WRKDIR}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function installs XTCHAIN tools and scripts
|
||||||
|
xtchain_build()
|
||||||
|
{
|
||||||
|
# Target-specific configuration options
|
||||||
|
case "${SYSTEM_NAME}" in
|
||||||
|
Windows)
|
||||||
|
CCOMPILER="${SYSTEM_HOST}-gcc"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CCOMPILER="clang"
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Build XTchain tools
|
||||||
|
echo ">>> Building XTchain tools ..."
|
||||||
|
mkdir -p ${BINDIR}/bin
|
||||||
|
mkdir -p ${BINDIR}/lib/xtchain
|
||||||
|
for EXEC in bin2c exetool xtcspecc; do
|
||||||
|
if [ ! -e ${BINDIR}/bin/${EXEC} ]; then
|
||||||
|
${CCOMPILER} ${WRKDIR}/tools/${EXEC}.c -o ${BINDIR}/bin/${EXEC}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cp ${WRKDIR}/scripts/xtclib* ${BINDIR}/lib/xtchain/
|
||||||
|
cp ${WRKDIR}/scripts/xtchain* ${BINDIR}/
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function generates XTCHAIN version file and produces tarball archive
|
||||||
|
xtchain_tarball()
|
||||||
|
{
|
||||||
|
local EXTENSION=""
|
||||||
|
local LIBDIR=""
|
||||||
|
|
||||||
|
# Additional, target-specific configuration options
|
||||||
|
case "${SYSTEM_NAME}" in
|
||||||
|
Windows)
|
||||||
|
EXTENSION=".exe"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Remove unneeded files to save disk space
|
||||||
|
echo ">>> Removing unneeded files to save disk space ..."
|
||||||
|
rm -rf ${BINDIR}/{doc,include,share/{bash-completion,emacs,info,locale,man,vim}}
|
||||||
|
for EXEC in amdgpu-arch clang-check clang-exdef-mapping clang-import-test clang-offload-* clang-rename clang-scan-deps diagtool hmaptool ld64.lld modularize nxptx-arch wasm-ld; do
|
||||||
|
rm -f ${BINDIR}/bin/${EXEC}${EXTENSION}
|
||||||
|
done
|
||||||
|
|
||||||
|
# Generate version file
|
||||||
|
cd ${WRKDIR}
|
||||||
|
: ${XTCVER:=$(git describe --exact-match --tags 2>/dev/null)}
|
||||||
|
: ${XTCVER:=DEVEL}
|
||||||
|
[ ${BUILD_MINIMAL} -eq 1 ] && XTCVER="${XTCVER}-lite"
|
||||||
|
echo "${XTCVER}" > ${BINDIR}/Version
|
||||||
|
|
||||||
|
# Windows target specific actions
|
||||||
|
if [ "${SYSTEM_NAME}" == "Windows" ]; then
|
||||||
|
# Replace symlinks with original files
|
||||||
|
for LINK in $(find ${BINDIR}/bin -maxdepth 1 -type l); do
|
||||||
|
cp -f --remove-destination $(readlink -e ${LINK}) ${LINK}
|
||||||
|
done
|
||||||
|
|
||||||
|
# Copy dynamic libraries
|
||||||
|
if [ ${BUILD_MINIMAL} -eq 0 ]; then
|
||||||
|
LIBDIR="$(dirname $(readlink -f $(command -v ${SYSTEM_HOST}-windres)))/../${SYSTEM_HOST}"
|
||||||
|
for DLL in $(${SYSTEM_HOST}-objdump --private-headers ${BINDIR}/bin/cmake.exe | grep "DLL Name:" | cut -d' ' -f3 | grep "lib.*.dll"); do
|
||||||
|
find ${LIBDIR} -type f -name ${DLL} -exec cp {} ${BINDIR}/bin \;
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build tarball
|
||||||
|
echo ">>> Creating toolchain archive ..."
|
||||||
|
tar -I 'zstd -19' -cpf xtchain-${XTCVER}-${TARGET_SYSTEM}.tar.zst -C ${BINDIR} .
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Parse all arguments provided to the script
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
--clean)
|
||||||
|
# Performs clean build
|
||||||
|
CLEAN_BUILD=1
|
||||||
|
;;
|
||||||
|
--enable-llvm-assembly)
|
||||||
|
# Enables LLVM asembly files compilation (like BLAKE3)
|
||||||
|
ENABLE_LLVM_ASSEMBLY=1
|
||||||
|
;;
|
||||||
|
--jobs=*)
|
||||||
|
# Sets number of CPU cores used for compilation
|
||||||
|
BUILD_JOBS="${1#*=}"
|
||||||
|
;;
|
||||||
|
--minimal)
|
||||||
|
BUILD_MINIMAL=1
|
||||||
|
;;
|
||||||
|
--static-llvm)
|
||||||
|
# Compiles LLVM statically
|
||||||
|
LLVM_DYNAMIC_LINK=OFF
|
||||||
|
;;
|
||||||
|
--target=*)
|
||||||
|
# Sets the target system for built toolchain (Linux or Windows)
|
||||||
|
TARGET_SYSTEM="${1#*=}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Prints help if any other parameter given
|
||||||
|
print_usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# Prepare environment
|
||||||
|
prepare_environment
|
||||||
|
|
||||||
|
# Exit immediately on any failure
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Check number of CPU cores available
|
||||||
|
if [ ${BUILD_JOBS} -eq 0 ]; then
|
||||||
|
unset BUILD_JOBS
|
||||||
|
: ${BUILD_JOBS:=$(sysctl -n hw.ncpu 2>/dev/null)}
|
||||||
|
: ${BUILD_JOBS:=$(nproc 2>/dev/null)}
|
||||||
|
: ${BUILD_JOBS:=1}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create working directories
|
||||||
|
mkdir -p ${BINDIR}
|
||||||
|
mkdir -p ${SRCDIR}
|
||||||
|
|
||||||
|
# Build XTchain tools
|
||||||
|
xtchain_build
|
||||||
|
|
||||||
|
# Download and build Wine tools
|
||||||
|
wine_fetch
|
||||||
|
wine_build
|
||||||
|
|
||||||
|
if [ ${BUILD_MINIMAL} -eq 0 ]; then
|
||||||
|
# Download and build LLVM
|
||||||
|
llvm_fetch
|
||||||
|
llvm_build
|
||||||
|
|
||||||
|
# Download and build CMake
|
||||||
|
cmake_fetch
|
||||||
|
cmake_build
|
||||||
|
|
||||||
|
# Download and build Ninja
|
||||||
|
ninja_fetch
|
||||||
|
ninja_build
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate tarball archive
|
||||||
|
xtchain_tarball
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
Though GOLD is not yet enabled for TDM-GCC, this patch will help
|
|
||||||
|
|
||||||
From: J.M. Eubank <john@thesnappy.net>
|
|
||||||
|
|
||||||
From
|
|
||||||
<https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-binutils/0001-enable-gold-on.mingw32.patch>
|
|
||||||
---
|
|
||||||
0 files changed
|
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
|
||||||
index 6a9719f6..f07a3b7f 100755
|
|
||||||
--- a/configure
|
|
||||||
+++ b/configure
|
|
||||||
@@ -3001,6 +3001,7 @@ case "${ENABLE_GOLD}" in
|
|
||||||
yes|default)
|
|
||||||
# Check for ELF target.
|
|
||||||
is_elf=no
|
|
||||||
+ is_pe=no
|
|
||||||
case "${target}" in
|
|
||||||
*-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
|
|
||||||
| *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
|
|
||||||
@@ -3012,10 +3013,12 @@ case "${ENABLE_GOLD}" in
|
|
||||||
*)
|
|
||||||
is_elf=yes
|
|
||||||
;;
|
|
||||||
- esac
|
|
||||||
+ esac;;
|
|
||||||
+ *-*-mingw*)
|
|
||||||
+ is_pe=yes;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
- if test "$is_elf" = "yes"; then
|
|
||||||
+ if test "$is_elf" = "yes" -o "$is_pe" = "yes"; then
|
|
||||||
# Check for target supported by gold.
|
|
||||||
case "${target}" in
|
|
||||||
i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
Make GCC fully relocatable, not searching any fixed paths
|
|
||||||
|
|
||||||
From: J.M. Eubank <john@thesnappy.net>
|
|
||||||
|
|
||||||
that aren't relative to the current installation path
|
|
||||||
|
|
||||||
# HG changeset patch
|
|
||||||
# Parent 2a1167ee4ed20c6ff3558a104218585837e9963f
|
|
||||||
---
|
|
||||||
0 files changed
|
|
||||||
|
|
||||||
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
|
|
||||||
index 086c0e460..f0ceca42b 100644
|
|
||||||
--- a/gcc/config/i386/mingw32.h
|
|
||||||
+++ b/gcc/config/i386/mingw32.h
|
|
||||||
@@ -78,7 +78,7 @@ along with GCC; see the file COPYING3. If not see
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef NATIVE_SYSTEM_HEADER_COMPONENT
|
|
||||||
-#define NATIVE_SYSTEM_HEADER_COMPONENT "MINGW"
|
|
||||||
+#undef NATIVE_SYSTEM_HEADER_DIR
|
|
||||||
|
|
||||||
#undef CPP_SPEC
|
|
||||||
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \
|
|
||||||
@@ -183,17 +183,12 @@ along with GCC; see the file COPYING3. If not see
|
|
||||||
|
|
||||||
/* Override startfile prefix defaults. */
|
|
||||||
#ifndef STANDARD_STARTFILE_PREFIX_1
|
|
||||||
-#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
|
|
||||||
+#define STANDARD_STARTFILE_PREFIX_1 ""
|
|
||||||
#endif
|
|
||||||
#ifndef STANDARD_STARTFILE_PREFIX_2
|
|
||||||
#define STANDARD_STARTFILE_PREFIX_2 ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-/* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
|
|
||||||
- macro contains POSIX-style path. See bug 52947. */
|
|
||||||
-#undef NATIVE_SYSTEM_HEADER_DIR
|
|
||||||
-#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
|
|
||||||
-
|
|
||||||
/* Output STRING, a string representing a filename, to FILE.
|
|
||||||
We canonicalize it to be in Unix format (backslashes are replaced
|
|
||||||
forward slashes. */
|
|
||||||
diff --git a/gcc/incpath.c b/gcc/incpath.c
|
|
||||||
index bcbe20829..c5d4453d8 100644
|
|
||||||
--- a/gcc/incpath.c
|
|
||||||
+++ b/gcc/incpath.c
|
|
||||||
@@ -183,8 +183,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
|
|
||||||
str = concat (sysroot_no_trailing_dir_separator, p->fname, NULL);
|
|
||||||
free (sysroot_no_trailing_dir_separator);
|
|
||||||
}
|
|
||||||
- else if (!p->add_sysroot && relocated
|
|
||||||
- && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
|
|
||||||
+ if (relocated && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
|
|
||||||
{
|
|
||||||
static const char *relocated_prefix;
|
|
||||||
char *ostr;
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/lldb/source/Host/windows/MainLoopWindows.cpp b/lldb/source/Host/windows/MainLoopWindows.cpp
|
||||||
|
index c0b10797e..e971b8cfd 100644
|
||||||
|
--- a/lldb/source/Host/windows/MainLoopWindows.cpp
|
||||||
|
+++ b/lldb/source/Host/windows/MainLoopWindows.cpp
|
||||||
|
@@ -58,7 +58,7 @@ public:
|
||||||
|
// Keep trying to cancel ReadFile() until the thread exits.
|
||||||
|
do {
|
||||||
|
CancelIoEx(m_handle, /*lpOverlapped=*/NULL);
|
||||||
|
- } while (WaitForSingleObject(m_monitor_thread.native_handle(), 1) ==
|
||||||
|
+ } while (WaitForSingleObject((HANDLE)m_monitor_thread.native_handle(), 1) ==
|
||||||
|
WAIT_TIMEOUT);
|
||||||
|
m_monitor_thread.join();
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,364 +0,0 @@
|
|||||||
diff -apurN a/mingw-w64-tools/widl/src/header.c b/mingw-w64-tools/widl/src/header.c
|
|
||||||
--- a/mingw-w64-tools/widl/src/header.c 2020-08-01 22:51:29.248778551 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/header.c 2020-08-01 21:41:41.998028252 +0200
|
|
||||||
@@ -1221,7 +1221,7 @@ static void write_inline_wrappers(FILE *
|
|
||||||
if (!is_callas(func->attrs)) {
|
|
||||||
const var_t *arg;
|
|
||||||
|
|
||||||
- fprintf(header, "static FORCEINLINE ");
|
|
||||||
+ fprintf(header, "FORCEINLINE ");
|
|
||||||
write_type_decl_left(header, type_function_get_ret(func->declspec.type));
|
|
||||||
fprintf(header, " %s_%s(", name, get_name(func));
|
|
||||||
write_args(header, type_function_get_args(func->declspec.type), name, 1, FALSE);
|
|
||||||
@@ -1256,7 +1256,16 @@ static void do_write_c_method_def(FILE *
|
|
||||||
|
|
||||||
if (type_iface_get_inherit(iface))
|
|
||||||
do_write_c_method_def(header, type_iface_get_inherit(iface), name);
|
|
||||||
-
|
|
||||||
+ else if (type_iface_get_stmts(iface) == NULL)
|
|
||||||
+ {
|
|
||||||
+ fprintf(header, "#ifndef __cplusplus\n");
|
|
||||||
+ indent(header, 0);
|
|
||||||
+ fprintf(header, "char dummy;\n");
|
|
||||||
+ fprintf(header, "#endif\n");
|
|
||||||
+ fprintf(header, "\n");
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
|
|
||||||
{
|
|
||||||
const var_t *func = stmt->u.var;
|
|
||||||
@@ -1804,6 +1813,11 @@ void write_header(const statement_list_t
|
|
||||||
fprintf(header, "#ifndef __REQUIRED_RPCNDR_H_VERSION__\n");
|
|
||||||
fprintf(header, "#define __REQUIRED_RPCNDR_H_VERSION__ 475\n");
|
|
||||||
fprintf(header, "#endif\n");
|
|
||||||
+
|
|
||||||
+ fprintf(header, "#ifdef __REACTOS__\n");
|
|
||||||
+ fprintf(header, "#define WIN32_LEAN_AND_MEAN\n");
|
|
||||||
+ fprintf(header, "#endif\n\n");
|
|
||||||
+
|
|
||||||
fprintf(header, "#include <rpc.h>\n" );
|
|
||||||
fprintf(header, "#include <rpcndr.h>\n" );
|
|
||||||
if (!for_each_serializable(stmts, NULL, serializable_exists))
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/parser.tab.c b/mingw-w64-tools/widl/src/parser.tab.c
|
|
||||||
--- a/mingw-w64-tools/widl/src/parser.tab.c 2020-08-01 22:51:29.249778547 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/parser.tab.c 2020-08-01 22:55:45.839676740 +0200
|
|
||||||
@@ -196,8 +196,6 @@ static struct namespace global_namespace
|
|
||||||
|
|
||||||
static struct namespace *current_namespace = &global_namespace;
|
|
||||||
|
|
||||||
-static typelib_t *current_typelib;
|
|
||||||
-
|
|
||||||
|
|
||||||
#line 203 "parser.tab.c" /* yacc.c:339 */
|
|
||||||
|
|
||||||
@@ -2612,7 +2610,6 @@ yyreduce:
|
|
||||||
write_client((yyvsp[-1].stmt_list));
|
|
||||||
write_server((yyvsp[-1].stmt_list));
|
|
||||||
write_regscript((yyvsp[-1].stmt_list));
|
|
||||||
- write_typelib_regscript((yyvsp[-1].stmt_list));
|
|
||||||
write_dlldata((yyvsp[-1].stmt_list));
|
|
||||||
write_local_stubs((yyvsp[-1].stmt_list));
|
|
||||||
}
|
|
||||||
@@ -2893,7 +2890,7 @@ yyreduce:
|
|
||||||
|
|
||||||
case 52:
|
|
||||||
#line 424 "parser.y" /* yacc.c:1651 */
|
|
||||||
- { (yyval.str) = (yyvsp[-2].str); if(!parse_only) add_importlib((yyvsp[-2].str), current_typelib); }
|
|
||||||
+ { (yyval.str) = (yyvsp[-2].str); if(!parse_only) add_importlib((yyvsp[-2].str)); }
|
|
||||||
#line 2898 "parser.tab.c" /* yacc.c:1651 */
|
|
||||||
break;
|
|
||||||
|
|
||||||
@@ -2912,7 +2909,7 @@ yyreduce:
|
|
||||||
case 55:
|
|
||||||
#line 430 "parser.y" /* yacc.c:1651 */
|
|
||||||
{ (yyval.typelib) = make_library((yyvsp[-1].str), check_library_attrs((yyvsp[-1].str), (yyvsp[-2].attr_list)));
|
|
||||||
- if (!parse_only && do_typelib) current_typelib = (yyval.typelib);
|
|
||||||
+ if (!parse_only) start_typelib(yyval.typelib);
|
|
||||||
}
|
|
||||||
#line 2918 "parser.tab.c" /* yacc.c:1651 */
|
|
||||||
break;
|
|
||||||
@@ -6019,6 +6016,12 @@ static type_t *reg_typedefs(decl_spec_t
|
|
||||||
type->attrs = attrs;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it */
|
|
||||||
+ if (type_get_type_detect_alias(type) == TYPE_UNION &&
|
|
||||||
+ is_attr(attrs, ATTR_SWITCHTYPE) &&
|
|
||||||
+ !is_attr(type->attrs, ATTR_SWITCHTYPE))
|
|
||||||
+ type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE)));
|
|
||||||
+
|
|
||||||
LIST_FOR_EACH_ENTRY( decl, decls, declarator_t, entry )
|
|
||||||
{
|
|
||||||
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/parser.y b/mingw-w64-tools/widl/src/parser.y
|
|
||||||
--- a/mingw-w64-tools/widl/src/parser.y 2020-08-01 22:51:29.250778543 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/parser.y 2020-08-01 21:48:30.318245917 +0200
|
|
||||||
@@ -123,8 +123,6 @@ static struct namespace global_namespace
|
|
||||||
|
|
||||||
static struct namespace *current_namespace = &global_namespace;
|
|
||||||
|
|
||||||
-static typelib_t *current_typelib;
|
|
||||||
-
|
|
||||||
%}
|
|
||||||
%union {
|
|
||||||
attr_t *attr;
|
|
||||||
@@ -320,7 +318,6 @@ input: gbl_statements m_acf { check_st
|
|
||||||
write_client($1);
|
|
||||||
write_server($1);
|
|
||||||
write_regscript($1);
|
|
||||||
- write_typelib_regscript($1);
|
|
||||||
write_dlldata($1);
|
|
||||||
write_local_stubs($1);
|
|
||||||
}
|
|
||||||
@@ -421,18 +418,18 @@ import: import_start imp_statements aEOF
|
|
||||||
;
|
|
||||||
|
|
||||||
importlib: tIMPORTLIB '(' aSTRING ')'
|
|
||||||
- semicolon_opt { $$ = $3; if(!parse_only) add_importlib($3, current_typelib); }
|
|
||||||
+ semicolon_opt { $$ = $3; if(!parse_only) add_importlib($3); }
|
|
||||||
;
|
|
||||||
|
|
||||||
libraryhdr: tLIBRARY aIDENTIFIER { $$ = $2; }
|
|
||||||
| tLIBRARY aKNOWNTYPE { $$ = $2; }
|
|
||||||
;
|
|
||||||
library_start: attributes libraryhdr '{' { $$ = make_library($2, check_library_attrs($2, $1));
|
|
||||||
- if (!parse_only && do_typelib) current_typelib = $$;
|
|
||||||
+ if (!parse_only) start_typelib($$);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
librarydef: library_start imp_statements '}'
|
|
||||||
- semicolon_opt { $$ = $1; $$->stmts = $2; }
|
|
||||||
+ semicolon_opt { $$ = $1; $$->stmts = $2; if (!parse_only) end_typelib(); }
|
|
||||||
;
|
|
||||||
|
|
||||||
m_args: { $$ = NULL; }
|
|
||||||
@@ -1906,6 +1903,12 @@ static type_t *reg_typedefs(decl_spec_t
|
|
||||||
type->attrs = attrs;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it. */
|
|
||||||
+ if (type_get_type_detect_alias(type) == TYPE_UNION &&
|
|
||||||
+ is_attr(attrs, ATTR_SWITCHTYPE) &&
|
|
||||||
+ !is_attr(type->attrs, ATTR_SWITCHTYPE))
|
|
||||||
+ type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE)));
|
|
||||||
+
|
|
||||||
LIST_FOR_EACH_ENTRY( decl, decls, declarator_t, entry )
|
|
||||||
{
|
|
||||||
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/proxy.c b/mingw-w64-tools/widl/src/proxy.c
|
|
||||||
--- a/mingw-w64-tools/widl/src/proxy.c 2020-08-01 22:51:29.079779285 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/proxy.c 2020-08-01 22:56:14.230555312 +0200
|
|
||||||
@@ -88,6 +88,12 @@ static void init_proxy(const statement_l
|
|
||||||
print_proxy( "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
|
|
||||||
print_proxy( "\n");
|
|
||||||
print_proxy( "#define __midl_proxy\n");
|
|
||||||
+
|
|
||||||
+ print_proxy( "#ifdef __REACTOS__\n");
|
|
||||||
+ print_proxy( "#define WIN32_NO_STATUS\n");
|
|
||||||
+ print_proxy( "#define WIN32_LEAN_AND_MEAN\n");
|
|
||||||
+ print_proxy( "#endif\n\n");
|
|
||||||
+
|
|
||||||
print_proxy( "#include \"objbase.h\"\n");
|
|
||||||
print_proxy( "\n");
|
|
||||||
print_proxy( "#ifndef DECLSPEC_HIDDEN\n");
|
|
||||||
@@ -482,14 +488,15 @@ static const statement_t * get_callas_so
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static void write_proxy_procformatstring_offsets( const type_t *iface, int skip )
|
|
||||||
+static int write_proxy_procformatstring_offsets( const type_t *iface, int skip )
|
|
||||||
{
|
|
||||||
const statement_t *stmt;
|
|
||||||
+ int i;
|
|
||||||
|
|
||||||
if (type_iface_get_inherit(iface))
|
|
||||||
- write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface));
|
|
||||||
+ i = write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface));
|
|
||||||
else
|
|
||||||
- return;
|
|
||||||
+ return 0;
|
|
||||||
|
|
||||||
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
|
|
||||||
{
|
|
||||||
@@ -509,7 +516,9 @@ static void write_proxy_procformatstring
|
|
||||||
print_proxy( "(unsigned short)-1, /* %s::%s */\n", iface->name, get_name(func));
|
|
||||||
else
|
|
||||||
print_proxy( "%u, /* %s::%s */\n", func->procstring_offset, iface->name, get_name(func));
|
|
||||||
+ i++;
|
|
||||||
}
|
|
||||||
+ return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int write_proxy_methods(type_t *iface, int skip)
|
|
||||||
@@ -643,7 +652,10 @@ static void write_proxy(type_t *iface, u
|
|
||||||
print_proxy( "static const unsigned short %s_FormatStringOffsetTable[] =\n", iface->name );
|
|
||||||
print_proxy( "{\n" );
|
|
||||||
indent++;
|
|
||||||
- write_proxy_procformatstring_offsets( iface, 0 );
|
|
||||||
+ if (write_proxy_procformatstring_offsets( iface, 0 ) == 0)
|
|
||||||
+ {
|
|
||||||
+ print_proxy( "0\n" );
|
|
||||||
+ }
|
|
||||||
indent--;
|
|
||||||
print_proxy( "};\n\n" );
|
|
||||||
|
|
||||||
@@ -718,7 +730,10 @@ static void write_proxy(type_t *iface, u
|
|
||||||
print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
|
|
||||||
print_proxy( "{\n");
|
|
||||||
indent++;
|
|
||||||
- write_stub_methods(iface, FALSE);
|
|
||||||
+ if (write_stub_methods(iface, FALSE) == 0)
|
|
||||||
+ {
|
|
||||||
+ fprintf(proxy, 0);
|
|
||||||
+ }
|
|
||||||
fprintf(proxy, "\n");
|
|
||||||
indent--;
|
|
||||||
fprintf(proxy, "};\n\n");
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/register.c b/mingw-w64-tools/widl/src/register.c
|
|
||||||
--- a/mingw-w64-tools/widl/src/register.c 2020-08-01 22:52:08.525607975 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/register.c 2020-08-01 22:56:25.382507605 +0200
|
|
||||||
@@ -324,6 +324,9 @@ void output_typelib_regscript( const typ
|
|
||||||
put_str( indent++, "{\n" );
|
|
||||||
expr = get_attrp( typelib->attrs, ATTR_ID );
|
|
||||||
if (expr)
|
|
||||||
+ sprintf(id_part, "\\%d", expr->cval);
|
|
||||||
+
|
|
||||||
+ if (expr)
|
|
||||||
{
|
|
||||||
sprintf(id_part, "\\%d", expr->cval);
|
|
||||||
resname = xmalloc( strlen(typelib_name) + 20 );
|
|
||||||
@@ -349,5 +352,5 @@ void output_typelib_regscript( const typ
|
|
||||||
write_progids( typelib->stmts );
|
|
||||||
put_str( --indent, "}\n" );
|
|
||||||
|
|
||||||
- add_output_to_resources( "WINE_REGISTRY", resname );
|
|
||||||
+ add_output_to_resources( "WINE_REGISTRY", typelib_name );
|
|
||||||
}
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/typegen.c b/mingw-w64-tools/widl/src/typegen.c
|
|
||||||
--- a/mingw-w64-tools/widl/src/typegen.c 2020-08-01 22:51:29.250778543 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/typegen.c 2020-08-01 22:56:33.110474542 +0200
|
|
||||||
@@ -4816,7 +4816,7 @@ void write_func_param_struct( FILE *file
|
|
||||||
if (align >= pointer_size)
|
|
||||||
fprintf( file, "%s;\n", arg->name );
|
|
||||||
else
|
|
||||||
- fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size );
|
|
||||||
+ fprintf( file, "DECLSPEC_ALIGN(%u) %s;\n", pointer_size, arg->name );
|
|
||||||
}
|
|
||||||
if (add_retval && !is_void( retval->declspec.type ))
|
|
||||||
{
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/typelib.c b/mingw-w64-tools/widl/src/typelib.c
|
|
||||||
--- a/mingw-w64-tools/widl/src/typelib.c 2020-08-01 22:51:29.080779281 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/typelib.c 2020-08-01 22:56:40.014445003 +0200
|
|
||||||
@@ -44,6 +44,7 @@
|
|
||||||
#include "typelib_struct.h"
|
|
||||||
#include "typetree.h"
|
|
||||||
|
|
||||||
+static typelib_t *typelib;
|
|
||||||
|
|
||||||
/* List of oleauto types that should be recognized by name.
|
|
||||||
* (most of) these seem to be intrinsic types in mktyplib.
|
|
||||||
@@ -239,6 +240,18 @@ unsigned short get_type_vt(type_t *t)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+void start_typelib(typelib_t *typelib_type)
|
|
||||||
+{
|
|
||||||
+ if (!do_typelib) return;
|
|
||||||
+ typelib = typelib_type;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void end_typelib(void)
|
|
||||||
+{
|
|
||||||
+ if (!typelib) return;
|
|
||||||
+ create_msft_typelib(typelib);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static void tlb_read(int fd, void *buf, int count)
|
|
||||||
{
|
|
||||||
if(read(fd, buf, count) < count)
|
|
||||||
@@ -363,7 +376,7 @@ static void read_importlib(importlib_t *
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
-void add_importlib(const char *name, typelib_t *typelib)
|
|
||||||
+void add_importlib(const char *name)
|
|
||||||
{
|
|
||||||
importlib_t *importlib;
|
|
||||||
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/typelib.h b/mingw-w64-tools/widl/src/typelib.h
|
|
||||||
--- a/mingw-w64-tools/widl/src/typelib.h 2020-08-01 22:52:08.525607975 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/typelib.h 2020-08-01 22:56:45.782420322 +0200
|
|
||||||
@@ -21,7 +21,9 @@
|
|
||||||
#ifndef __WIDL_TYPELIB_H
|
|
||||||
#define __WIDL_TYPELIB_H
|
|
||||||
|
|
||||||
-extern void add_importlib(const char *name, typelib_t *typelib);
|
|
||||||
+extern void start_typelib(typelib_t *typelib_type);
|
|
||||||
+extern void end_typelib(void);
|
|
||||||
+extern void add_importlib(const char *name);
|
|
||||||
|
|
||||||
/* Copied from wtypes.h. Not included directly because that would create a
|
|
||||||
* circular dependency (after all, wtypes.h is generated by widl...) */
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/widl.c b/mingw-w64-tools/widl/src/widl.c
|
|
||||||
--- a/mingw-w64-tools/widl/src/widl.c 2020-08-01 22:52:08.526607970 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/widl.c 2020-08-01 21:36:56.893265451 +0200
|
|
||||||
@@ -388,6 +388,12 @@ static void write_dlldata_list(struct li
|
|
||||||
fprintf(dlldata, "- Do not edit ***/\n\n");
|
|
||||||
if (define_proxy_delegation)
|
|
||||||
fprintf(dlldata, "#define PROXY_DELEGATION\n");
|
|
||||||
+
|
|
||||||
+ fprintf(dlldata, "#ifdef __REACTOS__\n");
|
|
||||||
+ fprintf(dlldata, "#define WIN32_NO_STATUS\n");
|
|
||||||
+ fprintf(dlldata, "#define WIN32_LEAN_AND_MEAN\n");
|
|
||||||
+ fprintf(dlldata, "#endif\n\n");
|
|
||||||
+
|
|
||||||
fprintf(dlldata, "#include <objbase.h>\n");
|
|
||||||
fprintf(dlldata, "#include <rpcproxy.h>\n\n");
|
|
||||||
start_cplusplus_guard(dlldata);
|
|
||||||
@@ -533,6 +539,12 @@ void write_id_data(const statement_list_
|
|
||||||
|
|
||||||
fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
|
|
||||||
fprintf(idfile, "from %s - Do not edit ***/\n\n", input_idl_name);
|
|
||||||
+
|
|
||||||
+ fprintf(idfile, "#ifdef __REACTOS__\n");
|
|
||||||
+ fprintf(idfile, "#define WIN32_NO_STATUS\n");
|
|
||||||
+ fprintf(idfile, "#define WIN32_LEAN_AND_MEAN\n");
|
|
||||||
+ fprintf(idfile, "#endif\n\n");
|
|
||||||
+
|
|
||||||
fprintf(idfile, "#include <rpc.h>\n");
|
|
||||||
fprintf(idfile, "#include <rpcndr.h>\n\n");
|
|
||||||
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/widl.h b/mingw-w64-tools/widl/src/widl.h
|
|
||||||
--- a/mingw-w64-tools/widl/src/widl.h 2020-08-01 22:52:08.526607970 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/widl.h 2020-08-01 22:56:54.478383110 +0200
|
|
||||||
@@ -96,7 +96,6 @@ extern void write_proxies(const statemen
|
|
||||||
extern void write_client(const statement_list_t *stmts);
|
|
||||||
extern void write_server(const statement_list_t *stmts);
|
|
||||||
extern void write_regscript(const statement_list_t *stmts);
|
|
||||||
-extern void write_typelib_regscript(const statement_list_t *stmts);
|
|
||||||
extern void output_typelib_regscript( const typelib_t *typelib );
|
|
||||||
extern void write_local_stubs(const statement_list_t *stmts);
|
|
||||||
extern void write_dlldata(const statement_list_t *stmts);
|
|
||||||
diff -apurN a/mingw-w64-tools/widl/src/write_msft.c b/mingw-w64-tools/widl/src/write_msft.c
|
|
||||||
--- a/mingw-w64-tools/widl/src/write_msft.c 2020-08-01 22:51:29.252778534 +0200
|
|
||||||
+++ b/mingw-w64-tools/widl/src/write_msft.c 2020-08-01 21:39:46.785529130 +0200
|
|
||||||
@@ -54,6 +54,10 @@
|
|
||||||
#include "parser.h"
|
|
||||||
#include "typegen.h"
|
|
||||||
|
|
||||||
+#define S_OK 0
|
|
||||||
+#define S_FALSE 1
|
|
||||||
+#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
|
|
||||||
+
|
|
||||||
enum MSFT_segment_index {
|
|
||||||
MSFT_SEG_TYPEINFO = 0, /* type information */
|
|
||||||
MSFT_SEG_IMPORTINFO, /* import information */
|
|
||||||
@@ -2663,6 +2667,7 @@ static void save_all_changes(msft_typeli
|
|
||||||
sprintf( typelib_id, "#%d", expr->cval );
|
|
||||||
add_output_to_resources( "TYPELIB", typelib_id );
|
|
||||||
output_typelib_regscript( typelib->typelib );
|
|
||||||
+ flush_output_resources( typelib_name );
|
|
||||||
}
|
|
||||||
else flush_output_buffer( typelib_name );
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
## FerretOS Build Environment (FBE)
|
|
||||||
The FerretOS Build Environment (FBE) is the official build environment for compiling FerretOS.
|
|
||||||
Currently, it is targeted at Linux only, however a Windows and FerretOS versions will be available
|
|
||||||
in the future as well.
|
|
||||||
|
|
||||||
This software includes:
|
|
||||||
* Binutils
|
|
||||||
* GCC
|
|
||||||
* Mingw-w64
|
|
||||||
* CMake
|
|
||||||
* Ninja
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Check if script launched as root
|
|
||||||
if [ "$(whoami)" = "root" ]; then
|
|
||||||
echo "This script cannot be run as root!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the absolute path to the FBE
|
|
||||||
export FBEDIR="$(realpath $(dirname ${0}))"
|
|
||||||
|
|
||||||
# Read the FBE version
|
|
||||||
export FBEVER="$(cat ${FBEDIR}/Version)"
|
|
||||||
|
|
||||||
# Load the library
|
|
||||||
source ${FBEDIR}/fbelib.sh
|
|
||||||
|
|
||||||
# Set the target architecture
|
|
||||||
: ${TARGET:=${1}}
|
|
||||||
: ${TARGET:=i386}
|
|
||||||
|
|
||||||
# Save the source directory
|
|
||||||
export SRCDIR="${2:-${PWD}}"
|
|
||||||
|
|
||||||
# Make sure the compiler flags are clean
|
|
||||||
export HOST=
|
|
||||||
export CFLAGS=
|
|
||||||
export CXXFLAGS=
|
|
||||||
export LDFLAGS=
|
|
||||||
|
|
||||||
# Update PATH
|
|
||||||
export PATH="${FBEDIR}/bin:${PATH}"
|
|
||||||
|
|
||||||
# Display banner
|
|
||||||
version
|
|
||||||
|
|
||||||
# Invoke shell with fancy prompt
|
|
||||||
export PFMAT1="\[\033[0;1;97;44m\]"
|
|
||||||
export PFMAT2="\[\033[0;34;104m\]"
|
|
||||||
export PFMAT3="\[\033[0;1;97;104m\]"
|
|
||||||
export PFMAT4="\[\033[0;94;49m\]"
|
|
||||||
export PFMAT5="\[\033[1;38;5;74m\]"
|
|
||||||
export PROMPT="\n${PFMAT1} FerretOS BE ${PFMAT2}${PFMAT3} \w ${PFMAT4}${PFMAT5} "
|
|
||||||
bash --rcfile <(echo 'source ~/.bashrc && export PS1="${PROMPT}" && cd ${SRCDIR}')
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Sets the target architecture
|
|
||||||
charch()
|
|
||||||
{
|
|
||||||
if [ "x${1}" == "x" ]; then
|
|
||||||
echo "Syntax: charch [architecture]"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
case ${1} in
|
|
||||||
"i386"|"i486"|"i586"|"i686"|"x86")
|
|
||||||
export TARGET="i386"
|
|
||||||
;;
|
|
||||||
"amd64"|"x64"|"x86_64")
|
|
||||||
export TARGET="amd64"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
export TARGET="UNKNOWN"
|
|
||||||
esac
|
|
||||||
echo "Target Architecture: ${TARGET}"
|
|
||||||
}
|
|
||||||
export -f charch
|
|
||||||
|
|
||||||
# Displays version banner
|
|
||||||
version()
|
|
||||||
{
|
|
||||||
echo "###############################################################################"
|
|
||||||
echo "# FerretOS Build Environment v${FBEVER} for Linux #"
|
|
||||||
echo "# by Rafal Kupiec <belliash@codingworkshop.eu.org> #"
|
|
||||||
echo "###############################################################################"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo "Binutils Version: $(${FBEDIR}/bin/i686-w64-mingw32-ld -v | cut -d' ' -f5)"
|
|
||||||
echo "GCC Version: $(${FBEDIR}/bin/i686-w64-mingw32-gcc -v 2>&1| grep 'gcc version' | cut -d' ' -f3)"
|
|
||||||
echo "IDL Compiler Version: $(${FBEDIR}/bin/i686-w64-mingw32-widl -V | grep 'version' | cut -d' ' -f5)"
|
|
||||||
charch ${TARGET}
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
export -f version
|
|
||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: scripts/xtchain
|
||||||
|
# DESCRIPTION: XTchain Entry Script
|
||||||
|
# DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
|
||||||
|
|
||||||
|
# Get the absolute path to the XTchain
|
||||||
|
export XTCDIR="$(realpath $(dirname "${0}"))"
|
||||||
|
|
||||||
|
# Read the XTchain version
|
||||||
|
export XTCVER="$(cat "${XTCDIR}/Version")"
|
||||||
|
|
||||||
|
# Load the library
|
||||||
|
source "${XTCDIR}/lib/xtchain/xtclib"
|
||||||
|
|
||||||
|
# Set the target architecture
|
||||||
|
: ${TARGET:=${1}}
|
||||||
|
: ${TARGET:=amd64}
|
||||||
|
|
||||||
|
# Save the source directory
|
||||||
|
export SRCDIR="${2:-${PWD}}"
|
||||||
|
|
||||||
|
# Make sure the compiler flags are clean
|
||||||
|
export HOST=
|
||||||
|
export CFLAGS=
|
||||||
|
export CXXFLAGS=
|
||||||
|
export LDFLAGS=
|
||||||
|
|
||||||
|
# Update PATH
|
||||||
|
export PATH="${XTCDIR}/bin:${PATH}"
|
||||||
|
|
||||||
|
# Display banner
|
||||||
|
version
|
||||||
|
|
||||||
|
# Invoke shell with fancy prompt
|
||||||
|
export PFMAT1="\[\033[0;1;97;44m\]"
|
||||||
|
export PFMAT2="\[\033[0;34;104m\]"
|
||||||
|
export PFMAT3="\[\033[0;1;97;104m\]"
|
||||||
|
export PFMAT4="\[\033[0;94;49m\]"
|
||||||
|
export PFMAT5="\[\033[1;38;5;74m\]"
|
||||||
|
export PROMPT="\n${PFMAT1} XT Toolchain ${PFMAT2}${PFMAT3} \w ${PFMAT4}${PFMAT5} "
|
||||||
|
bash --rcfile <(echo 'export PS1="${PROMPT}" && cd "${SRCDIR}"')
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
@echo off
|
||||||
|
powershell.exe -ExecutionPolicy Bypass -NoExit -File "%~dp0xtchain.ps1"
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
#
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: scripts/xtchain.ps1
|
||||||
|
# DESCRIPTION: XTchain Entry Script
|
||||||
|
# DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
#
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[Parameter(Position = 0)]
|
||||||
|
[string]$TargetArchitecture = "amd64",
|
||||||
|
|
||||||
|
[Parameter(Position = 1)]
|
||||||
|
[string]$SourceDirectory = $PWD.Path
|
||||||
|
)
|
||||||
|
|
||||||
|
# Initialize XTchain environment
|
||||||
|
function Initialize-XTChain {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[string]$Architecture,
|
||||||
|
[string]$SourcePath
|
||||||
|
)
|
||||||
|
|
||||||
|
# Get the absolute path to XTchain
|
||||||
|
$script:XTCDIR = (Get-Item -Path ".\").FullName
|
||||||
|
|
||||||
|
# Read XTchain version
|
||||||
|
$versionFile = Join-Path $script:XTCDIR "Version"
|
||||||
|
if (Test-Path $versionFile) {
|
||||||
|
$env:XTCVER = Get-Content $versionFile -Raw | ForEach-Object { $_.Trim() }
|
||||||
|
} else {
|
||||||
|
Write-Warning "Version file not found at $versionFile"
|
||||||
|
$env:XTCVER = "Unknown"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set XTchain directory environment variable
|
||||||
|
$env:XTCDIR = $script:XTCDIR
|
||||||
|
|
||||||
|
# Import XTchain module
|
||||||
|
$modulePath = Join-Path $script:XTCDIR "lib\xtchain\xtclib.psm1"
|
||||||
|
if (Test-Path $modulePath) {
|
||||||
|
Import-Module $modulePath -Force -Global
|
||||||
|
} else {
|
||||||
|
Write-Error "XTchain module not found at $modulePath"
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set target architecture
|
||||||
|
$env:TARGET = $Architecture
|
||||||
|
|
||||||
|
# Validate source directory
|
||||||
|
if (-not (Test-Path $SourcePath)) {
|
||||||
|
Write-Error "Source directory does not exist: $SourcePath"
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
# Clean compiler environment variables
|
||||||
|
$env:HOST = $null
|
||||||
|
$env:CFLAGS = $null
|
||||||
|
$env:CXXFLAGS = $null
|
||||||
|
$env:LDFLAGS = $null
|
||||||
|
|
||||||
|
# Update PATH to include XTchain binaries
|
||||||
|
$xtcBinPath = Join-Path $script:XTCDIR "bin"
|
||||||
|
if (Test-Path $xtcBinPath) {
|
||||||
|
$env:PATH = "$xtcBinPath;" + $env:PATH
|
||||||
|
} else {
|
||||||
|
Write-Warning "XTchain bin directory not found at $xtcBinPath"
|
||||||
|
}
|
||||||
|
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create fancy PowerLine-style prompt
|
||||||
|
function Set-XTChainPrompt {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param()
|
||||||
|
|
||||||
|
function global:prompt {
|
||||||
|
try {
|
||||||
|
$promptText = " XT Toolchain "
|
||||||
|
$currentPath = (Get-Location).Path
|
||||||
|
$chevron = [char]0xE0B0
|
||||||
|
|
||||||
|
# Define prompt segments
|
||||||
|
$segments = @(
|
||||||
|
@{
|
||||||
|
Text = $promptText
|
||||||
|
BackgroundColor = "Blue"
|
||||||
|
ForegroundColor = "White"
|
||||||
|
},
|
||||||
|
@{
|
||||||
|
Text = " $currentPath "
|
||||||
|
BackgroundColor = "DarkCyan"
|
||||||
|
ForegroundColor = "White"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Render segments
|
||||||
|
for ($index = 0; $index -lt $segments.Count; $index++) {
|
||||||
|
$segment = $segments[$index]
|
||||||
|
$nextBackground = if ($index + 1 -lt $segments.Count) {
|
||||||
|
$segments[$index + 1].BackgroundColor
|
||||||
|
} else {
|
||||||
|
"Default"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Write segment text
|
||||||
|
Write-Host $segment.Text -NoNewLine -ForegroundColor $segment.ForegroundColor -BackgroundColor $segment.BackgroundColor
|
||||||
|
|
||||||
|
# Write separator
|
||||||
|
if ($nextBackground -ne "Default") {
|
||||||
|
Write-Host $chevron -NoNewLine -ForegroundColor $segment.BackgroundColor -BackgroundColor $nextBackground
|
||||||
|
} else {
|
||||||
|
Write-Host $chevron -NoNewLine -ForegroundColor $segment.BackgroundColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return " "
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
# Fallback to simple prompt if PowerLine fails
|
||||||
|
return "XTC> "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main execution
|
||||||
|
try {
|
||||||
|
Write-Host "Initializing XTchain environment..." -ForegroundColor Green
|
||||||
|
|
||||||
|
if (-not (Initialize-XTChain -Architecture $TargetArchitecture -SourcePath $SourceDirectory)) {
|
||||||
|
Write-Error "Failed to initialize XTchain environment"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Display version information
|
||||||
|
Show-XTCVersion
|
||||||
|
|
||||||
|
# Set up the fancy prompt
|
||||||
|
Set-XTChainPrompt
|
||||||
|
|
||||||
|
# Change to source directory
|
||||||
|
Set-Location -Path $SourceDirectory
|
||||||
|
|
||||||
|
Write-Host "XTchain environment ready!" -ForegroundColor Green
|
||||||
|
Write-Host "Current directory: $(Get-Location)" -ForegroundColor Cyan
|
||||||
|
Write-Host "Target architecture: $env:TARGET" -ForegroundColor Cyan
|
||||||
|
Write-Host "Type 'Show-XTCHelp' or 'help' for available commands" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error "Failed to initialize XTchain: $_"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
Executable
+131
@@ -0,0 +1,131 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# PROJECT: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: scripts/xtclib
|
||||||
|
# DESCRIPTION: XTchain library
|
||||||
|
# DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
# Aiken Harris <harraiken91@gmail.com>
|
||||||
|
|
||||||
|
|
||||||
|
# Prints XTChain banner
|
||||||
|
banner()
|
||||||
|
{
|
||||||
|
local XTC_BANNER="XT Toolchain v${XTCVER} for Linux"
|
||||||
|
|
||||||
|
printf "###############################################################################\n\n"
|
||||||
|
printf "\033[33m%*s\033[00m\n\n" $(( (${#XTC_BANNER} + 80) / 2)) "${XTC_BANNER}"
|
||||||
|
printf "###############################################################################\n\n"
|
||||||
|
}
|
||||||
|
export -f banner
|
||||||
|
|
||||||
|
# Sets the target architecture
|
||||||
|
charch()
|
||||||
|
{
|
||||||
|
if [ "x${1}" == "x" ]; then
|
||||||
|
echo "Syntax: charch [architecture]"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
case ${1} in
|
||||||
|
"aarch64"|"arm64")
|
||||||
|
export TARGET="aarch64"
|
||||||
|
;;
|
||||||
|
"arm"|"armv7")
|
||||||
|
export TARGET="armv7"
|
||||||
|
;;
|
||||||
|
"i386"|"i486"|"i586"|"i686"|"x86")
|
||||||
|
export TARGET="i686"
|
||||||
|
;;
|
||||||
|
"amd64"|"x64"|"x86_64")
|
||||||
|
export TARGET="amd64"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
export TARGET="UNKNOWN"
|
||||||
|
esac
|
||||||
|
echo "Target Architecture: ${TARGET}"
|
||||||
|
}
|
||||||
|
export -f charch
|
||||||
|
|
||||||
|
# Sets the build type
|
||||||
|
chbuild()
|
||||||
|
{
|
||||||
|
if [ "x${1}" == "x" ]; then
|
||||||
|
echo "Syntax: chbuild [DEBUG|RELEASE]"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
case ${1} in
|
||||||
|
[Rr][Ee][Ll][Ee][Aa][Ss][Ee])
|
||||||
|
export BUILD_TYPE="RELEASE"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
export BUILD_TYPE="DEBUG"
|
||||||
|
esac
|
||||||
|
echo "Target build type: ${BUILD_TYPE}"
|
||||||
|
}
|
||||||
|
export -f chbuild
|
||||||
|
|
||||||
|
# Prints help
|
||||||
|
help()
|
||||||
|
{
|
||||||
|
banner
|
||||||
|
echo "XTChain defines an internal list of commands:"
|
||||||
|
echo " * banner - prints XTChain banner"
|
||||||
|
echo " * charch [arch] - sets the target CPU architecture [aarch64/armv7/i686/amd64]"
|
||||||
|
echo " * chbuild [type] - sets build type [debug/release]"
|
||||||
|
echo " * help - prints this message"
|
||||||
|
echo " * version - prints XTChain and its components version"
|
||||||
|
echo " * xbuild - builds an application with a Ninja build system"
|
||||||
|
}
|
||||||
|
export -f help
|
||||||
|
|
||||||
|
# Displays version banner
|
||||||
|
version()
|
||||||
|
{
|
||||||
|
local XTCHAIN_EXTTOOLS=false
|
||||||
|
|
||||||
|
if [ ! -f "${XTCDIR}/bin/clang" ] || [ "$(which clang)" != "${XTCDIR}/bin/clang" ] || [ $(echo ${XTCVER} | grep "min") ]; then
|
||||||
|
XTCHAIN_EXTTOOLS=true
|
||||||
|
for TOOL in {clang,clang++,cmake,lld-link,ninja}; do
|
||||||
|
which ${TOOL} &> /dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: You are using minimal version of XTChain and '${TOOL}' has been not found in your system!"
|
||||||
|
echo "ERROR: Please install all required tools."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
banner
|
||||||
|
echo -en "\nLLVM/Clang Compiler: $(clang --version | grep 'clang version' | cut -d' ' -f3) ($(which clang))"
|
||||||
|
echo -en "\nLLVM/LLD Linker: $(lld-link --version | cut -d' ' -f2) ($(which lld-link))"
|
||||||
|
echo -en "\nWine IDL Compiler: $(widl -V | grep 'version' | cut -d' ' -f5) ($(which widl))"
|
||||||
|
echo -en "\nWine Message Compiler: $(wmc -V | grep 'version' | cut -d' ' -f5) ($(which wmc))"
|
||||||
|
echo -en "\nWine Resource Compiler: $(wrc --version | grep 'version' | cut -d' ' -f5) ($(which wrc))"
|
||||||
|
echo -en "\nXT SPEC Compiler: $(xtcspecc --help | grep Version | cut -d' ' -f5) ($(which xtcspecc))"
|
||||||
|
echo -en "\nCMake Build System: $(cmake --version | grep 'cmake version' | cut -d' ' -f3) ($(which cmake))"
|
||||||
|
echo -en "\nNinja Build System: $(ninja --version) ($(which ninja))"
|
||||||
|
echo -en "\n\n"
|
||||||
|
|
||||||
|
charch ${TARGET:-amd64}
|
||||||
|
chbuild ${BUILD_TYPE:-DEBUG}
|
||||||
|
|
||||||
|
echo -en "\n\nFor a list of all supported commands, type 'help'"
|
||||||
|
echo -en "\n-------------------------------------------------\n\n\n"
|
||||||
|
}
|
||||||
|
export -f version
|
||||||
|
|
||||||
|
# Builds application (wrapper to Ninja)
|
||||||
|
xbuild()
|
||||||
|
{
|
||||||
|
if [ ! -f build.arch ]; then
|
||||||
|
ninja "$@"
|
||||||
|
else
|
||||||
|
ARCH=$(cat build.arch)
|
||||||
|
if [ x"${ARCH}" != x"${TARGET}" ]; then
|
||||||
|
echo "Build is configured for '${ARCH}' while current target set to '${TARGET}'!"
|
||||||
|
echo "Cannot continue until conflict is resolved ..."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
ninja "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
export -f xbuild
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
#
|
||||||
|
# MODULE: XTchain
|
||||||
|
# LICENSE: See the COPYING.md in the top level directory
|
||||||
|
# FILE: xtclib.psm1
|
||||||
|
# DESCRIPTION: XTchain PowerShell module
|
||||||
|
# DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
#
|
||||||
|
|
||||||
|
# Module variables
|
||||||
|
$script:XTCVersion = $env:XTCVER
|
||||||
|
$script:XTCDirectory = $env:XTCDIR
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Prints XTChain banner
|
||||||
|
.DESCRIPTION
|
||||||
|
Displays the XTChain version banner with formatting
|
||||||
|
#>
|
||||||
|
function Show-XTCBanner {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param()
|
||||||
|
|
||||||
|
$XTC_BANNER = "XT Toolchain v$script:XTCVersion for Windows"
|
||||||
|
|
||||||
|
Write-Host "################################################################################"
|
||||||
|
Write-Host
|
||||||
|
Write-Host (' ' * [math]::Floor((80 - $XTC_BANNER.Length) / 2) + $XTC_BANNER) -ForegroundColor Yellow
|
||||||
|
Write-Host
|
||||||
|
Write-Host "################################################################################"
|
||||||
|
Write-Host
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the target architecture
|
||||||
|
.DESCRIPTION
|
||||||
|
Configures the TARGET environment variable based on the specified architecture
|
||||||
|
.PARAMETER Architecture
|
||||||
|
The target architecture (aarch64, arm64, arm, armv7, i386, i486, i586, i686, x86, amd64, x64, x86_64)
|
||||||
|
#>
|
||||||
|
function Set-XTCArchitecture {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Architecture
|
||||||
|
)
|
||||||
|
|
||||||
|
switch -Regex ($Architecture.ToLower()) {
|
||||||
|
"aarch64|arm64" {
|
||||||
|
$env:TARGET = "aarch64"
|
||||||
|
}
|
||||||
|
"arm|armv7" {
|
||||||
|
$env:TARGET = "armv7"
|
||||||
|
}
|
||||||
|
"i386|i486|i586|i686|x86" {
|
||||||
|
$env:TARGET = "i686"
|
||||||
|
}
|
||||||
|
"amd64|x64|x86_64" {
|
||||||
|
$env:TARGET = "amd64"
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
$env:TARGET = "UNKNOWN"
|
||||||
|
Write-Warning "Unknown architecture '$Architecture'. Set to UNKNOWN."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Host "Target Architecture: $($env:TARGET)"
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the build type
|
||||||
|
.DESCRIPTION
|
||||||
|
Configures the BUILD_TYPE environment variable
|
||||||
|
.PARAMETER BuildType
|
||||||
|
The build type (DEBUG or RELEASE)
|
||||||
|
#>
|
||||||
|
function Set-XTCBuildType {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[ValidateSet("DEBUG", "RELEASE")]
|
||||||
|
[string]$BuildType
|
||||||
|
)
|
||||||
|
|
||||||
|
$env:BUILD_TYPE = $BuildType.ToUpper()
|
||||||
|
Write-Host "Target build type: $($env:BUILD_TYPE)"
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Shows XTChain help information
|
||||||
|
.DESCRIPTION
|
||||||
|
Displays available XTChain commands and their usage
|
||||||
|
#>
|
||||||
|
function Show-XTCHelp {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param()
|
||||||
|
|
||||||
|
Show-XTCBanner
|
||||||
|
Write-Host "XTChain PowerShell Module Commands:"
|
||||||
|
Write-Host " * Show-XTCBanner - prints XTChain banner"
|
||||||
|
Write-Host " * Set-XTCArchitecture - sets the target CPU architecture"
|
||||||
|
Write-Host " * Set-XTCBuildType - sets build type [DEBUG/RELEASE]"
|
||||||
|
Write-Host " * Show-XTCHelp - prints this message"
|
||||||
|
Write-Host " * Show-XTCVersion - prints XTChain and its components version"
|
||||||
|
Write-Host " * Invoke-XTCBuild - builds an application with Ninja build system"
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Legacy command aliases:"
|
||||||
|
Write-Host " * banner, charch, chbuild, help, version, xbuild"
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Displays version information for XTChain components
|
||||||
|
.DESCRIPTION
|
||||||
|
Shows version information for all XTChain tools and components
|
||||||
|
#>
|
||||||
|
function Show-XTCVersion {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param()
|
||||||
|
|
||||||
|
# Check for minimal XTChain version with external tools
|
||||||
|
$XTCHAIN_EXTTOOLS = $false
|
||||||
|
if ((Test-Path "$script:XTCDirectory/bin/clang") -and
|
||||||
|
((Get-Command clang -ErrorAction SilentlyContinue).Source -eq "$script:XTCDirectory/bin/clang") -and
|
||||||
|
($script:XTCVersion -match "min")) {
|
||||||
|
|
||||||
|
$XTCHAIN_EXTTOOLS = $true
|
||||||
|
$requiredTools = @("clang", "clang++", "cmake", "lld-link", "ninja")
|
||||||
|
|
||||||
|
foreach ($tool in $requiredTools) {
|
||||||
|
if (!(Get-Command $tool -ErrorAction SilentlyContinue)) {
|
||||||
|
Write-Error "You are using minimal version of XTChain and '$tool' has been not found in your system!"
|
||||||
|
Write-Error "Please install all required tools."
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Show-XTCBanner
|
||||||
|
Write-Host
|
||||||
|
|
||||||
|
# Display tool versions
|
||||||
|
try {
|
||||||
|
$clangVersion = (clang --version | Select-String -Pattern "version (\d+\.\d+\.\d+)").Matches.Groups[1].Value
|
||||||
|
$clangPath = (Get-Command clang).Source
|
||||||
|
Write-Host "LLVM/Clang Compiler: $clangVersion ($clangPath)"
|
||||||
|
} catch { Write-Warning "Could not retrieve Clang version" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$lldVersion = (lld-link --version | Select-String -Pattern "(\d+\.\d+\.\d+)").Matches.Groups[1].Value
|
||||||
|
$lldPath = (Get-Command lld-link).Source
|
||||||
|
Write-Host "LLVM/LLD Linker: $lldVersion ($lldPath)"
|
||||||
|
} catch { Write-Warning "Could not retrieve LLD version" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$widlVersion = (widl -V | Select-String -Pattern "version (\d+\.\d+)").Matches.Groups[1].Value
|
||||||
|
$widlPath = (Get-Command widl).Source
|
||||||
|
Write-Host "Wine IDL Compiler: $widlVersion ($widlPath)"
|
||||||
|
} catch { Write-Warning "Could not retrieve WIDL version" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$wmcVersion = (wmc -V | Select-String -Pattern "version (\d+\.\d+)").Matches.Groups[1].Value
|
||||||
|
$wmcPath = (Get-Command wmc).Source
|
||||||
|
Write-Host "Wine Message Compiler: $wmcVersion ($wmcPath)"
|
||||||
|
} catch { Write-Warning "Could not retrieve WMC version" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$wrcVersion = (wrc --version | Select-String -Pattern "version (\d+\.\d+)").Matches.Groups[1].Value
|
||||||
|
$wrcPath = (Get-Command wrc).Source
|
||||||
|
Write-Host "Wine Resource Compiler: $wrcVersion ($wrcPath)"
|
||||||
|
} catch { Write-Warning "Could not retrieve WRC version" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$xtcspeccVersion = (xtcspecc --help | Select-String -Pattern "Version (\d+\.\d+)").Matches.Groups[1].Value
|
||||||
|
$xtcspeccPath = (Get-Command xtcspecc).Source
|
||||||
|
Write-Host "XT SPEC Compiler: $xtcspeccVersion ($xtcspeccPath)"
|
||||||
|
} catch { Write-Warning "Could not retrieve XTCSPECC version" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$cmakeVersion = (cmake --version | Select-String -Pattern "version (\d+\.\d+\.\d+)").Matches.Groups[1].Value
|
||||||
|
$cmakePath = (Get-Command cmake).Source
|
||||||
|
Write-Host "CMake Build System: $cmakeVersion ($cmakePath)"
|
||||||
|
} catch { Write-Warning "Could not retrieve CMake version" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$ninjaVersion = (ninja --version)
|
||||||
|
$ninjaPath = (Get-Command ninja).Source
|
||||||
|
Write-Host "Ninja Build System: $ninjaVersion ($ninjaPath)"
|
||||||
|
} catch { Write-Warning "Could not retrieve Ninja version" }
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
|
||||||
|
# Set default values and display current configuration
|
||||||
|
$BUILD_TYPE = if ([string]::IsNullOrEmpty($env:BUILD_TYPE)) { 'DEBUG' } else { $env:BUILD_TYPE }
|
||||||
|
$TARGET = if ([string]::IsNullOrEmpty($env:TARGET)) { 'amd64' } else { $env:TARGET }
|
||||||
|
|
||||||
|
Set-XTCArchitecture -Architecture $TARGET
|
||||||
|
Set-XTCBuildType -BuildType $BUILD_TYPE
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
Write-Host
|
||||||
|
Write-Host "For a list of all supported commands, type 'Show-XTCHelp' or 'help'"
|
||||||
|
Write-Host "--------------------------------------------------------"
|
||||||
|
Write-Host
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Builds application using Ninja build system
|
||||||
|
.DESCRIPTION
|
||||||
|
Wrapper around ninja command with architecture validation
|
||||||
|
.PARAMETER Arguments
|
||||||
|
Arguments to pass to ninja
|
||||||
|
#>
|
||||||
|
function Invoke-XTCBuild {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
|
[string[]]$Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
if (Test-Path "build.arch") {
|
||||||
|
$buildArch = Get-Content "build.arch" -Raw
|
||||||
|
$buildArch = $buildArch.Trim()
|
||||||
|
|
||||||
|
if ($buildArch -ne $env:TARGET) {
|
||||||
|
Write-Host "Build is configured for '$buildArch' while current target set to '$($env:TARGET)'!" -ForegroundColor Red
|
||||||
|
Write-Host "Cannot continue until conflict is resolved..." -ForegroundColor Red
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& ninja @Arguments
|
||||||
|
return $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Legacy function aliases for backwards compatibility
|
||||||
|
Set-Alias -Name banner -Value Show-XTCBanner
|
||||||
|
Set-Alias -Name charch -Value Set-XTCArchitecture
|
||||||
|
Set-Alias -Name chbuild -Value Set-XTCBuildType
|
||||||
|
Set-Alias -Name help -Value Show-XTCHelp
|
||||||
|
Set-Alias -Name version -Value Show-XTCVersion
|
||||||
|
Set-Alias -Name xbuild -Value Invoke-XTCBuild
|
||||||
|
|
||||||
|
# Export functions and aliases
|
||||||
|
Export-ModuleMember -Function Show-XTCBanner, Set-XTCArchitecture, Set-XTCBuildType, Show-XTCHelp, Show-XTCVersion, Invoke-XTCBuild
|
||||||
|
Export-ModuleMember -Alias banner, charch, chbuild, help, version, xbuild
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: XTchain
|
||||||
|
* LICENSE: See COPYING.md in the top level directory
|
||||||
|
* FILE: tools/bin2c.c
|
||||||
|
* DESCRIPTION: Binary to C converter
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xtchain.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
/* Check for proper number of arguments */
|
||||||
|
if(argc != 4)
|
||||||
|
{
|
||||||
|
printf("Usage: %s <input binary> <output file> <structure name>\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open the input binary file in binary mode */
|
||||||
|
FILE *inputFile = fopen(argv[1], "rb");
|
||||||
|
if(inputFile == NULL)
|
||||||
|
{
|
||||||
|
printf("Error: unable to open file %s\n", argv[1]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open the destination source code file in text mode */
|
||||||
|
FILE *outputFile = fopen(argv[2], "w");
|
||||||
|
if(outputFile == NULL)
|
||||||
|
{
|
||||||
|
printf("Error: unable to open file %s\n", argv[2]);
|
||||||
|
fclose(inputFile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the size of the binary file */
|
||||||
|
fseek(inputFile, 0, SEEK_END);
|
||||||
|
long binSize = ftell(inputFile);
|
||||||
|
rewind(inputFile);
|
||||||
|
|
||||||
|
/* Allocate memory for the binary data */
|
||||||
|
unsigned char *binData = (unsigned char *)malloc(binSize);
|
||||||
|
if(binData == NULL)
|
||||||
|
{
|
||||||
|
printf("Error: unable to allocate memory for binary data\n");
|
||||||
|
fclose(inputFile);
|
||||||
|
fclose(outputFile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the binary data into memory */
|
||||||
|
fread(binData, sizeof(unsigned char), binSize, inputFile);
|
||||||
|
|
||||||
|
/* Write the C structure to the header file */
|
||||||
|
fprintf(outputFile, "unsigned char %s[] = {", argv[3]);
|
||||||
|
for(int i = 0; i < binSize; i++)
|
||||||
|
{
|
||||||
|
fprintf(outputFile, "0x%02X", binData[i]);
|
||||||
|
if(i < binSize - 1)
|
||||||
|
{
|
||||||
|
fprintf(outputFile, ",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(outputFile, "};\nunsigned int %s_size = %ld;\n", argv[3], binSize);
|
||||||
|
free(binData);
|
||||||
|
|
||||||
|
/* Close all open files */
|
||||||
|
fclose(inputFile);
|
||||||
|
fclose(outputFile);
|
||||||
|
|
||||||
|
printf("Binary data converted to C structure successfully.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+182
@@ -0,0 +1,182 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: XTchain
|
||||||
|
* LICENSE: See COPYING.md in the top level directory
|
||||||
|
* FILE: tools/exetool.c
|
||||||
|
* DESCRIPTION: Portable Executable (PE) utility for changing its signature and subsystem
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xtchain.h"
|
||||||
|
|
||||||
|
typedef struct _PE_SUBSYSTEM
|
||||||
|
{
|
||||||
|
int Identifier;
|
||||||
|
char *Name;
|
||||||
|
} PE_SUBSYSTEM, *PPE_SUBSYSTEM;
|
||||||
|
|
||||||
|
static PE_SUBSYSTEM SubSystems[] = {
|
||||||
|
{0x00, "INVALID_SUBSYSTEM"},
|
||||||
|
{0x01, "NT_NATIVE"},
|
||||||
|
{0x02, "WINDOWS_GUI"},
|
||||||
|
{0x03, "WINDOWS_CLI"},
|
||||||
|
{0x04, "WINDOWS_CE_OLD"},
|
||||||
|
{0x05, "OS2_CUI"},
|
||||||
|
{0x07, "POSIX_CUI"},
|
||||||
|
{0x08, "NATIVE_WINDOWS"},
|
||||||
|
{0x09, "WINDOWS_CE_GUI"},
|
||||||
|
{0x0A, "EFI_APPLICATION"},
|
||||||
|
{0x0B, "EFI_BOOT_SERVICE_DRIVER"},
|
||||||
|
{0x0C, "EFI_RUNTIME_DRIVER"},
|
||||||
|
{0x0D, "EFI_ROM"},
|
||||||
|
{0x0E, "XBOX"},
|
||||||
|
{0x10, "WINDOWS_BOOT_APPLICATION"},
|
||||||
|
{0x14, "XT_NATIVE_KERNEL"},
|
||||||
|
{0x15, "XT_NATIVE_APPLICATION"},
|
||||||
|
{0x16, "XT_NATIVE_DRIVER"},
|
||||||
|
{0x17, "XT_DYNAMIC_LIBRARY"},
|
||||||
|
{0x18, "XT_APPLICATION_CLI"},
|
||||||
|
{0x19, "XT_APPLICATION_GDI"}
|
||||||
|
};
|
||||||
|
|
||||||
|
PPE_SUBSYSTEM getSubSystem(char *Name)
|
||||||
|
{
|
||||||
|
int Index;
|
||||||
|
int SubSystemsCount;
|
||||||
|
PPE_SUBSYSTEM SubSystem;
|
||||||
|
|
||||||
|
/* Count number of subsystems avaialble */
|
||||||
|
SubSystemsCount = sizeof(SubSystems) / sizeof(PE_SUBSYSTEM);
|
||||||
|
|
||||||
|
/* Find subsystem */
|
||||||
|
for(Index = 0; Index < SubSystemsCount; Index++)
|
||||||
|
{
|
||||||
|
SubSystem = &SubSystems[Index];
|
||||||
|
if(strcasecmp(SubSystem->Name, Name) == 0)
|
||||||
|
{
|
||||||
|
/* Subsystem found, return its ID */
|
||||||
|
return SubSystem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No valid subsystem found */
|
||||||
|
return &SubSystems[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
char *getSubSystemName(int Identifier)
|
||||||
|
{
|
||||||
|
int Index;
|
||||||
|
int SubSystemsCount;
|
||||||
|
PPE_SUBSYSTEM SubSystem;
|
||||||
|
|
||||||
|
/* Count number of subsystems avaialble */
|
||||||
|
SubSystemsCount = sizeof(SubSystems) / sizeof(PE_SUBSYSTEM);
|
||||||
|
|
||||||
|
/* Find subsystem */
|
||||||
|
for(Index = 0; Index < SubSystemsCount; Index++)
|
||||||
|
{
|
||||||
|
SubSystem = &SubSystems[Index];
|
||||||
|
if(SubSystem->Identifier == Identifier)
|
||||||
|
{
|
||||||
|
/* Subsystem found, return its ID */
|
||||||
|
return SubSystem->Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No valid subsystem found */
|
||||||
|
return SubSystems[0].Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
FILE *ExeFile;
|
||||||
|
unsigned char Signature[4];
|
||||||
|
unsigned int HeaderOffset;
|
||||||
|
unsigned int ImageSignature;
|
||||||
|
unsigned short SubSystem;
|
||||||
|
PPE_SUBSYSTEM NewSubSystem;
|
||||||
|
|
||||||
|
/* Check for proper number of arguments */
|
||||||
|
if(argc != 3)
|
||||||
|
{
|
||||||
|
printf("Usage: %s <filename> <new SubSystem>\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parse the new SubSystem value from the command line argument */
|
||||||
|
NewSubSystem = getSubSystem(argv[2]);
|
||||||
|
if(NewSubSystem->Identifier == 0)
|
||||||
|
{
|
||||||
|
/* Invalid SubSystem provided */
|
||||||
|
printf("Error: %s is not a valid PE SubSystem\n", argv[2]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open the EXE file in binary mode */
|
||||||
|
ExeFile = fopen(argv[1], "r+b");
|
||||||
|
if(ExeFile == NULL)
|
||||||
|
{
|
||||||
|
/* Failed to open PE file */
|
||||||
|
printf("ERROR: Unable to open file %s\n", argv[1]);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Verify that the input file has a valid DOS header */
|
||||||
|
fread(Signature, sizeof(unsigned char), 4, ExeFile);
|
||||||
|
if(Signature[0] != 'M' || Signature[1] != 'Z')
|
||||||
|
{
|
||||||
|
/* Invalid DOS header */
|
||||||
|
printf("ERROR: %s is not a valid EXE file\n", argv[1]);
|
||||||
|
fclose(ExeFile);
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Verify that the input file has a valid PE header */
|
||||||
|
fseek(ExeFile, 0x3C, SEEK_SET);
|
||||||
|
fread(&HeaderOffset, sizeof(unsigned int), 1, ExeFile);
|
||||||
|
fseek(ExeFile, HeaderOffset, SEEK_SET);
|
||||||
|
fread(Signature, sizeof(unsigned char), 4, ExeFile);
|
||||||
|
if((Signature[0] != 'P' || Signature[1] != 'E' || Signature[2] != 0 || Signature[3] != 0) &&
|
||||||
|
(Signature[0] != 'P' || Signature[1] != 'E' || Signature[2] != 'X' || Signature[3] != 'T'))
|
||||||
|
{
|
||||||
|
/* Invalid PE header */
|
||||||
|
printf("Error: %s is not a valid PE file\n", argv[1]);
|
||||||
|
fclose(ExeFile);
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if setting XT subsystem */
|
||||||
|
if(NewSubSystem->Identifier >= 0x14 && NewSubSystem->Identifier <= 0x19)
|
||||||
|
{
|
||||||
|
/* Write PEXT signature */
|
||||||
|
ImageSignature = 0x54584550;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Write PE00 signature */
|
||||||
|
ImageSignature = 0x00004550;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Seek back to header offset and write new signature */
|
||||||
|
fseek(ExeFile, HeaderOffset, SEEK_SET);
|
||||||
|
fwrite(&ImageSignature, sizeof(ImageSignature), 1, ExeFile);
|
||||||
|
|
||||||
|
/* Seek to the offset of the SubSystem field in the optional header */
|
||||||
|
fseek(ExeFile, HeaderOffset + 0x5C, SEEK_SET);
|
||||||
|
|
||||||
|
/* Read the current SubSystem value */
|
||||||
|
fread(&SubSystem, sizeof(unsigned short), 1, ExeFile);
|
||||||
|
|
||||||
|
/* Seek back to the SubSystem field in the optional header */
|
||||||
|
fseek(ExeFile, -sizeof(unsigned short), SEEK_CUR);
|
||||||
|
|
||||||
|
/* Write the new SubSystem value */
|
||||||
|
fwrite(&NewSubSystem->Identifier, sizeof(unsigned short), 1, ExeFile);
|
||||||
|
|
||||||
|
/* Close the file */
|
||||||
|
fclose(ExeFile);
|
||||||
|
|
||||||
|
/* Finished successfully */
|
||||||
|
printf("PE SubSystem modified: 0x%02X <%s> to 0x%02X <%s>\n",
|
||||||
|
SubSystem, getSubSystemName(SubSystem), NewSubSystem->Identifier, NewSubSystem->Name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: XTchain
|
||||||
|
* LICENSE: See COPYING.md in the top level directory
|
||||||
|
* FILE: tools/xtchain.h
|
||||||
|
* DESCRIPTION: Common header for XTchain tools
|
||||||
|
* DEVELOPERS: Martin Storsjo <martin@martin.st>
|
||||||
|
* Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define _T(x) x
|
||||||
|
|
||||||
|
static
|
||||||
|
inline
|
||||||
|
char *
|
||||||
|
_tcsrchrs(const char *str,
|
||||||
|
char char1,
|
||||||
|
char char2)
|
||||||
|
{
|
||||||
|
char *ptr1 = strrchr(str, char1);
|
||||||
|
char *ptr2 = strrchr(str, char2);
|
||||||
|
|
||||||
|
if(!ptr1)
|
||||||
|
{
|
||||||
|
return ptr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ptr2)
|
||||||
|
{
|
||||||
|
return ptr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ptr1 < ptr2)
|
||||||
|
{
|
||||||
|
return ptr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ptr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
inline
|
||||||
|
void
|
||||||
|
split_argv(const char *argv0,
|
||||||
|
char **dir_ptr,
|
||||||
|
char **basename_ptr,
|
||||||
|
char **target_ptr,
|
||||||
|
char **exe_ptr)
|
||||||
|
{
|
||||||
|
const char *sep = _tcsrchrs(argv0, '/', '\\');
|
||||||
|
char *dir = strdup(_T(""));
|
||||||
|
const char *basename = argv0;
|
||||||
|
|
||||||
|
if(sep)
|
||||||
|
{
|
||||||
|
dir = strdup(argv0);
|
||||||
|
dir[sep + 1 - argv0] = '\0';
|
||||||
|
basename = sep + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
basename = strdup(basename);
|
||||||
|
char *period = strchr(basename, '.');
|
||||||
|
|
||||||
|
if(period)
|
||||||
|
{
|
||||||
|
*period = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
char *target = strdup(basename);
|
||||||
|
char *dash = strrchr(target, '-');
|
||||||
|
const char *exe = basename;
|
||||||
|
|
||||||
|
if(dash)
|
||||||
|
{
|
||||||
|
*dash = '\0';
|
||||||
|
exe = dash + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dir_ptr)
|
||||||
|
{
|
||||||
|
*dir_ptr = dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(basename_ptr)
|
||||||
|
{
|
||||||
|
*basename_ptr = basename;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(target_ptr)
|
||||||
|
{
|
||||||
|
*target_ptr = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(exe_ptr)
|
||||||
|
{
|
||||||
|
*exe_ptr = exe;
|
||||||
|
}
|
||||||
|
}
|
||||||
+1429
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user