Compare commits

...

12 Commits
main ... gtk3

Author SHA1 Message Date
Rene Hexel e92c5e23b8 Bump JAZZY_VER to 3.24.30 2021-07-25 16:32:35 +10:00
Rene Hexel 5ae310fe26 Simplify manifest: let gir2swift do sed/awk post-processing 2021-07-25 16:15:33 +10:00
Rene Hexel de102e45c6 Only upload Sources 2021-07-25 16:15:33 +10:00
Rene Hexel 2edf31f4b5 Merge branch 'main' of github.com:rhx/SwiftGdk 2021-07-10 09:35:04 +10:00
Rene Hexel 53fc9b41f0 Update Xcode versions 2021-07-10 09:34:09 +10:00
Rene Hexel ad3fe5d750 Note Swift 5.5 and update Troubleshooting section 2021-06-10 20:02:54 +10:00
Rene Hexel 9d93b500cf Correct gir2swift path 2021-06-10 20:02:09 +10:00
Rene Hexel a6b4a318e0 Merge branch 'development' 2021-05-09 13:20:57 +10:00
Rene Hexel d003d8f6e0 s/development/main/ 2021-05-09 12:06:05 +10:00
Rene Hexel d6e4daf0df Merge branch 'development' 2021-05-09 12:05:36 +10:00
Rene Hexel 5ed52785ff Add /opt/homebrew to GIR search path prefix 2021-01-28 06:25:11 +10:00
Rene Hexel b707ba62b3 Add gir2swift to example Package.swift 2021-01-17 10:36:36 +10:00
10 changed files with 27 additions and 48 deletions

View File

@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v2
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '12.3'
xcode-version: '12.5'
- name: Print Swift version to confirm
run: swift --version
@ -67,5 +67,5 @@ jobs:
with:
name: build-artefact-big-sur
path: |
SwiftGdk/
SwiftGdk/Sources/
retention-days: 1

View File

@ -64,5 +64,5 @@ jobs:
with:
name: build-artefact-18.04-5.3
path: |
SwiftGdk/
SwiftGdk/Sources/
retention-days: 1

View File

@ -23,7 +23,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
@ -67,5 +67,5 @@ jobs:
with:
name: build-artefact-catalina
path: |
SwiftGdk/
SwiftGdk/Sources/
retention-days: 1

View File

@ -64,5 +64,5 @@ jobs:
with:
name: build-artefact-20.04-5.3
path: |
SwiftGdk/
SwiftGdk/Sources/
retention-days: 1

View File

@ -75,5 +75,5 @@ jobs:
with:
name: build-artefact-macos-gtk4
path: |
SwiftGdk/
SwiftGdk/Sources/
retention-days: 1

View File

@ -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("main")),
.package(name: "GdkPixbuf", url: "https://github.com/rhx/SwiftGdkPixbuf.git", .branch("main")),
.package(name: "PangoCairo", url: "https://github.com/rhx/SwiftPangoCairo.git", .branch("main")),
],
targets: [
.systemLibrary(name: "CGdk", pkgConfig: "gdk-3.0",

View File

@ -52,7 +52,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 +163,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.:

View File

@ -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 *$//'`

View File

@ -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}"

View File

@ -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
}