Compare commits
16 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
56901559e8 | |
![]() |
663e0f6de7 | |
![]() |
39d120470b | |
![]() |
64c2313f33 | |
![]() |
e92c5e23b8 | |
![]() |
5ae310fe26 | |
![]() |
de102e45c6 | |
![]() |
2edf31f4b5 | |
![]() |
53fc9b41f0 | |
![]() |
ad3fe5d750 | |
![]() |
9d93b500cf | |
![]() |
a6b4a318e0 | |
![]() |
d003d8f6e0 | |
![]() |
d6e4daf0df | |
![]() |
5ed52785ff | |
![]() |
b707ba62b3 |
|
@ -7,12 +7,10 @@ env:
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
- swift52
|
||||
pull_request:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
- swift52
|
||||
|
||||
jobs:
|
||||
# macOS tasks
|
||||
|
@ -23,7 +21,7 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '12.3'
|
||||
xcode-version: '13.2.1'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
@ -34,6 +32,7 @@ jobs:
|
|||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: swift52
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
|
@ -61,11 +60,3 @@ jobs:
|
|||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-big-sur
|
||||
path: |
|
||||
SwiftGdk/
|
||||
retention-days: 1
|
||||
|
|
|
@ -19,6 +19,11 @@ jobs:
|
|||
build-ubuntu-18_04-swift-latest:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: YOCKOW/Action-setup-swift@v1
|
||||
with:
|
||||
swift-version: '5.6.1'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
|
@ -33,23 +38,16 @@ jobs:
|
|||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
./run-gir2swift.sh
|
||||
echo "GIR2SWIFT_PATH=${PWD}/checkouts/gir2swift/.build/release/gir2swift" >> $GITHUB_ENV
|
||||
cd ..
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build -Xswiftc -suppress-warnings
|
||||
swift build
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings
|
||||
swift test
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
|
@ -64,5 +62,5 @@ jobs:
|
|||
with:
|
||||
name: build-artefact-18.04-5.3
|
||||
path: |
|
||||
SwiftGdk/
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
||||
|
|
|
@ -7,12 +7,10 @@ env:
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
- swift52
|
||||
pull_request:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
- swift52
|
||||
|
||||
jobs:
|
||||
# macOS tasks
|
||||
|
@ -23,7 +21,7 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '12.3'
|
||||
xcode-version: '12.4'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
@ -34,6 +32,7 @@ jobs:
|
|||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: swift52
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
|
@ -61,11 +60,3 @@ jobs:
|
|||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-catalina
|
||||
path: |
|
||||
SwiftGdk/
|
||||
retention-days: 1
|
||||
|
|
|
@ -19,6 +19,11 @@ jobs:
|
|||
build-ubuntu-20_04-swift-latest:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: YOCKOW/Action-setup-swift@v1
|
||||
with:
|
||||
swift-version: '5.6.1'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
|
@ -33,23 +38,16 @@ jobs:
|
|||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
./run-gir2swift.sh
|
||||
echo "GIR2SWIFT_PATH=${PWD}/checkouts/gir2swift/.build/release/gir2swift" >> $GITHUB_ENV
|
||||
cd ..
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build -Xswiftc -suppress-warnings
|
||||
swift build
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings
|
||||
swift test
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
|
@ -64,5 +62,5 @@ jobs:
|
|||
with:
|
||||
name: build-artefact-20.04-5.3
|
||||
path: |
|
||||
SwiftGdk/
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
||||
|
|
|
@ -17,13 +17,13 @@ on:
|
|||
jobs:
|
||||
# macOS tasks
|
||||
build-mac-gtk4-swift-latest:
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-12.0
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '12.3'
|
||||
xcode-version: '13.3'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
@ -44,23 +44,16 @@ jobs:
|
|||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
./run-gir2swift.sh
|
||||
echo "GIR2SWIFT_PATH=${PWD}/checkouts/gir2swift/.build/release/gir2swift" >> $GITHUB_ENV
|
||||
cd ..
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
swift build
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
swift test
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
|
@ -75,5 +68,5 @@ jobs:
|
|||
with:
|
||||
name: build-artefact-macos-gtk4
|
||||
path: |
|
||||
SwiftGdk/
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
||||
|
|
|
@ -6,9 +6,9 @@ let package = Package(
|
|||
name: "Gdk",
|
||||
products: [ .library(name: "Gdk", targets: ["Gdk"]) ],
|
||||
dependencies: [
|
||||
.package(name: "gir2swift", url: "https://github.com/rhx/gir2swift.git", .branch("development")),
|
||||
.package(name: "GdkPixbuf", url: "https://github.com/rhx/SwiftGdkPixbuf.git", .branch("development")),
|
||||
.package(name: "PangoCairo", url: "https://github.com/rhx/SwiftPangoCairo.git", .branch("development")),
|
||||
.package(name: "gir2swift", url: "https://github.com/rhx/gir2swift.git", .branch("swift52")),
|
||||
.package(name: "GdkPixbuf", url: "https://github.com/rhx/SwiftGdkPixbuf.git", .branch("swift52")),
|
||||
.package(name: "PangoCairo", url: "https://github.com/rhx/SwiftPangoCairo.git", .branch("swift52")),
|
||||
],
|
||||
targets: [
|
||||
.systemLibrary(name: "CGdk", pkgConfig: "gdk-3.0",
|
||||
|
|
23
README.md
23
README.md
|
@ -11,7 +11,10 @@ For up to date (auto-generated) reference documentation, see https://rhx.github.
|
|||
|
||||
## What is new?
|
||||
|
||||
Support for gtk 4 was added via the `gtk4` branch.
|
||||
This branch supports Swift 5.2, but is now unmaintained.
|
||||
The `main` and `development` branches will require newer versions of Swift.
|
||||
|
||||
Support for gtk 4 for Swift 5.2 is available via the `gtk4-swift52` branch.
|
||||
|
||||
Version 12 of gir2swift pulls in [PR#10](https://github.com/rhx/gir2swift/pull/10), addressing several issues:
|
||||
|
||||
|
@ -52,7 +55,7 @@ was compiled against libraries built with earlier versions of `gir2swift`.
|
|||
|
||||
### Swift
|
||||
|
||||
To build, you need at least Swift 5.2 (Swift 5.3 is required for `gtk4`), download from https://swift.org/download/ -- if you are using macOS, make sure you have the command line tools installed as well). Test that your compiler works using `swift --version`, which should give you something like
|
||||
To build, you need at least Swift 5.2 (Swift 5.3 is required for `gtk4`; also some Linux distributions have issues and seem to **require at least Swift 5.5**), download from https://swift.org/download/ -- if you are using macOS, make sure you have the command line tools installed as well). Test that your compiler works using `swift --version`, which should give you something like
|
||||
|
||||
$ swift --version
|
||||
Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
|
||||
|
@ -163,14 +166,20 @@ Make sure you have [sourcekitten](https://github.com/jpsim/SourceKitten) and [ja
|
|||
|
||||
Here are some common errors you might encounter and how to fix them.
|
||||
|
||||
### Old Swift toolchain or Xcode
|
||||
|
||||
### Missing `.gir` Files
|
||||
If you get an error such as
|
||||
|
||||
$ ./build.sh
|
||||
error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-package (No such file or directory)
|
||||
Girs located at
|
||||
Cannot open '/GLib-2.0.gir': No such file or directory
|
||||
|
||||
Make sure that you have the relevant `gobject-introspection` packages installed (as per the Pre-requisites section), including their `.gir` and `.pc` files.
|
||||
|
||||
### Old Swift toolchain or Xcode
|
||||
If, when you run `swift build`, you get a `Segmentation fault (core dumped)` or circular dependency error such as
|
||||
|
||||
warning: circular dependency detected while parsing pangocairo: harfbuzz -> freetype2 -> harfbuzz
|
||||
|
||||
this probably means that your Swift toolchain is too old. Make sure the latest toolchain is the one that is found when you run the Swift compiler (see above).
|
||||
this probably means that your Swift toolchain is too old, particularly on Linux (at the time of this writing, some Linux distributions require at least Swift 5.5). Make sure the latest toolchain is the one that is found when you run the Swift compiler (see above).
|
||||
|
||||
If you get an older version, make sure that the right version of the swift compiler is found first in your `PATH`. On macOS, use xcode-select to select and install the latest version, e.g.:
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
VER=3.0
|
||||
GLIB_VER=2.0
|
||||
JAZZY_VER=3.24.29
|
||||
JAZZY_VER=3.24.30
|
||||
Mod=Gdk
|
||||
Module=${Mod}-$VER
|
||||
module=`echo "${Module}" | tr '[:upper:]' '[:lower:]'`
|
||||
|
@ -17,7 +17,7 @@ if [ -z "$BUILD_DIR" ]; then
|
|||
export BUILD_DIR="$PWD/.build"
|
||||
fi
|
||||
fi
|
||||
export PATH="${GIR2SWIFT_PATH}:${BUILD_DIR}/gir2swift/.build/release:${BUILD_DIR}/gir2swift/.build/debug:${PATH}:$PWD/.build/gir2swift/.build/release:$PWD/.build/gir2swift/.build/debug:${PATH}:/usr/local/opt/ruby/bin:`echo /usr/local/lib/ruby/gems/*/bin | tr ' ' '\n' | tail -n1`:${PATH}:`echo /var/lib/gems/*/gems/jazzy-*/bin/ | tr ' ' '\n' | tail -n1`:/usr/local/bin"
|
||||
export PATH="${GIR2SWIFT_PATH}:${BUILD_DIR}/checkouts/gir2swift/.build/release:${BUILD_DIR}/checkouts/gir2swift/.build/debug:${PATH}:$PWD/.build/checkouts/gir2swift/.build/release:$PWD/.build/checkouts/gir2swift/.build/debug:${PATH}:/usr/local/opt/ruby/bin:`echo /usr/local/lib/ruby/gems/*/bin | tr ' ' '\n' | tail -n1`:${PATH}:`echo /var/lib/gems/*/gems/jazzy-*/bin/ | tr ' ' '\n' | tail -n1`:/usr/local/bin"
|
||||
export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:${PKG_CONFIG_PATH}
|
||||
LINKFLAGS=`pkg-config --libs $module pangocairo pangoft2 pango gobject-$GLIB_VER gio-unix-$GLIB_VER glib-$GLIB_VER | tr ' ' '\n' | sed -e 's/^/-Xlinker /' -e 's/-Wl,//' | tr '\n' ' ' | sed -e 's/^/-Xlinker /' -e 's/-Wl,//g' -e 's/,/ -Xlinker /g' -e 's/ -pthread/ -lpthread/g' -e 's/-Xcc[ ]*-Xlinker/-Xlinker/g' -e 's/-Xlinker[ ]*-Xcc/-Xcc/g' -e 's/-Xlinker[ ]*--export-dynamic//g' -e 's/-Xlinker[ ]*-Xlinker/-Xlinker/g' -e 's/-Xcc *$//' -e 's/-Xlinker *$//'`
|
||||
CCFLAGS=`pkg-config --cflags $module pangocairo pangoft2 pango gobject-$GLIB_VER gio-unix-$GLIB_VER glib-$GLIB_VER | tr ' ' '\n' | sed 's/^/-Xcc /' | tr '\n' ' ' | sed -e 's/^/-Xlinker /' -e 's/-Wl,//g' -e 's/,/ -Xlinker /g' -e 's/ -pthread/ -lpthread/g' -e 's/-Xcc[ ]*-Xlinker/-Xlinker/g' -e 's/-Xlinker[ ]*-Xcc/-Xcc/g' -e 's/-Xlinker[ ]*--export-dynamic//g' -e 's/-Xlinker[ ]*-Xlinker/-Xlinker/g' -e 's/-Xcc *$//' -e 's/-Xlinker *$//'`
|
||||
|
|
|
@ -21,17 +21,4 @@ if [ ! -e "${GIR}" ] ; then
|
|||
echo "and can be found in /usr /usr/local or by pkg-config!"
|
||||
exit 1
|
||||
fi
|
||||
gir2swift -p ${GIR_DIR}/GLib-2.0.gir -p ${GIR_DIR}/GObject-2.0.gir -p ${GIR_DIR}/Pango-1.0.gir -p ${GIR_DIR}/cairo-1.0.gir -p ${GIR_DIR}/PangoCairo-1.0.gir -p ${GIR_DIR}/GdkPixbuf-2.0.gir "${GIR}" | sed -f ${Module}.sed | awk -f ${Module}.awk > Sources/${Mod}/${Module}.swift
|
||||
gir2swift -o Sources/${Mod} -m ${Module}.module -p ${GIR_DIR}/GLib-2.0.gir -p ${GIR_DIR}/GObject-2.0.gir -p ${GIR_DIR}/Pango-1.0.gir -p ${GIR_DIR}/cairo-1.0.gir -p ${GIR_DIR}/PangoCairo-1.0.gir -p ${GIR_DIR}/GdkPixbuf-2.0.gir "${GIR}"
|
||||
if which parallel >/dev/null ; then
|
||||
for src in Sources/${Mod}/*-*.swift ; do \
|
||||
echo "sed -f ${Module}.sed < ${src} |" \
|
||||
"awk -f ${Module}.awk > ${src}.out" \; \
|
||||
"mv ${src}.out ${src}" ; \
|
||||
done | parallel
|
||||
else
|
||||
for src in Sources/${Mod}/*-*.swift ; do
|
||||
sed -f ${Module}.sed < ${src} | awk -f ${Module}.awk > ${src}.out
|
||||
mv ${src}.out ${src}
|
||||
done
|
||||
fi
|
||||
gir2swift -o Sources/${Mod} -p ${GIR_DIR}/GLib-2.0.gir -p ${GIR_DIR}/GObject-2.0.gir -p ${GIR_DIR}/Pango-1.0.gir -p ${GIR_DIR}/cairo-1.0.gir -p ${GIR_DIR}/PangoCairo-1.0.gir -p ${GIR_DIR}/GdkPixbuf-2.0.gir "${GIR}"
|
||||
|
|
|
@ -15,22 +15,8 @@ function generate_arg-path_arg-g2s-exec_arg-gir-pre_arg-gir-path {
|
|||
local NAME=$(package_name)
|
||||
local GIR_PRE_ARGS=`for FILE in ${GIR_PRE}; do echo -n "-p ${GIR_PATH}/${FILE}.gir "; done`
|
||||
|
||||
bash -c "${G2S_EXEC} ${GIR_PRE_ARGS} ${GIR_PATH}/${GIR_NAME}.gir | sed -f ${GIR_NAME}.sed | awk -f ${GIR_NAME}.awk > Sources/${NAME}/${GIR_NAME}.swift"
|
||||
bash -c "${G2S_EXEC} -o Sources/${NAME} -m ${GIR_NAME}.module ${GIR_PRE_ARGS} ${GIR_PATH}/${GIR_NAME}.gir"
|
||||
|
||||
if which parallel >/dev/null ; then
|
||||
for src in Sources/${NAME}/*-*.swift ; do \
|
||||
echo "sed -f ${GIR_NAME}.sed < ${src} |" \
|
||||
"awk -f ${GIR_NAME}.awk > ${src}.out" \; \
|
||||
"mv ${src}.out ${src}" ; \
|
||||
done | parallel
|
||||
else
|
||||
for src in Sources/${NAME}/*-*.swift ; do
|
||||
sed -f ${GIR_NAME}.sed < ${src} | awk -f ${GIR_NAME}.awk > ${src}.out
|
||||
mv ${src}.out ${src}
|
||||
done
|
||||
fi
|
||||
|
||||
bash -c "${G2S_EXEC} -o Sources/${NAME} ${GIR_PRE_ARGS} ${GIR_PATH}/${GIR_NAME}.gir"
|
||||
|
||||
cd $CALLER
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue