Skip to content

Commit

Permalink
unsorted changes for Windows port
Browse files Browse the repository at this point in the history
  • Loading branch information
RSDuck committed Jun 4, 2023
1 parent 7b0817f commit f19a93a
Show file tree
Hide file tree
Showing 13 changed files with 154 additions and 10 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
build
**/pkg
**/src

*.sample
*.zst

config
description
FETCH_HEAD
HEAD
packed-refs
exclude
*.idx
*.pack
*.xz
*.gz
7 changes: 7 additions & 0 deletions build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ build_package_native() {
sh -c 'pacman -Syu && su -c "cd /wf/packages/'$PKGNAME' && makepkg -C --clean --syncdeps --force --noconfirm --skippgpcheck '$PKGNAME'" wfbuilder'
}

build_package_windows() {
cd /wf/packages/"$PKGNAME"
makepkg -C --clean --syncdeps --force --noconfirm --skippgpcheck '$PKGNAME'
}

if [[ z"$1" == "znative" ]]; then
build_package_native
elif [[ z"$1" == "zwindows" ]]; then
build_package_windows
elif [[ z"$1" == "z" || z"$1" == "zall" ]]; then
if grep -q "arch=(any)" packages/$PKGNAME/PKGBUILD; then
build_package x86_64
Expand Down
11 changes: 11 additions & 0 deletions config/runtime-env-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ WF_DESTDIR="/"
WF_USE_MUSL=true
WF_LIBRARY_SUFFIX=.so

MINGW_WINDOWS=false

case `uname` in MINGW*)
WF_USE_MUSL=false
WF_LIBRARY_SUFFIX=.dll
WF_DESTDIR="/opt/wonderful/"

MINGW_WINDOWS=true
WF_LUA_LDFLAGS=-llua
esac

WF_RUNTIME_LDFLAGS="-Wl,-rpath,$WF_PATH/lib -Wl,--dynamic-linker=$WF_PATH/lib/ld-musl-$CARCH.so.1"

WF_RUNTIME_INCLUDES="-I$WF_PATH/include"
Expand Down
18 changes: 18 additions & 0 deletions packages/runtime-gcc-libs-dummy/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Adrian "asie" Siekierka, 2023

pkgname=(runtime-gcc-libs)
pkgver=0.3.18
pkgrel=1
epoch=
pkgdesc="GCC runtime libraries (dummy)"
arch=("i686" "x86_64" "armv6h" "aarch64")
url=""
license=("GPL-3.0-or-later")
source=()
sha256sums=()
groups=(wonderful-base)

package() {
}
26 changes: 26 additions & 0 deletions packages/runtime-musl-dummy/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Adrian "asie" Siekierka, 2023

pkgname=(runtime-musl runtime-musl-dev)
pkgver=1.2.4
pkgrel=1
epoch=
pkgdesc="musl runtime (dummy)"
arch=("i686" "x86_64" "armv6h" "aarch64")
license=("MIT")
source=()
sha256sums=()

prepare() {
true
}

package_runtime-musl() {
groups=(wonderful-base)
}

package_runtime-musl-dev() {
pkgdesc="musl runtime development files (dummy)"
depends=(runtime-musl)
}
3 changes: 2 additions & 1 deletion packages/target-wswan-syslibs/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ options=(!strip)
. "../templates/git-pkgver.PKGBUILD"

build() {
CFLAGS=""
cd "$pkgname"
./build.sh
}

package() {
cd "$pkgname"
mkdir -p "$pkgdir"
mkdir -p "$pkgdir$WF_DESTDIR"
cp -aR build/target "$pkgdir$WF_DESTDIR"
}
15 changes: 10 additions & 5 deletions packages/templates/luarocks-package.PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
# SPDX-FileContributor: Adrian "asie" Siekierka, 2023

build_luarocks() {
luarocks-5.4 \
LDFLAGS="$WF_RUNTIME_LDFLAGS" \
LUA_INCDIR="$WF_PATH"/include \
LUA_LIBDIR="$WF_PATH"/lib/lua/5.4 \
make --tree=./build "$pkgrock".rockspec
if [ "$MINGW_WINDOWS" == "true" ]; then
luarocks \
make --tree=./build "$pkgrock".rockspec
else
luarocks-5.4 \
LDFLAGS="$WF_RUNTIME_LDFLAGS" \
LUA_INCDIR="$WF_PATH"/include \
LUA_LIBDIR="$WF_PATH"/lib/lua/5.4 \
make --tree=./build "$pkgrock".rockspec
fi
}
4 changes: 2 additions & 2 deletions packages/toolchain-gcc-ia16-elf-binutils/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ arch=("i686" "x86_64")
url="https://github.com/WonderfulToolchain/binutils-ia16"
license=("GPL-3.0-or-later")
source=("$pkgname::git+https://github.com/WonderfulToolchain/binutils-ia16#branch=binutils-2_39-ia16")
depends=(runtime-musl)
makedepends=(runtime-musl-dev)
depends=()
makedepends=()
groups=(toolchain-gcc-ia16-elf)
sha256sums=('SKIP')

Expand Down
6 changes: 6 additions & 0 deletions packages/toolchain-gcc-ia16-elf-gcc/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ prepare() {

build() {
cd gcc-build

# workaround for https://gcc.gnu.org/bugzilla//show_bug.cgi?id=108300
if [ "$MINGW_WINDOWS" == "true" ]; then
CPPFLAGS='-DWIN32_LEAN_AND_MEAN'
fi

../"$pkgname"/configure \
--prefix="/opt/wonderful/toolchain/gcc-ia16-elf" \
--target=ia16-elf \
Expand Down
14 changes: 12 additions & 2 deletions packages/wf-lua-iconv/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,29 @@ prepare() {
sed -i -E -e "s/check_one\(termcs, \"EBCDIC/-- EBCDIC/g" test_iconv.lua
# musl does not output EILSEQ.
sed -i -E -e "s/assert\(e == iconv.ERROR_INVALID/-- ERROR_INVALID/g" test_iconv.lua
elif [ "$MINGW_WINDOWS" == "true" ]; then
# mingw iconv only recognises them with a dash
sed -i -E -e "s/\"utf8\"/\"utf-8\"/g" test_iconv.lua
sed -i -E -e "s/\"utf16\"/\"utf-16\"/g" test_iconv.lua
fi
}

build() {
cd "$pkgname"

gcc -c -o iconv.lo $WF_RUNTIME_INCLUDES -fPIC -O3 -Wall luaiconv.c
gcc -o iconv"$WF_LIBRARY_SUFFIX" -shared $WF_LUA_LDFLAGS iconv.lo
gcc -c -o iconv.lo $WF_RUNTIME_INCLUDES -O3 -Wall luaiconv.c

if [ "$MINGW_WINDOWS" == "true" ]; then
EXPLICIT_ICONV_LINK="-liconv"
fi

gcc -o iconv"$WF_LIBRARY_SUFFIX" -shared iconv.lo "$WF_LUA_LDFLAGS" "$EXPLICIT_ICONV_LINK"
}

check() {
cd "$pkgname"

export LUA_CPATH="C:/msys64/wf/packages/wf-lua-iconv/src/wf-lua-iconv/?.dll"
$WF_PATH/bin/wf-lua test_iconv.lua
}

Expand Down
34 changes: 34 additions & 0 deletions packages/wf-lua-windows/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Adrian "asie" Siekierka, 2023

pkgname=(wf-lua wf-lua-dev)
pkgver=5.4.0
pkgrel=1
epoch=
pkgdesc="Lua scripting language"
arch=("i686" "x86_64" "armv6h" "aarch64")
url="https://www.lua.org"
license=("MIT")
source=(
"wf-lua"
"wf-luac"
)
depends=(mingw-w64-x86_64-lua)
makedepends=()
sha256sums=(
"SKIP"
"SKIP"
)

. "/wf/config/runtime-env-vars.sh"

package_wf-lua() {
mkdir -p "$pkgdir$WF_DESTDIR"/bin
cp -a "$srcdir"/wf-lua "$pkgdir$WF_DESTDIR"/bin/wf-lua
cp -a "$srcdir"/wf-luac "$pkgdir$WF_DESTDIR"/bin/wf-luac
}

package_wf-lua-dev() {
true
}
6 changes: 6 additions & 0 deletions packages/wf-lua-windows/wf-lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

export LUA_PATH="/opt/wonderful/lib/lua/5.4/?.lua;$LUA_PATH"
export LUA_CPATH="/opt/wonderful/lib/lua/5.4/?.dll;$LUA_CPATH"

lua "$@"
6 changes: 6 additions & 0 deletions packages/wf-lua-windows/wf-luac
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

export LUA_PATH="/opt/wonderful/lib/lua/5.4/?.lua"
export LUA_CPATH="/opt/wonderful/lib/lua/5.4/?.dll"

luac "$@"

0 comments on commit f19a93a

Please sign in to comment.