meta-mingw: support generating Windows SDK with no symlink
PATCH v2 1/1 meta-mingw: support generating Windows SDK with no symlink
From: Chen Qi <[email protected]>
On some Windows systems, symlinks are not allowed due to IT policy. We need to be able to generate Windows SDK without symlinks.
To do this, a new variable, WINSDK_NO_SYMLINK, and a new bbclass, mingw_sdk_handle_symlink.bbclass, are introduced to achieve this.
By default, things work as before; when setting WINSDK_NO_SYMLINK to "1", SDK will replace all symlinks with the actual contents.
--- classes/mingw_sdk_handle_symlink.bbclass | 25 +++++++++++++++++++++ conf/machine-sdk/include/mingw32-common.inc | 3 +++ 2 files changed, 28 insertions(+) create mode 100644 classes/mingw_sdk_handle_symlink.bbclass
classes/mingw_sdk_handle_symlink.bbclass new file +25 -0
@@ -0,0 +1,25 @@ +WINSDK_NO_SYMLINK ?= "0" + +archive_sdk:prepend:sdkmingw32 () { + if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then + for parse_type in "file" "directory"; do + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0 | while IFS= read -r -d '' symlink; do + target=$(readlink -f "$symlink" || echo "NOTVALID") + if [ "$target" = "NOTVALID" ]; then + continue + fi + if [ ! -e "$target" ]; then + continue + elif [ -d "$target" ]; then + if [ "$parse_type" = "directory" ]; then + rm "$symlink" && cp -r "$target" "$symlink" + fi + else + if [ "$parse_type" = "file" ]; then + rm "$symlink" && cp "$target" "$symlink" + fi + fi + done + done + fi +}
conf/machine-sdk/include/mingw32-common.inc +3 -0
@@ -59,3 +59,6 @@ GCCPIE:mingw32 = "" # wine and wineserver are required to test MinGW SDKs HOSTTOOLS_NONFATAL += "wine wineserver" + +# handle symlinks +INHERIT += "mingw_sdk_handle_symlink"
Signature · 1 line
2.34.1
ping
Quoted 60 lines · On 11/3/25 10:18, [email protected] wrote:
From: Chen Qi <[email protected]>
On some Windows systems, symlinks are not allowed due to IT policy. We need to be able to generate Windows SDK without symlinks.
To do this, a new variable,
WINSDK_NO_SYMLINK, and a new bbclass, mingw_sdk_handle_symlink.bbclass, are introduced to achieve this.By default, things work as before; when setting
WINSDK_NO_SYMLINKto "1", SDK will replace all symlinks with the actual contents.Signed-off-by Chen Qi <[email protected]>--- classes/mingw_sdk_handle_symlink.bbclass | 25 +++++++++++++++++++++ conf/machine-sdk/include/mingw32-common.inc | 3 +++ 2 files changed, 28 insertions(+)create mode 100644 classes/mingw_sdk_handle_symlink.bbclass
classes/mingw_sdk_handle_symlink.bbclass new file +25
-0@@ -0,0 +1,25 @@ +WINSDK_NO_SYMLINK ?= "0" + +archive_sdk:prepend:sdkmingw32 () { + if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then + for parse_type in "file" "directory"; do + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0 | while IFS= read -r -d '' symlink; do + target=$(readlink -f "$symlink" || echo "NOTVALID") + if [ "$target" = "NOTVALID" ]; then + continue + fi + if [ ! -e "$target" ]; then + continue + elif [ -d "$target" ]; then + if [ "$parse_type" = "directory" ]; then + rm "$symlink" && cp -r "$target" "$symlink" + fi + else + if [ "$parse_type" = "file" ]; then + rm "$symlink" && cp "$target" "$symlink" + fi + fi + done + done + fi +}conf/machine-sdk/include/mingw32-common.inc +3
-0@@ -59,3 +59,6 @@ GCCPIE:mingw32 = "" # wine and wineserver are required to test MinGW SDKs HOSTTOOLS_NONFATAL += "wine wineserver" + +# handle symlinks +INHERIT += "mingw_sdk_handle_symlink"
Quoted 55 lines · On Sun, Nov 2, 2025 at 7:19 PM <[email protected]> wrote:
From: Chen Qi <[email protected]>
On some Windows systems, symlinks are not allowed due to IT policy. We need to be able to generate Windows SDK without symlinks.
To do this, a new variable,
WINSDK_NO_SYMLINK, and a new bbclass, mingw_sdk_handle_symlink.bbclass, are introduced to achieve this.By default, things work as before; when setting
WINSDK_NO_SYMLINKto "1", SDK will replace all symlinks with the actual contents.Signed-off-by Chen Qi <[email protected]>--- classes/mingw_sdk_handle_symlink.bbclass | 25 +++++++++++++++++++++ conf/machine-sdk/include/mingw32-common.inc | 3 +++ 2 files changed, 28 insertions(+) create mode 100644 classes/mingw_sdk_handle_symlink.bbclassclasses/mingw_sdk_handle_symlink.bbclass new file +25
-0@@ -0,0 +1,25 @@ +WINSDK_NO_SYMLINK ?= "0" + +archive_sdk:prepend:sdkmingw32 () { + if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then + for parse_type in "file" "directory"; do + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0 | while IFS= read -r -d '' symlink; do + target=$(readlink -f "$symlink" || echo "NOTVALID") + if [ "$target" = "NOTVALID" ]; then + continue + fi + if [ ! -e "$target" ]; then + continue + elif [ -d "$target" ]; then + if [ "$parse_type" = "directory" ]; then + rm "$symlink" && cp -r "$target" "$symlink" + fi + else + if [ "$parse_type" = "file" ]; then + rm "$symlink" && cp "$target" "$symlink" + fi + fi + done + done + fi +}conf/machine-sdk/include/mingw32-common.inc +0
-0
conf/machine-sdk/include/mingw32-common.inc GCCPIE:mingw32 = "" · line 64
Quoted 6 lines
conf/machine-sdk/include/mingw32-common.inc +3
-0@@ -59,3 +59,6 @@ GCCPIE:mingw32 = "" # wine and wineserver are required to test MinGW SDKs HOSTTOOLS_NONFATAL += "wine wineserver" + +# handle symlinks +INHERIT += "mingw_sdk_handle_symlink"
Does this need to be unconditional? I'd prefer something like INHERIT:mingw32 instead if that works
Quoted 3 lines
--
2.34.1
Quoted 56 lines · Joshua Watt
Quoted 55 lines · On Sun, Nov 2, 2025 at 7:19 PM <[email protected]> wrote:
From: Chen Qi <[email protected]>
On some Windows systems, symlinks are not allowed due to IT policy. We need to be able to generate Windows SDK without symlinks.
To do this, a new variable,
WINSDK_NO_SYMLINK, and a new bbclass, mingw_sdk_handle_symlink.bbclass, are introduced to achieve this.By default, things work as before; when setting
WINSDK_NO_SYMLINKto "1", SDK will replace all symlinks with the actual contents.Signed-off-by Chen Qi <[email protected]>--- classes/mingw_sdk_handle_symlink.bbclass | 25 +++++++++++++++++++++ conf/machine-sdk/include/mingw32-common.inc | 3 +++ 2 files changed, 28 insertions(+)create mode 100644 classes/mingw_sdk_handle_symlink.bbclass
classes/mingw_sdk_handle_symlink.bbclass new file +25
-0@@ -0,0 +1,25 @@ +WINSDK_NO_SYMLINK ?= "0" + +archive_sdk:prepend:sdkmingw32 () { + if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then + for parse_type in "file" "directory"; do + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0 | while IFS= read -r -d '' symlink; do + target=$(readlink -f "$symlink" || echo "NOTVALID") + if [ "$target" = "NOTVALID" ]; then + continue + fi + if [ ! -e "$target" ]; then + continue + elif [ -d "$target" ]; then + if [ "$parse_type" = "directory" ]; then + rm "$symlink" && cp -r "$target" "$symlink" + fi + else + if [ "$parse_type" = "file" ]; then + rm "$symlink" && cp "$target" "$symlink" + fi + fi + done + done + fi +}conf/machine-sdk/include/mingw32-common.inc +0
-0@@ -59,3 +59,6 @@ GCCPIE:mingw32 = ""
Quoted 7 lines
conf/machine-sdk/include/mingw32-common.inc GCCPIE:mingw32 = "" · line 64
Quoted 5 lines
conf/machine-sdk/include/mingw32-common.inc +3
-0# wine and wineserver are required to test MinGW SDKs HOSTTOOLS_NONFATAL += "wine wineserver" + +# handle symlinks +INHERIT += "mingw_sdk_handle_symlink"Does this need to be unconditional? I'd prefer something like INHERIT:mingw32 instead if that works
Hi Joshua,
I just tried it out. Using INHERIT:append:sdkmingw32 works. We have to use :append instead of "+=" to avoid overriding settings.
I'll send out V3.
Regards,
Qi
Quoted 4 lines
Quoted 4 lines
--
2.34.1
Would it make more sense to leave out the INHERIT and WINSDK_NO_SYMLINK. Instead, if you need this, you can inherit the class in your recipe or local.conf
-samuli
Quoted 103 lines · Chen Qi via lists.yoctoproject.org
Quoted 12 lines · Joshua Watt
Quoted 11 lines · On Sun, Nov 2, 2025 at 7:19 PM <[email protected]> wrote:
From: Chen Qi <[email protected]>
On some Windows systems, symlinks are not allowed due to IT policy. We need to be able to generate Windows SDK without symlinks.
To do this, a new variable,
WINSDK_NO_SYMLINK, and a new bbclass, mingw_sdk_handle_symlink.bbclass, are introduced to achieve this.By default, things work as before; when setting
WINSDK_NO_SYMLINKto "1", SDK will replace all symlinks with the actual contents.Quoted 8 lines
Review
Quoted 8 lines
Signed-off-by Chen Qi <[email protected]>--- classes/mingw_sdk_handle_symlink.bbclass | 25 +++++++++++++++++++++ conf/machine-sdk/include/mingw32-common.inc | 3 +++ 2 files changed, 28 insertions(+)create mode 100644 classes/mingw_sdk_handle_symlink.bbclass
(quoted diff) +0
-0b/classes/mingw_sdk_handle_symlink.bbclass
Quoted 11 lines
classes/mingw_sdk_handle_symlink.bbclass line 6
Quoted 11 lines
new file mode 100644
index 0000000..2f6dbe6classes/mingw_sdk_handle_symlink.bbclass new file +6
-0@@ -0,0 +1,25 @@ +WINSDK_NO_SYMLINK ?= "0" + +archive_sdk:prepend:sdkmingw32 () { + if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then + for parse_type in "file" "directory"; do + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0| while IFS= read -r -d '' symlink; do
Quoted 1 line
classes/mingw_sdk_handle_symlink.bbclass line 7
Quoted 1 line
classes/mingw_sdk_handle_symlink.bbclass new file +1
-0+ target=$(readlink -f "$symlink" || echo"NOTVALID")
Quoted 7 lines
classes/mingw_sdk_handle_symlink.bbclass
Quoted 7 lines
classes/mingw_sdk_handle_symlink.bbclass new file +7
-0+ if [ "$target" = "NOTVALID" ]; then + continue + fi + if [ ! -e "$target" ]; then + continue + elif [ -d "$target" ]; then + if [ "$parse_type" ="directory" ]; then
Quoted 1 line
classes/mingw_sdk_handle_symlink.bbclass line 15
Quoted 1 line
classes/mingw_sdk_handle_symlink.bbclass new file +1
-0+ rm "$symlink" && cp -r"$target" "$symlink"
Quoted 3 lines
classes/mingw_sdk_handle_symlink.bbclass
Quoted 3 lines
classes/mingw_sdk_handle_symlink.bbclass new file +3
-0+ fi + else + if [ "$parse_type" = "file" ];then
Quoted 1 line
classes/mingw_sdk_handle_symlink.bbclass line 19
Quoted 1 line
classes/mingw_sdk_handle_symlink.bbclass new file +1
-0+ rm "$symlink" && cp"$target" "$symlink"
Quoted 7 lines
Review
Quoted 7 lines
classes/mingw_sdk_handle_symlink.bbclass new file +6
-0+ fi + fi + done + done + fi +}(quoted diff) +0
-0b/conf/machine-sdk/include/mingw32-common.inc
Quoted 5 lines
Quoted 5 lines
index 56b8052..bf3f14e 100644
conf/machine-sdk/include/mingw32-common.inc +0
-0@@ -59,3 +59,6 @@ GCCPIE:mingw32 = ""Quoted 7 lines
conf/machine-sdk/include/mingw32-common.inc GCCPIE:mingw32 = "" · line 64
Quoted 5 lines
conf/machine-sdk/include/mingw32-common.inc +3
-0# wine and wineserver are required to test MinGW SDKs HOSTTOOLS_NONFATAL += "wine wineserver" + +# handle symlinks +INHERIT += "mingw_sdk_handle_symlink"Does this need to be unconditional? I'd prefer something like INHERIT:mingw32 instead if that works
Hi Joshua,
I just tried it out. Using INHERIT:append:sdkmingw32 works. We have to use :append instead of "+=" to avoid overriding settings.
I'll send out V3.
Regards,
QiQuoted 4 lines
Quoted 4 lines
--
2.34.1-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#2488):
https://lists.yoctoproject.org/g/yocto-patches/message/2488
Mute This Topic: https://lists.yoctoproject.org/mt/116091557/3617605
Group Owner: [email protected] Unsubscribe:
https://lists.yoctoproject.org/g/yocto-patches/leave/14256716/3617605/551361261/xyzzy
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 4 lines · Samuli Piippo via lists.yoctoproject.org
Would it make more sense to leave out the INHERIT and WINSDK_NO_SYMLINK. Instead, if you need this, you can inherit the class in your recipe or local.conf
-samuli
From my experience, users will usually prefer a variable setting when it's possible.
Take this case as an example, they could put this setting in their <distro>.conf, site.conf or local.conf, then no matter meta-mingw is included or not, 'bitbake <something>' still works.
Regards,
Qi
Quoted 107 lines · On Wed, 12 Nov 2025 at 07:35, Chen Qi via lists.yoctoproject.org…
On 11/11/25 23:25, Joshua Watt wrote:
> On Sun, Nov 2, 2025 at 7:19 PM <[email protected]> wrote:
>> From: Chen Qi <[email protected]>
>>
>> On some Windows systems, symlinks are not allowed due to IT policy. >> We need to be able to generate Windows SDK without symlinks. >>
>> To do this, a new variable,WINSDK_NO_SYMLINK, and a new bbclass, >> mingw_sdk_handle_symlink.bbclass, are introduced to achieve this. >>
>> By default, things work as before; when settingWINSDK_NO_SYMLINK>> to "1", SDK will replace all symlinks with the actual contents. >>
>> Signed-off-by: Chen Qi <[email protected]>
>> ---
>> classes/mingw_sdk_handle_symlink.bbclass | 25
+++++++++++++++++++++
>> conf/machine-sdk/include/mingw32-common.inc | 3 +++ >> 2 files changed, 28 insertions(+)
>> create mode 100644 classes/mingw_sdk_handle_symlink.bbclass >>
>> diff --git a/classes/mingw_sdk_handle_symlink.bbclass b/classes/mingw_sdk_handle_symlink.bbclass
>> new file mode 100644
>> index 0000000..2f6dbe6
>> ---/dev/null
>> +++ b/classes/mingw_sdk_handle_symlink.bbclass
>> @@ -0,0 +1,25 @@
>> +WINSDK_NO_SYMLINK ?= "0"
>> +
>> +archive_sdk:prepend:sdkmingw32 () {
>> + if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then
>> + forparse_typein "file" "directory"; do >> + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0 | while IFS= read -r -d '' symlink; do
>> + target=$(readlink -f "$symlink" || echo "NOTVALID")
>> + if [ "$target" = "NOTVALID" ]; then >> + continue
>> + fi
>> + if [ ! -e "$target" ]; then >> + continue
>> + elif [ -d "$target" ]; then >> + if [ "$parse_type" = "directory" ]; then
>> + rm "$symlink" && cp -r "$target" "$symlink"
>> + fi
>> + else
>> + if [ "$parse_type" = "file" ]; then
>> + rm "$symlink" && cp "$target" "$symlink"
>> + fi
>> + fi
>> + done
>> + done
>> + fi
>> +}
>> diff --git a/conf/machine-sdk/include/mingw32-common.inc b/conf/machine-sdk/include/mingw32-common.inc
>> index 56b8052..bf3f14e 100644
>> --- a/conf/machine-sdk/include/mingw32-common.inc
>> +++ b/conf/machine-sdk/include/mingw32-common.inc
>> @@ -59,3 +59,6 @@ GCCPIE:mingw32 = ""
>>
>> # wine and wineserver are required to test MinGW SDKs >> HOSTTOOLS_NONFATAL += "wine wineserver"
>> +
>> +# handle symlinks
>> +INHERIT += "mingw_sdk_handle_symlink"
> Does this need to be unconditional? I'd prefer something like > INHERIT:mingw32 instead if that worksHi Joshua,
I just tried it out. Using INHERIT:append:sdkmingw32 works. We have to use :append instead of "+=" to avoid overriding settings.
I'll send out V3.
Regards,
Qi>
>> --
>> 2.34.1
>>_._,_._,_
------------------------------------------------------------------------
Links:You receive all messages sent to this group.
View/Reply Online (#2490) <https://lists.yoctoproject.org/g/yocto-patches/message/2490> | Reply to Group <mailto:[email protected]?subject=Re:%20Re%3A%20%5Byocto-patches%5D%20%5Bmeta-mingw%5D%5BPATCH%20V2%5D%20meta-mingw%3A%20support%20generating%20Windows%20SDK%20with%20no%20symlink> | Reply to Sender <mailto:[email protected]?subject=Private:%20Re:%20Re%3A%20%5Byocto-patches%5D%20%5Bmeta-mingw%5D%5BPATCH%20V2%5D%20meta-mingw%3A%20support%20generating%20Windows%20SDK%20with%20no%20symlink> | Mute This Topic <https://lists.yoctoproject.org/mt/116091557/7304865> | New Topic <https://lists.yoctoproject.org/g/yocto-patches/post>
Your Subscription <https://lists.yoctoproject.org/g/yocto-patches/editsub/7304865> | Contact Group Owner <mailto:[email protected]> | Unsubscribe <https://lists.yoctoproject.org/g/yocto-patches/leave/13175947/7304865/1848005690/xyzzy> [[email protected]]_._,_._,_
Quoted 4 lines · Samuli Piippo via lists.yoctoproject.org
Would it make more sense to leave out the INHERIT and WINSDK_NO_SYMLINK. Instead, if you need this, you can inherit the class in your recipe or local.conf
-samuli
Hi Samuli,
From my experience, users will usually prefer a variable setting when it's possible.
Take this case as an example, they could put this setting in their <distro>.conf, site.conf or local.conf, then no matter meta-mingw is included or not, 'bitbake <something>' still works.
Regards,
Qi
Quoted 107 lines · On Wed, 12 Nov 2025 at 07:35, Chen Qi via lists.yoctoproject.org…
On 11/11/25 23:25, Joshua Watt wrote:
> On Sun, Nov 2, 2025 at 7:19 PM <[email protected]> wrote:
>> From: Chen Qi <[email protected]>
>>
>> On some Windows systems, symlinks are not allowed due to IT policy. >> We need to be able to generate Windows SDK without symlinks. >>
>> To do this, a new variable,WINSDK_NO_SYMLINK, and a new bbclass, >> mingw_sdk_handle_symlink.bbclass, are introduced to achieve this. >>
>> By default, things work as before; when settingWINSDK_NO_SYMLINK>> to "1", SDK will replace all symlinks with the actual contents. >>
>> Signed-off-by: Chen Qi <[email protected]>
>> ---
>> classes/mingw_sdk_handle_symlink.bbclass | 25
+++++++++++++++++++++
>> conf/machine-sdk/include/mingw32-common.inc | 3 +++ >> 2 files changed, 28 insertions(+)
>> create mode 100644 classes/mingw_sdk_handle_symlink.bbclass >>
>> diff --git a/classes/mingw_sdk_handle_symlink.bbclass b/classes/mingw_sdk_handle_symlink.bbclass
>> new file mode 100644
>> index 0000000..2f6dbe6
>> ---/dev/null
>> +++ b/classes/mingw_sdk_handle_symlink.bbclass
>> @@ -0,0 +1,25 @@
>> +WINSDK_NO_SYMLINK ?= "0"
>> +
>> +archive_sdk:prepend:sdkmingw32 () {
>> + if [ "${WINSDK_NO_SYMLINK}" = "1" ]; then
>> + forparse_typein "file" "directory"; do >> + find "${SDK_OUTPUT}/${SDKPATH}" -type l -print0 | while IFS= read -r -d '' symlink; do
>> + target=$(readlink -f "$symlink" || echo "NOTVALID")
>> + if [ "$target" = "NOTVALID" ]; then >> + continue
>> + fi
>> + if [ ! -e "$target" ]; then >> + continue
>> + elif [ -d "$target" ]; then >> + if [ "$parse_type" = "directory" ]; then
>> + rm "$symlink" && cp -r "$target" "$symlink"
>> + fi
>> + else
>> + if [ "$parse_type" = "file" ]; then
>> + rm "$symlink" && cp "$target" "$symlink"
>> + fi
>> + fi
>> + done
>> + done
>> + fi
>> +}
>> diff --git a/conf/machine-sdk/include/mingw32-common.inc b/conf/machine-sdk/include/mingw32-common.inc
>> index 56b8052..bf3f14e 100644
>> --- a/conf/machine-sdk/include/mingw32-common.inc
>> +++ b/conf/machine-sdk/include/mingw32-common.inc
>> @@ -59,3 +59,6 @@ GCCPIE:mingw32 = ""
>>
>> # wine and wineserver are required to test MinGW SDKs >> HOSTTOOLS_NONFATAL += "wine wineserver"
>> +
>> +# handle symlinks
>> +INHERIT += "mingw_sdk_handle_symlink"
> Does this need to be unconditional? I'd prefer something like > INHERIT:mingw32 instead if that worksHi Joshua,
I just tried it out. Using INHERIT:append:sdkmingw32 works. We have to use :append instead of "+=" to avoid overriding settings.
I'll send out V3.
Regards,
Qi>
>> --
>> 2.34.1
>>_._,_._,_
------------------------------------------------------------------------
Links:You receive all messages sent to this group.
View/Reply Online (#2490) <https://lists.yoctoproject.org/g/yocto-patches/message/2490> | Reply to Group <mailto:[email protected]?subject=Re:%20Re%3A%20%5Byocto-patches%5D%20%5Bmeta-mingw%5D%5BPATCH%20V2%5D%20meta-mingw%3A%20support%20generating%20Windows%20SDK%20with%20no%20symlink> | Reply to Sender <mailto:[email protected]?subject=Private:%20Re:%20Re%3A%20%5Byocto-patches%5D%20%5Bmeta-mingw%5D%5BPATCH%20V2%5D%20meta-mingw%3A%20support%20generating%20Windows%20SDK%20with%20no%20symlink> | Mute This Topic <https://lists.yoctoproject.org/mt/116091557/7304865> | New Topic <https://lists.yoctoproject.org/g/yocto-patches/post>
Your Subscription <https://lists.yoctoproject.org/g/yocto-patches/editsub/7304865> | Contact Group Owner <mailto:[email protected]> | Unsubscribe <https://lists.yoctoproject.org/g/yocto-patches/leave/13175947/7304865/1848005690/xyzzy> [[email protected]]_._,_._,_