Compare commits
37 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
ead863266a | |
![]() |
07a5d51c59 | |
![]() |
e64bddd156 | |
![]() |
27108bf7fd | |
![]() |
acd6474395 | |
![]() |
301045cfd1 | |
![]() |
7c85242bac | |
![]() |
ef01ddc3e6 | |
![]() |
1a171d94f5 | |
![]() |
b99487564d | |
![]() |
f6aff61e0b | |
![]() |
997be8823c | |
![]() |
32b698bf37 | |
![]() |
a31337c988 | |
![]() |
56bfa03c14 | |
![]() |
b88a5fa75e | |
![]() |
f6358ff6a1 | |
![]() |
c8e02d8e82 | |
![]() |
e5dc13f81a | |
![]() |
b2748cf993 | |
![]() |
be0061a24d | |
![]() |
840814bcab | |
![]() |
0ccefaaf30 | |
![]() |
b735367bea | |
![]() |
8aa51ac16a | |
![]() |
cd0020c8e5 | |
![]() |
fe601105d9 | |
![]() |
9b6075b2b1 | |
![]() |
d7e6f6fa71 | |
![]() |
9b5706579c | |
![]() |
e142850e49 | |
![]() |
5da6aab77c | |
![]() |
0c4ddc932f | |
![]() |
46dc1273a8 | |
![]() |
f6271a136c | |
![]() |
7950d45d26 | |
![]() |
3f9ecf8e9f |
|
@ -0,0 +1,62 @@
|
|||
name: macOS 11
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
MACOS_BREW: ${{ 'gtk+3 pango glib glib-networking gobject-introspection pkg-config jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- swift52
|
||||
pull_request:
|
||||
branches:
|
||||
- swift52
|
||||
|
||||
jobs:
|
||||
# macOS tasks
|
||||
build-mac-big-sur-swift-latest:
|
||||
runs-on: macos-11.0
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '13.2.1'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: brew install $MACOS_BREW
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: swift52
|
||||
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`
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
|
@ -0,0 +1,66 @@
|
|||
name: Ubuntu 18.04
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
UBUNTU_APT: ${{ 'libgtk-3-dev gir1.2-gtk-3.0 gir1.2-gtksource-3.0 libpango1.0-dev gir1.2-pango-1.0 libgdk-pixbuf2.0-dev gir1.2-gdkpixbuf-2.0 libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev libxml2-dev jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# Ubuntu 18.04 tasks
|
||||
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
|
||||
|
||||
- name: Update package repository
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: sudo apt-get install $UBUNTU_APT
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-18.04-5.3
|
||||
path: |
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
|
@ -0,0 +1,62 @@
|
|||
name: macOS 10.15
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
MACOS_BREW: ${{ 'gtk+3 pango glib glib-networking gobject-introspection pkg-config jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- swift52
|
||||
pull_request:
|
||||
branches:
|
||||
- swift52
|
||||
|
||||
jobs:
|
||||
# macOS tasks
|
||||
build-mac-catalina-swift-latest:
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '12.4'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: brew install $MACOS_BREW
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: swift52
|
||||
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`
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
|
@ -0,0 +1,66 @@
|
|||
name: Ubuntu 20.04
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
UBUNTU_APT: ${{ 'libgtk-3-dev gir1.2-gtk-3.0 gir1.2-gtksource-3.0 libpango1.0-dev gir1.2-pango-1.0 libgdk-pixbuf2.0-dev gir1.2-gdkpixbuf-2.0 libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev libxml2-dev jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# Ubuntu 20.04 tasks
|
||||
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
|
||||
|
||||
- name: Update package repository
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: sudo apt-get install $UBUNTU_APT
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-20.04-5.3
|
||||
path: |
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
|
@ -0,0 +1,72 @@
|
|||
name: macOS gtk4
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
MACOS_BREW: ${{ 'gtk4 pango glib glib-networking gobject-introspection pkg-config jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- gtk4-development
|
||||
- gtk4
|
||||
pull_request:
|
||||
branches:
|
||||
- gtk4-development
|
||||
- gtk4
|
||||
|
||||
jobs:
|
||||
# macOS tasks
|
||||
build-mac-gtk4-swift-latest:
|
||||
runs-on: macos-12.0
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '13.3'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
- name: Run brew update
|
||||
run: brew update
|
||||
|
||||
- name: Upgrade installed packages to current version
|
||||
run: brew upgrade
|
||||
continue-on-error: true
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: brew install $MACOS_BREW
|
||||
if: ${{ success() || failure() }}
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-macos-gtk4
|
||||
path: |
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
|
@ -0,0 +1,56 @@
|
|||
name: macOS 12
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
MACOS_BREW: ${{ 'gtk+3 pango glib glib-networking gobject-introspection pkg-config jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# macOS tasks
|
||||
build-mac-monterey-latest:
|
||||
runs-on: macos-12.0
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '13.3.1'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: brew install $MACOS_BREW
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
|
@ -4,6 +4,7 @@
|
|||
/docs
|
||||
/Packages
|
||||
/*.xcodeproj
|
||||
/.swiftpm
|
||||
*.tgz
|
||||
undocumented.json
|
||||
Package.resolved
|
||||
|
|
50
Gdk-3.0.sed
50
Gdk-3.0.sed
|
@ -1,50 +0,0 @@
|
|||
s/EVENT_STOP: Bool = 5/EVENT_STOP: gboolean = 1/
|
||||
s/gdk_cursor_ref/g_object_ref/g
|
||||
s/gdk_cursor_unref/g_object_unref/g
|
||||
s/createSimilarImageSurface(format: CInt/createSimilarImageSurface(format: cairo_format_t/
|
||||
s/\(@available(., deprecated) @inlinable\) \(public init() {\)/\1 override \2/
|
||||
s/\(public init<T: AppLaunchContextProtocol>(\)appLaunchContext \(other: T)\)/\1_ \2/
|
||||
s/-> GdkAtom {/-> GdkAtom! {/g
|
||||
s/: GdkAtom/: GdkAtom!/g
|
||||
s/UnsafeMutablePointer<GdkAtom>/GdkAtom/
|
||||
s/targets: UnsafePointer<GdkAtom>/targets: UnsafePointer<GdkAtom?>/
|
||||
s/GdkAtom!.self/_GdkAtom.self/
|
||||
s/actual_property_type: AtomT/actual_property_type: UnsafeMutablePointer<GdkAtom?>/
|
||||
s/property: GdkAtom!, type: GdkAtom!/property: AtomT!, type: AtomT!/
|
||||
s/property, type/property._ptr, type._ptr/
|
||||
s/propertyGet<WindowT: WindowProtocol>/propertyGet<WindowT: WindowProtocol, AtomT: AtomProtocol>/
|
||||
s/propertyChange<WindowT: WindowProtocol>/propertyChange<WindowT: WindowProtocol, AtomT: AtomProtocol>/
|
||||
s/func propertyChange(property: AtomT/func propertyChange<AtomT: AtomProtocol>(property: AtomT/
|
||||
s/\(propertyGet.*\)window: WindowT, property: AtomT!, type: AtomT!/\1window: WindowT, property: UnsafeMutablePointer<GdkAtom?>, type: AtomT!/
|
||||
s/(gdk_property_get(window.window_ptr, property._ptr, type._ptr, gulong(offset), gulong(length), gint(pdelete), _ptr, actual_format, actual_length, data)/(gdk_property_get(window.window_ptr, _ptr, type._ptr, gulong(offset), gulong(length), gint(pdelete), property, actual_format, actual_length, data)/
|
||||
s/selectionPropertyGet<AtomT: AtomProtocol, WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>.>!, propType: AtomT/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, propertyType: UnsafeMutablePointer<GdkAtom?>!/
|
||||
s/selectionPropertyGet<AtomT: AtomProtocol>(data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, propType: AtomT, propFormat: UnsafeMutablePointer<gint>!) -> Int/selectionPropertyGet(data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, propertyType: UnsafeMutablePointer<GdkAtom?>, propertyFormat: UnsafeMutablePointer<gint>!) -> Int/
|
||||
s/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>.>!, propFormat/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, property _ptr: UnsafeMutablePointer<GdkAtom?>, propertyFormat/
|
||||
s/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>.>!, propertyType: UnsafeMutablePointer<GdkAtom.>!, propFormat:/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, propertyType: UnsafeMutablePointer<GdkAtom?>!, propertyFormat:/
|
||||
s/property._ptr, type._ptr, gulong(offset), gulong(length), gint(pdelete), actual_property_type._ptr/_ptr, type._ptr, gulong(offset), gulong(length), gint(pdelete), actual_property_type/
|
||||
s/rv = Int(gdk_selection_property_get(requestor.window_ptr, data, propType._ptr, propFormat))/rv = Int(gdk_selection_property_get(requestor.window_ptr, data, propertyType, propertyFormat))/
|
||||
s/Int(gdk_selection_property_get(window_ptr, data, propType._ptr, propFormat))/Int(gdk_selection_property_get(window_ptr, data, propertyType, propertyFormat))/
|
||||
s/Int(gdk_selection_property_get(requestor.window_ptr, data, _ptr, propFormat))/Int(gdk_selection_property_get(requestor.window_ptr, data, _ptr, propertyFormat))/
|
||||
s/gdk_gl_context_set_use_es(gl_context_ptr, gint(newValue))/gdk_gl_context_set_use_es(gl_context_ptr, newValue ? 1 : 0)/
|
||||
s/: \([A-Za-z.]*Notify[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Func[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Marshal[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Marshaller[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Callback[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Accumulator[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Handler[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Transformer[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Transform[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Transformer =\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Hook[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Mapping[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*Listener[,)]\)/: @escaping \1/g
|
||||
s/: \([A-Za-z.]*ListenerInit[,)]\)/: @escaping \1/g
|
||||
s/GObject.Callback/GLibObject.Callback/g
|
||||
s/func endPaint/@available(*, deprecated) func endPaint/
|
||||
s/public func beep/@available(*, deprecated) public func beep/
|
||||
s/public func errorTrap/@available(*, deprecated) public func errorTrap/
|
||||
s/public func flush/@available(*, deprecated) public func flush/
|
||||
s/public func setDoubleClickTime/@available(*, deprecated) public func setDoubleClickTime/
|
||||
s/_ptr.pointee.state = newValue.value/_ptr.pointee.state = newValue.rawValue/
|
||||
s/targets: GdkAtom/targets: UnsafePointer<GdkAtom?>/
|
|
@ -9,7 +9,7 @@ import GIO
|
|||
import Pango
|
||||
import Cairo
|
||||
import PangoCairo
|
||||
import GdkPixbuf
|
||||
import GdkPixBuf
|
||||
|
||||
// missing header file type aliases
|
||||
public typealias GdkXEvent = _GdkXEvent
|
|
@ -9,5 +9,5 @@ import GIO
|
|||
import Pango
|
||||
import Cairo
|
||||
import PangoCairo
|
||||
import GdkPixbuf
|
||||
import GdkPixBuf
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
s/-> GdkAtom {/-> GdkAtom! {/g
|
||||
s/: GdkAtom/: GdkAtom!/g
|
||||
s/UnsafeMutablePointer<GdkAtom>/GdkAtom/
|
||||
s/targets: UnsafePointer<GdkAtom>/targets: UnsafePointer<GdkAtom?>/
|
||||
s/GdkAtom!.self/_GdkAtom.self/
|
||||
s/actual_property_type: AtomT/actual_property_type: UnsafeMutablePointer<GdkAtom?>/
|
||||
s/Xproperty: GdkAtom!, type: GdkAtom!/property: AtomT!, type: AtomT!/
|
||||
s/\(propertyGet.*\)window: WindowT, property: AtomT!, type: AtomT!/\1window: WindowT, property: UnsafeMutablePointer<GdkAtom?>, type: AtomT!/
|
||||
s/selectionPropertyGet<AtomT: AtomProtocol, WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>.>!, propType: AtomT/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, propertyType: UnsafeMutablePointer<GdkAtom?>!/
|
||||
s/selectionPropertyGet<AtomT: AtomProtocol>(data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, propType: AtomT, propFormat: UnsafeMutablePointer<gint>!) -> Int/selectionPropertyGet(data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, propertyType: UnsafeMutablePointer<GdkAtom?>, propertyFormat: UnsafeMutablePointer<gint>!) -> Int/
|
||||
s/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>.>!, propFormat/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, property _ptr: UnsafeMutablePointer<GdkAtom?>, propertyFormat/
|
||||
s/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>.>!, propertyType: UnsafeMutablePointer<GdkAtom.>!, propFormat:/selectionPropertyGet<WindowT: WindowProtocol>(requestor: WindowT, data: UnsafeMutablePointer<UnsafeMutablePointer<guchar>?>!, propertyType: UnsafeMutablePointer<GdkAtom?>!, propertyFormat:/
|
||||
s/targets: GdkAtom/targets: UnsafePointer<GdkAtom?>/
|
||||
s/gdk_selection_property_get(requestor.window_ptr, data, propType._ptr, propFormat)/gdk_selection_property_get(requestor.window_ptr, data, propertyType, propertyFormat)/
|
||||
s/gdk_selection_property_get(window_ptr, data, propType._ptr, propFormat)/gdk_selection_property_get(window_ptr, data, propertyType, propertyFormat)/
|
||||
s/gdk_selection_property_get(requestor.window_ptr, data, _ptr, propFormat)/gdk_selection_property_get(requestor.window_ptr, data, _ptr, propertyFormat)/
|
||||
s/\(@available(., deprecated) @inlinable\) \(public init() {\)/\1 override \2/
|
||||
s/gdk_gl_context_set_use_es(gl_context_ptr, gint(newValue))/gdk_gl_context_set_use_es(gl_context_ptr, newValue ? 1 : 0)/
|
||||
s/_ptr.pointee.state = newValue.value/_ptr.pointee.state = newValue.rawValue/
|
||||
s/\(gdk_crossing_event.*\)crossing_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_button_event.*\)button_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_dnd_event.*\)dnd_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_focus_event.*\)focus_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_grab_broken_event.*\)grab_broken_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_key_event.*\)key_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_pad_event.*\)pad_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_scroll_event.*\)scroll_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_touch.*_event.*\)touch.*_\(event_ptr\)/\1\2/
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// swift-tools-version:5.2
|
||||
// swift-tools-version:5.6
|
||||
|
||||
import PackageDescription
|
||||
|
||||
|
@ -6,16 +6,33 @@ let package = Package(
|
|||
name: "Gdk",
|
||||
products: [ .library(name: "Gdk", targets: ["Gdk"]) ],
|
||||
dependencies: [
|
||||
.package(name: "GdkPixbuf", url: "https://github.com/rhx/SwiftGdkPixbuf.git", .branch("main")),
|
||||
.package(name: "PangoCairo", url: "https://github.com/rhx/SwiftPangoCairo.git", .branch("main")),
|
||||
.package(url: "https://github.com/rhx/gir2swift.git", branch: "main"),
|
||||
.package(url: "https://github.com/rhx/SwiftGdkPixbuf.git", branch: "main"),
|
||||
.package(url: "https://github.com/rhx/SwiftPangoCairo.git", branch: "main"),
|
||||
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
|
||||
],
|
||||
targets: [
|
||||
.systemLibrary(name: "CGdk", pkgConfig: "gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2.",
|
||||
.systemLibrary(name: "CGdk", pkgConfig: "gtk4",
|
||||
providers: [
|
||||
.brew(["gtk+3", "glib", "glib-networking", "gobject-introspection"]),
|
||||
.apt(["libgtk-3-dev", "libglib2.0-dev", "glib-networking", "gobject-introspection", "libgirepository1.0-dev"])
|
||||
.brew(["gtk4", "glib", "glib-networking", "gobject-introspection"]),
|
||||
.apt(["libgtk-4-dev", "libglib2.0-dev", "glib-networking", "gobject-introspection", "libgirepository1.0-dev"])
|
||||
]),
|
||||
.target(name: "Gdk", dependencies: ["CGdk", "GdkPixbuf", "PangoCairo"]),
|
||||
.target(
|
||||
name: "Gdk",
|
||||
dependencies: [
|
||||
"CGdk",
|
||||
.product(name: "gir2swift", package: "gir2swift"),
|
||||
.product(name: "GdkPixBuf", package: "SwiftGdkPixbuf"),
|
||||
.product(name: "PangoCairo", package: "SwiftPangoCairo"),
|
||||
],
|
||||
swiftSettings: [
|
||||
.unsafeFlags(["-suppress-warnings"], .when(configuration: .release)),
|
||||
.unsafeFlags(["-suppress-warnings", "-Xfrontend", "-serialize-debugging-options"], .when(configuration: .debug)),
|
||||
],
|
||||
plugins: [
|
||||
.plugin(name: "gir2swift-plugin", package: "gir2swift")
|
||||
]
|
||||
),
|
||||
.testTarget(name: "GdkTests", dependencies: ["Gdk"]),
|
||||
]
|
||||
)
|
||||
|
|
127
README.md
127
README.md
|
@ -1,87 +1,97 @@
|
|||
# SwiftGdk
|
||||
|
||||
A Swift wrapper around gdk-3.x and gdk-4.x that is largely auto-generated from gobject-introspection.
|
||||
For up to date (auto-generated) reference documentation, see https://rhx.github.io/SwiftGdk/
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## What is new?
|
||||
|
||||
Experimental support for gtk 4 was added via the `gtk4` branch.
|
||||
|
||||
Version 11 introduces a new type system into `gir2swift`,
|
||||
to ensure it has a representation of the underlying types.
|
||||
This is necessary for Swift 5.3 onwards, which requires more stringent casts.
|
||||
As a consequence, accessors can accept and return idiomatic Swift rather than
|
||||
underlying types or pointers.
|
||||
This means that a lot of the changes will be source-breaking for code that
|
||||
was compiled against libraries built with earlier versions of `gir2swift`.
|
||||
|
||||
### Notable changes
|
||||
|
||||
* Requires Swift 5.2 or later (Swift 5.3 is required for the `gtk4` branch)
|
||||
* Uses the namespace referenced in the `gir` file
|
||||
* Wrapper code is now `@inlinable` to enable the compiler to optimise away most of the wrappers
|
||||
* Parameters and return types use more idiomatic Swift (e.g. `Ref` wrappers instead of pointers, `Int` instead of `gint`, etc.)
|
||||
* Functions that take or return records now are templated instead of using the type-erased Protocol
|
||||
* `ErrorType` has been renamed `GLibError` to ensure it neither clashes with `Swift.Error` nor the `GLib.ErrorType` scanner enum
|
||||
* Parameters or return types for records/classes now use the corresponding, lightweight Swift `Ref` wrapper instead of the underlying pointer
|
||||
Support for gtk 4 was added via the `gtk4` branch.
|
||||
|
||||
Version 15 of gir2swift provides a Package Manager Plugin. This requires Swift 5.6 or higher.
|
||||
(older versions can be used via the [swift52](https://github.com/rhx/SwiftGdk/tree/swift52) branch).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### Swift
|
||||
### Swift 5.6 or higher
|
||||
|
||||
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, download Swift 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.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
|
||||
Target: x86_64-apple-darwin20.3.0
|
||||
swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
|
||||
Target: x86_64-apple-macosx12.0
|
||||
|
||||
on macOS, or on Linux you should get something like:
|
||||
|
||||
$ swift --version
|
||||
Swift version 5.3.2 (swift-5.3.2-RELEASE)
|
||||
Swift version 5.7.3 (swift-5.7.3-RELEASE)
|
||||
Target: x86_64-unknown-linux-gnu
|
||||
|
||||
### Gtk 3.22 or higher
|
||||
|
||||
The Swift wrappers have been tested with glib-2.56, 2.58, 2.60, 2.62, 2.64 and 2.66, and gdk/gtk 3.22, 3.24 and 4.0. They should work with higher versions, but YMMV. Also make sure you have `gobject-introspection` and its `.gir` files installed.
|
||||
The Swift wrappers have been tested with glib-2.56, 2.58, 2.60, 2.62, 2.64, 2.66, 2.68, 2.70 and 2.72, and gdk/gtk 3.22 and 3.24 as well as 4.0, 4.2, 4.4, 4.6, 4.8, and 4.10 on the gtk4 branch. They should work with higher versions, but YMMV. Also make sure you have `gobject-introspection` and its `.gir` files installed.
|
||||
|
||||
#### Linux
|
||||
|
||||
##### Ubuntu
|
||||
|
||||
On Ubuntu 18.04 and 16.04 you can use the gtk that comes with the distribution. Just install with the `apt` package manager:
|
||||
On Ubuntu 20.04 and 22.04 you can use the glib that comes with the distribution. Just install with the `apt` package manager:
|
||||
|
||||
sudo apt update
|
||||
sudo apt install libgtk-3-dev gir1.2-gtk-3.0 gir1.2-gtksource-3.0 libgirepository1.0-dev libxml2-dev
|
||||
|
||||
If you prefer a newer version of gtk, you can also install it from the GNOME 3 Staging PPA (see https://launchpad.net/~gnome3-team/+archive/ubuntu/gnome3-staging), but be aware that this can be a bit dangerous (as this removes packages that can be vital, particularly if you use a GNOME-based desktop), so only do this if you know what you are doing:
|
||||
|
||||
sudo add-apt-repository ppa:gnome3-team/gnome3-staging
|
||||
sudo apt update
|
||||
sudo apt dist-upgrade
|
||||
sudo apt install libgtk-3-dev gir1.2-gtk-3.0 gir1.2-gtksource-3.0 libgirepository1.0-dev libxml2-dev
|
||||
sudo apt install libgtk-3-dev gir1.2-gtk-3.0 gir1.2-gtksource-3.0 libcogl-dev gir1.2-cogl-1.0 libcogl-pango-dev gir1.2-coglpango-1.0 libgdk-pixbuf2.0-dev gir1.2-gdkpixbuf-2.0 libgirepository1.0-dev libxml2-dev
|
||||
|
||||
##### Fedora
|
||||
|
||||
On Fedora 29, you can use the gtk that comes with the distribution. Just install with the `dnf` package manager:
|
||||
On Fedora, you can use the gtk that comes with the distribution. Just install with the `dnf` package manager:
|
||||
|
||||
sudo dnf install gtk3-devel pango-devel cairo-devel cairo-gobject-devel glib2-devel gobject-introspection-devel libxml2-devel
|
||||
sudo dnf install gtk3-devel pango-devel cogl-devel gdk-pixbuf2-devel cairo-devel cairo-gobject-devel glib2-devel gobject-introspection-devel libxml2-devel
|
||||
|
||||
#### macOS
|
||||
|
||||
On macOS, you can install gdk and gtk using HomeBrew (for setup instructions, see http://brew.sh). Once you have a running HomeBrew installation, you can use it to install a native version of gtk:
|
||||
|
||||
brew update
|
||||
brew install gtk+3 glib glib-networking gobject-introspection pkg-config
|
||||
brew install gtk4 glib glib-networking gobject-introspection pkg-config
|
||||
|
||||
## Usage
|
||||
|
||||
Normally, you don't build this package directly (but for testing you can - see 'Building' below). Instead you need to embed SwiftGdk into your own project using the [Swift Package Manager](https://swift.org/package-manager/). After installing the prerequisites (see 'Prerequisites' below), add `SwiftGdk` as a dependency to your `Package.swift` file, e.g.:
|
||||
|
||||
```Swift
|
||||
// swift-tools-version:5.6
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(name: "MyPackage",
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/rhx/gir2swift.git", branch: "main"),
|
||||
.package(url: "https://github.com/rhx/SwiftGdk.git", branch: "gtk4"),
|
||||
],
|
||||
targets: [
|
||||
.target(name: "MyPackage",
|
||||
dependencies: [
|
||||
.product(name: "Gdk", package: "SwiftGdk")
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
For gtk3 replace `.branch("gtk4")` with `.branch("gtk3")`.
|
||||
|
||||
## Building
|
||||
Normally, you don't build this package directly, but you embed it into your own project (see 'Embedding' below). However, you can build and test this module separately to ensure that everything works. Make sure you have all the prerequisites installed (see above). After that, you can simply clone this repository and build the command line executable (be patient, this will download all the required dependencies and take a while to compile) using
|
||||
|
||||
Normally, you don't build this package directly, but you embed it into your own project (see 'Usage' above). However, you can build and test this module separately to ensure that everything works. Make sure you have all the prerequisites installed (see above). After that, you can simply clone this repository and build the command line executable (be patient, this will download all the required dependencies and take a while to compile) using
|
||||
|
||||
git clone https://github.com/rhx/SwiftGdk.git
|
||||
cd SwiftGdk
|
||||
./build.sh
|
||||
./test.sh
|
||||
swift build
|
||||
swift test
|
||||
|
||||
### Xcode
|
||||
|
||||
|
@ -93,30 +103,43 @@ On macOS, you can build the project using Xcode instead. To do this, you need t
|
|||
|
||||
After that, use the (usual) Build and Test buttons to build/test this package.
|
||||
|
||||
|
||||
|
||||
## Documentation
|
||||
You can find reference documentation inside the [docs](https://rhx.github.io/SwiftGdk/) folder.
|
||||
This was generated using the [jazzy](https://github.com/realm/jazzy) tool.
|
||||
If you want to generate your own documentation, matching your local installation,
|
||||
you can use the `generate-documentation.sh` script in the repository.
|
||||
Unfortunately, at this stage [jazzy](https://github.com/realm/jazzy) only works on macOS (and crashes under Linux), so this will currently only work on a Mac.
|
||||
You can generate documentation using the [DocC plugin](https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/). To preview documentation matching your local installation, simply run
|
||||
|
||||
swift package --disable-sandbox preview-documentation
|
||||
|
||||
then navigate to the URL shown for the local preview server. Make sure you have JavaScript enabled in your browser.
|
||||
|
||||
Alternatively, you can create static documentation using [jazzy](https://github.com/realm/jazzy).
|
||||
Make sure you have [sourcekitten](https://github.com/jpsim/SourceKitten) and [jazzy](https://github.com/realm/jazzy) installed, e.g. on macOS (x86_64):
|
||||
|
||||
brew install ruby sourcekitten
|
||||
/usr/local/opt/ruby/bin/gem install jazzy
|
||||
./generate-jazzy.sh
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
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.
|
||||
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.:
|
||||
|
||||
sudo xcode-select -s /Applications/Xcode.app
|
||||
xcode-select --install
|
||||
|
||||
|
|
|
@ -1,23 +1,41 @@
|
|||
struct _GdkAppLaunchContext {};
|
||||
struct _GdkAtom {};
|
||||
struct _GdkAxisUse {};
|
||||
struct _GdkButtonEvent {};
|
||||
struct _GdkByteOrder {};
|
||||
struct _GdkCairoContext {};
|
||||
struct _GdkClipboard {};
|
||||
struct _GdkContentDeserializer {};
|
||||
struct _GdkContentFormats {};
|
||||
struct _GdkContentFormatsBuilder {};
|
||||
struct _GdkContentSerializer {};
|
||||
struct _GdkCrossingEvent {};
|
||||
struct _GdkCrossingMode {};
|
||||
struct _GdkCursor {};
|
||||
struct _GdkCursorType {};
|
||||
struct _GdkDNDEvent {};
|
||||
struct _GdkDeleteEvent {};
|
||||
struct _GdkDevice {};
|
||||
struct _GdkDeviceManager {};
|
||||
struct _GdkDeviceType {};
|
||||
struct _GdkDisplay {};
|
||||
struct _GdkDisplayManager {};
|
||||
struct _GdkDrag {};
|
||||
struct _GdkDragAction {};
|
||||
struct _GdkDragContext {};
|
||||
struct _GdkDragProtocol {};
|
||||
struct _GdkDragSurface {};
|
||||
struct _GdkDragSurfaceInterface {};
|
||||
struct _GdkDrawContext {};
|
||||
struct _GdkDrop {};
|
||||
struct _GdkEvent {};
|
||||
struct _GdkEventFunc {};
|
||||
struct _GdkEventMask {};
|
||||
struct _GdkEventSequence {};
|
||||
struct _GdkFileList {};
|
||||
struct _GdkFilterFunc {};
|
||||
struct _GdkFilterReturn {};
|
||||
struct _GdkFocusEvent {};
|
||||
struct _GdkFrameClock {};
|
||||
struct _GdkFrameClockClass {};
|
||||
struct _GdkFrameClockPhase {};
|
||||
|
@ -26,28 +44,56 @@ struct _GdkFrameTimings {};
|
|||
struct _GdkFullscreenMode {};
|
||||
struct _GdkGLContext {};
|
||||
struct _GdkGLError {};
|
||||
struct _GdkGLTexture {};
|
||||
struct _GdkGLTextureClass {};
|
||||
struct _GdkGrabBrokenEvent {};
|
||||
struct _GdkGrabOwnership {};
|
||||
struct _GdkGrabStatus {};
|
||||
struct _GdkGravity {};
|
||||
struct _GdkInputMode {};
|
||||
struct _GdkInputSource {};
|
||||
struct _GdkKeyEvent {};
|
||||
struct _GdkKeymap {};
|
||||
struct _GdkMemoryTexture {};
|
||||
struct _GdkMemoryTextureClass {};
|
||||
struct _GdkModifierIntent {};
|
||||
struct _GdkModifierType {};
|
||||
struct _GdkMotionEvent {};
|
||||
struct _GdkNotifyType {};
|
||||
struct _GdkOwnerChange {};
|
||||
struct _GdkPadEvent {};
|
||||
struct _GdkPaintable {};
|
||||
struct _GdkPixbuf {};
|
||||
struct _GdkPopup {};
|
||||
struct _GdkPopupInterface {};
|
||||
struct _GdkPopupLayout {};
|
||||
struct _GdkPropMode {};
|
||||
struct _GdkPropertyState {};
|
||||
struct _GdkProximityEvent {};
|
||||
struct _GdkRectangle {};
|
||||
struct _GdkScreen {};
|
||||
struct _GdkScrollDirection {};
|
||||
struct _GdkScrollEvent {};
|
||||
struct _GdkSettingAction {};
|
||||
struct _GdkSnapshot {};
|
||||
struct _GdkSnapshotClass {};
|
||||
struct _GdkStatus {};
|
||||
struct _GdkSurface {};
|
||||
struct _GdkSurfaceClass {};
|
||||
struct _GdkTexture {};
|
||||
struct _GdkTextureClass {};
|
||||
struct _GdkTextureDownloader {};
|
||||
struct _GdkToplevel {};
|
||||
struct _GdkToplevelInterface {};
|
||||
struct _GdkToplevelLayout {};
|
||||
struct _GdkToplevelSize {};
|
||||
struct _GdkTouchEvent {};
|
||||
struct _GdkTouchpadEvent {};
|
||||
struct _GdkTouchpadGesturePhase {};
|
||||
struct _GdkVisibilityState {};
|
||||
struct _GdkVisual {};
|
||||
struct _GdkVisualType {};
|
||||
struct _GdkVulkanContext {};
|
||||
struct _GdkWMDecoration {};
|
||||
struct _GdkWMFunction {};
|
||||
struct _GdkWindow {};
|
||||
|
@ -82,4 +128,9 @@ struct _GdkMonitorInterface {};
|
|||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkprivate.h>
|
||||
|
||||
#undef GDK_ACTION_ALL
|
||||
#define GDK_ACTION_ALL 7
|
||||
|
||||
#undef GDK_MODIFIER_MASK
|
||||
#define GDK_MODIFIER_MASK 0x1C001F0F
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module CGdk [system] {
|
||||
header "gdk_bridging.h"
|
||||
|
||||
link "gdk-3"
|
||||
link "gtk-4"
|
||||
link "pangocairo-1.0"
|
||||
link "pangoft2-1.0"
|
||||
link "fontconfig"
|
||||
|
|
|
@ -3,24 +3,8 @@ import XCTest
|
|||
|
||||
class GdkTests: XCTestCase {
|
||||
|
||||
func testEvent() {
|
||||
let event = Event(type: .keyPress)
|
||||
XCTAssertEqual(event.type, event.event_ptr.pointee.type)
|
||||
XCTAssertEqual(event.type, EventType.keyPress)
|
||||
// FIXME: implement gdk-4 tests
|
||||
func testEmpty() {
|
||||
}
|
||||
|
||||
func testEventType() {
|
||||
let doubleButton = EventType.doubleButtonPress
|
||||
XCTAssertEqual(doubleButton, EventType._2buttonPress)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension GdkTests {
|
||||
static var allTests : [(String, (GdkTests) -> () throws -> Void)] {
|
||||
return [
|
||||
("testEvent", testEvent),
|
||||
("testEventType", testEventType),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import XCTest
|
||||
@testable import GdkTests
|
||||
|
||||
XCTMain([
|
||||
testCase(GdkTests.allTests),
|
||||
])
|
1
build.sh
1
build.sh
|
@ -4,5 +4,4 @@
|
|||
# to determine compiler and linker flags
|
||||
#
|
||||
. ./config.sh
|
||||
[ -e Sources/${Mod}/${Module}.swift ] || ./generate-wrapper.sh
|
||||
exec swift build --build-path "$BUILD_DIR" $CCFLAGS $LINKFLAGS "$@"
|
||||
|
|
13
config.sh
13
config.sh
|
@ -3,9 +3,10 @@
|
|||
# Configuration for the module to compile, the Swift toolchain, and
|
||||
# the compiler and linker flags to use.
|
||||
#
|
||||
VER=3.0
|
||||
major=4
|
||||
VER=$major.0
|
||||
GLIB_VER=2.0
|
||||
JAZZY_VER=3.24.22
|
||||
JAZZY_VER=$major.6.2
|
||||
Mod=Gdk
|
||||
Module=${Mod}-$VER
|
||||
module=`echo "${Module}" | tr '[:upper:]' '[:lower:]'`
|
||||
|
@ -14,13 +15,13 @@ if [ -z "$BUILD_DIR" ]; then
|
|||
if `pwd -P | grep -q Dropbox` ; then
|
||||
export BUILD_DIR="/tmp/.build-$Module"
|
||||
else
|
||||
export BUILD_DIR=`pwd`/.build
|
||||
export BUILD_DIR="$PWD/.build"
|
||||
fi
|
||||
fi
|
||||
export PATH="${GIR2SWIFT_PATH}:${BUILD_DIR}/gir2swift/.build/release:${BUILD_DIR}/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 *$//'`
|
||||
LINKFLAGS=`pkg-config --libs gtk$major 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 gtk$major 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 *$//'`
|
||||
TAC="tail -r"
|
||||
if which tac >/dev/null 2>&1 ; then
|
||||
TAC=tac
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
#
|
||||
. ./config.sh
|
||||
./clean.sh
|
||||
exec rm -rf Package.pins Packages Package.resolved Sources/${Mod}/*-*.swift Sources/${Mod}/${Module}.swift Sources/${Mod}/Swift${Mod}.swift ${Mod}.xcodeproj
|
||||
exec rm -rf .swiftpm Package.pins Packages Package.resolved docs .docs.old Sources/${Mod}/*-*.swift Sources/${Mod}/${Module}.swift Sources/${Mod}/Swift${Mod}.swift ${Mod}.xcodeproj
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
# to determine compiler and linker flags
|
||||
#
|
||||
. ./config.sh
|
||||
[ -e Sources/${Mod}/${Module}.swift ] || ./generate-wrapper.sh
|
||||
if [ -z "$@" ]; then
|
||||
JAZZY_ARGS="--theme fullwidth --author René Hexel --author_url https://experts.griffith.edu.au/9237-rene-hexel --github_url https://github.com/rhx/Swift$Mod --github-file-prefix https://github.com/rhx/Swift$Mod/tree/generated --root-url http://rhx.github.io/Swift$Mod/ --output docs"
|
||||
JAZZY_ARGS="--theme fullwidth --author René Hexel --author_url https://experts.griffith.edu.au/9237-rene-hexel --github_url https://github.com/rhx/Swift$Mod --github-file-prefix https://github.com/rhx/Swift$Mod/tree/gtk4-generated --root-url http://rhx.github.io/Swift$Mod/ --output docs"
|
||||
fi
|
||||
[ -e "$BUILD_DIR/build.db" ] || ./build.sh
|
||||
rm -rf .docs.old
|
||||
|
@ -16,4 +15,3 @@ sourcekitten doc --spm --module-name $Mod -- --build-path "$BUILD_DIR" \
|
|||
$CCFLAGS $LINKFLAGS > "$BUILD_DIR/$Mod-doc.json"
|
||||
jazzy --sourcekitten-sourcefile "$BUILD_DIR/$Mod-doc.json" --clean \
|
||||
--module-version $JAZZY_VER --module $Mod $JAZZY_ARGS "$@"
|
||||
rm -f .build 2>/dev/null
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Recursive swift code wrapper generator for gobject-introspection (.gir) files.
|
||||
# This calls the non-recursive gir-to-swift.sh to do the heavy lifting.
|
||||
#
|
||||
. ./config.sh
|
||||
./package.sh update
|
||||
if [ ! -x "${GIR2SWIFT_PATH}/gir2swift" ] &&
|
||||
! pushd "$BUILD_DIR/gir2swift" >/dev/null 2>&1 ; then
|
||||
mkdir -p "$BUILD_DIR"
|
||||
pushd "$BUILD_DIR" >/dev/null
|
||||
git clone https://github.com/rhx/gir2swift.git
|
||||
cd gir2swift && ./build.sh
|
||||
fi
|
||||
export PATH=`pwd`/.build/debug:${PATH}
|
||||
popd >/dev/null 2>&1
|
||||
export PACKAGES="${BUILD_DIR}/checkouts"
|
||||
[ -e $PACKAGES ] || export PACKAGES=Packages
|
||||
if which parallel >/dev/null ; then
|
||||
for gen in $PACKAGES/*/gir-to-swift.sh ; do \
|
||||
echo echo \"Generate Swift Wrapper for `basename $(dirname $gen) | cut -d- -f1`\" \; \
|
||||
"( cd `dirname $gen` && ./`basename $gen` $@ )" ; \
|
||||
done | $TAC | parallel
|
||||
else
|
||||
for gen in $PACKAGES/*/gir-to-swift.sh ; do
|
||||
echo "Generate Swift Wrapper for `basename $(dirname $gen) | cut -d- -f1`"
|
||||
( cd `dirname $gen` && ./`basename $gen` "$@" )
|
||||
done
|
||||
fi
|
||||
. ./gir-to-swift.sh "$@"
|
|
@ -1,37 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Swift code wrapper generator for gobject-introspection (.gir) files.
|
||||
# This needs an installed `gir2swift' executable (github.com/rhx/gir2swift)
|
||||
#
|
||||
. ./config.sh
|
||||
mkdir -p Sources/${Mod}
|
||||
GOBJECT_LIBDIR=`pkg-config --libs-only-L gobject-introspection-1.0 2>/dev/null | tr ' ' '\n' | grep gobject-introspection | tail -n1 | cut -c3-`
|
||||
GOBJECT_DIR=`dirname "${GOBJECT_LIBDIR}"`
|
||||
for prefix in $PREFIX GOBJECT_DIR /usr/local /usr ; do
|
||||
gir_dir=${prefix}/share/gir-1.0
|
||||
gir=${gir_dir}/${Module}.gir
|
||||
if [ -e "${gir}" ] ; then
|
||||
export GIR=${gir}
|
||||
export GIR_DIR=${gir_dir}
|
||||
fi
|
||||
done
|
||||
if [ ! -e "${GIR}" ] ; then
|
||||
echo "*** ${GIR} does not exist!"
|
||||
echo "Make sure libgirepository1.0-dev is installed"
|
||||
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
|
|
@ -0,0 +1,5 @@
|
|||
version: 1
|
||||
gir-name: Gdk-4.0
|
||||
pkg-config: gtk4
|
||||
output-directory: Sources/Gdk
|
||||
alpha-names: true
|
1
test.sh
1
test.sh
|
@ -4,5 +4,4 @@
|
|||
# that the swift wrapper code exists
|
||||
#
|
||||
. ./config.sh
|
||||
[ -e Sources/${Mod}/${Module}.swift ] || ./generate-wrapper.sh
|
||||
exec swift test --build-path "$BUILD_DIR" $CCFLAGS $LINKFLAGS "$@"
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
# and pass them to subprojects, based on the configured -I flags.
|
||||
#
|
||||
. ./config.sh
|
||||
[ -e Sources/${Mod}/${Module}.swift ] || ./generate-wrapper.sh
|
||||
./package.sh generate-xcodeproj "$@"
|
||||
[ ! -e ${Mod}.xcodeproj/Configs ] || \
|
||||
( cd ${Mod}.xcodeproj/Configs && \
|
||||
|
|
Loading…
Reference in New Issue