Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge signal generation and other features #2

Closed
wants to merge 9 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@ let package = Package(
name: "GIO",
products: [ .library(name: "GIO", targets: ["GIO"]) ],
dependencies: [
.package(name: "GLibObject", url: "https://github.com/rhx/SwiftGObject.git", .branch("master"))
.package(name: "gir2swift", url: "https://github.com/mikolasstuchlik/gir2swift.git", .branch("master")),
.package(name: "GLibObject", url: "https://github.com/mikolasstuchlik/SwiftGObject.git", .branch("master"))
],
targets: [
.target(name: "GIO", dependencies: ["GLibObject"]),
8 changes: 0 additions & 8 deletions build.sh

This file was deleted.

6 changes: 0 additions & 6 deletions clean.sh

This file was deleted.

31 changes: 0 additions & 31 deletions config.sh

This file was deleted.

7 changes: 0 additions & 7 deletions distclean.sh

This file was deleted.

19 changes: 0 additions & 19 deletions generate-documentation.sh

This file was deleted.

30 changes: 0 additions & 30 deletions generate-wrapper.sh

This file was deleted.

60 changes: 0 additions & 60 deletions gir-to-swift.sh

This file was deleted.

64 changes: 64 additions & 0 deletions gir2swift-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

GIR_NAME="Gio-2.0"
FILE_NAME="Gio"

function generate_arg-path_arg-g2s-exec_arg-gir-pre_arg-gir-path {
local PACKAGE_PATH=$1
local G2S_EXEC=$2
local GIR_PRE=$3
local GIR_PATH=$4

local CALLER=$PWD

cd $PACKAGE_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} -o Sources/${NAME} -m ${GIR_NAME}.module ${GIR_PRE_ARGS} ${GIR_PATH}/${GIR_NAME}.gir"

for src in Sources/${NAME}/*-*.swift ; do
sed -f ${GIR_NAME}.sed < ${src} > ${src}.out
mv -f ${src}.out ${src}
for ver in 2.60.0 ; do
if pkg-config --max-version=$ver glib-2.0 ; then
sed -f ${GIR_NAME}-$ver.sed < ${src} | \
awk -f ${GIR_NAME}-$ver.awk > ${src}.out
mv -f ${src}.out ${src}
fi
done
for ver in 2.62.0 ; do
if pkg-config --atleast-version=$ver glib-2.0 ; then
sed -f ${GIR_NAME}-$ver.sed < ${src} > ${src}.out
mv -f ${src}.out ${src}
fi
done
done
touch Sources/${NAME}/${GIR_NAME}.swift
echo > Sources/${NAME}/Swift${FILE_NAME}.swift "import CGLib"
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift "import GLib"
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift "import GLibObject"
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift ""
grep -h 'public protocol' Sources/${NAME}/*-*.swift | cut -d' ' -f3 | cut -d: -f1 | sort -u | sed -e 's/^\(.*\)/public typealias _gio_\1 = \1/' >> Sources/${NAME}/Swift${FILE_NAME}.swift
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift ""
grep -h '^open class' Sources/${NAME}/*-*.swift | cut -d' ' -f3 | cut -d: -f1 | sort -u | sed -e 's/^\(.*\)/public typealias _gio_\1 = \1/' >> Sources/${NAME}/Swift${FILE_NAME}.swift
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift ""
grep -h '^public struct' Sources/${NAME}/*-bitfields.swift | cut -d' ' -f3 | cut -d: -f1 | sort -u | sed -e 's/^\(.*\)/public typealias _gio_\1 = \1/' >> Sources/${NAME}/Swift${FILE_NAME}.swift
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift ""
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift "public struct Gio {"
grep -h 'public protocol' Sources/${NAME}/*-*.swift | cut -d' ' -f3 | cut -d: -f1 | sort -u | sed -e 's/^\(.*\)/ public typealias \1 = _gio_\1/' >> Sources/${NAME}/Swift${FILE_NAME}.swift
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift ""
grep -h '^open class' Sources/${NAME}/*-*.swift | cut -d' ' -f3 | cut -d: -f1 | sort -u | sed -e 's/^\(.*\)/ public typealias \1 = _gio_\1/' >> Sources/${NAME}/Swift${FILE_NAME}.swift
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift ""
grep -h '^public typealias' Sources/${NAME}/*-*.swift | sed 's/^/ /' >> Sources/${NAME}/Swift${FILE_NAME}.swift
grep -h '^public struct' Sources/${NAME}/*-bitfields.swift | cut -d' ' -f3 | cut -d: -f1 | sort -u | sed -e 's/^\(.*\)/ public typealias \1 = _gio_\1/' >> Sources/${NAME}/Swift${FILE_NAME}.swift
echo >> Sources/${NAME}/Swift${FILE_NAME}.swift "}"

cd $CALLER
}

case $1 in
gir-name) echo $GIR_NAME;;
generate) echo $(generate_arg-path_arg-g2s-exec_arg-gir-pre_arg-gir-path "$2" "$3" "$4" "$5");;
esac
7 changes: 0 additions & 7 deletions package.sh

This file was deleted.

16 changes: 16 additions & 0 deletions run-gir2swift.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

## Swift package with fetched dependencies is required to run scipt in gir2swift package. Use option -noUpdate to prevent update.
if ! [[ $@ == *'-noUpdate'* ]]
then
swift package update
fi

case $1 in
## Returns flags needed for macOS compilation (experimental)
flags) .build/checkouts/gir2swift/gir2swift-generation-driver.sh c-flags $PWD ;;
## Removes all generaed files
clean) .build/checkouts/gir2swift/gir2swift-generation-driver.sh remove-generated $PWD ;;
## Defaults to generation
*) .build/checkouts/gir2swift/gir2swift-generation-driver.sh generate $PWD ;;
esac
8 changes: 0 additions & 8 deletions test.sh

This file was deleted.

23 changes: 0 additions & 23 deletions xcodegen.sh

This file was deleted.