Commit edbf9aaec5294f0ccf4b93bdcaa4eab1fa7d7ef7

Authored by Perry Werneck
Committed by GitHub
2 parents abc94626 1eb41489
Exists in develop

Merge pull request #67 from PerryWerneck/develop

Fixing bundlers and macos builds.
.github/workflows/macos.yml 0 → 100644
@@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
  1 +name: check-macos
  2 +on:
  3 + push:
  4 + branches: [ "macos" ]
  5 + pull_request:
  6 + branches: [ "master" ]
  7 +
  8 +jobs:
  9 + macos-build:
  10 + runs-on: macos-latest
  11 + steps:
  12 + - name: Checkout
  13 + uses: actions/checkout@v3
  14 + - name: Install Pre reqs
  15 + run: |
  16 + brew remove azure-cli
  17 + find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
  18 + find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
  19 + rm -rf /usr/local/bin/2to3*
  20 + rm -rf /usr/local/bin/idle3*
  21 + rm -rf /usr/local/bin/pydoc3*
  22 + rm -rf /usr/local/bin/python3
  23 + rm -rf /usr/local/bin/python3-config
  24 + rm -rf /usr/local/bin/python3*
  25 + rm -rf /usr/local/bin/python3*-config
  26 + find /usr/local/lib/node_modules/npm -delete
  27 + brew update
  28 + brew install xz automake libtool binutils coreutils curl gettext libtool openssl pkgconfig gtk+3
  29 + - uses: robinraju/release-downloader@v1.7
  30 + with:
  31 + repository: "PerryWerneck/lib3270"
  32 + latest: true
  33 + fileName: "macos-lib3270.tar.xz"
  34 + - uses: robinraju/release-downloader@v1.7
  35 + with:
  36 + repository: "PerryWerneck/libv3270"
  37 + latest: true
  38 + fileName: "macos-libv3270.tar.xz"
  39 + - name: build
  40 + run: ./mac/ci-build.sh
  41 +
.github/workflows/msys2.yml
1 -name: MSYS2 1 +name: check-msys2
2 on: 2 on:
3 - pull_request:  
4 - branches:  
5 - - master  
6 push: 3 push:
7 - branches:  
8 - - develop 4 + branches: [ "win" ]
  5 + pull_request:
  6 + branches: [ "master" ]
  7 +
9 jobs: 8 jobs:
10 - msys2-mingw:  
11 - name: Publish Windows 64 9 + msys2-build:
12 runs-on: windows-latest 10 runs-on: windows-latest
13 defaults: 11 defaults:
14 run: 12 run:
15 shell: msys2 {0} 13 shell: msys2 {0}
16 steps: 14 steps:
17 - uses: actions/checkout@v3 15 - uses: actions/checkout@v3
18 - - uses: oprypin/find-latest-tag@v1  
19 - id: gettag  
20 - with:  
21 - repository: PerryWerneck/pw3270  
22 - releases-only: true  
23 - uses: msys2/setup-msys2@v2 16 - uses: msys2/setup-msys2@v2
24 with: 17 with:
25 msystem: mingw64 18 msystem: mingw64
@@ -36,6 +29,9 @@ jobs: @@ -36,6 +29,9 @@ jobs:
36 latest: true 29 latest: true
37 fileName: "mingw-w64-x86_64-libv3270-5.4-0-x86_64.pkg.tar.zst" 30 fileName: "mingw-w64-x86_64-libv3270-5.4-0-x86_64.pkg.tar.zst"
38 - name: CI-Build 31 - name: CI-Build
39 - run: ./win/ci-build.sh 32 + run: |
  33 + pacman -U --noconfirm *.pkg.tar.zst
  34 + dos2unix PKGBUILD.mingw
  35 + makepkg BUILDDIR=/tmp/pkg -p PKGBUILD.mingw
40 36
41 37
.github/workflows/publish.yml 0 → 100644
@@ -0,0 +1,140 @@ @@ -0,0 +1,140 @@
  1 +name: Publish
  2 +on:
  3 + push:
  4 + branches: [ "publish" ]
  5 + tags: [ "*" ]
  6 +
  7 +jobs:
  8 + msys2-publish:
  9 + runs-on: windows-latest
  10 + defaults:
  11 + run:
  12 + shell: msys2 {0}
  13 + steps:
  14 + - uses: actions/checkout@v3
  15 + - uses: msys2/setup-msys2@v2
  16 + with:
  17 + msystem: mingw64
  18 + update: true
  19 + install: dos2unix mingw-w64-x86_64-gcc automake autoconf make git zip pkgconf mingw-w64-x86_64-gettext gettext-devel mingw-w64-x86_64-openssl libtool mingw-w64-x86_64-gtk3 mingw-w64-x86_64-imagemagick mingw-w64-x86_64-optipng mingw-w64-x86_64-inkscape mingw-w64-x86_64-nsis
  20 + - uses: robinraju/release-downloader@v1.7
  21 + with:
  22 + repository: "PerryWerneck/lib3270"
  23 + latest: true
  24 + fileName: "mingw-w64-x86_64-lib3270-5.4-0-x86_64.pkg.tar.zst"
  25 + - uses: robinraju/release-downloader@v1.7
  26 + with:
  27 + repository: "PerryWerneck/libv3270"
  28 + latest: true
  29 + fileName: "mingw-w64-x86_64-libv3270-5.4-0-x86_64.pkg.tar.zst"
  30 + - uses: robinraju/release-downloader@v1.7
  31 + with:
  32 + repository: PerryWerneck/libipc3270
  33 + latest: true
  34 + fileName: mingw-w64-x86_64-libipc3270-5.5-0-x86_64.pkg.tar.zst
  35 + - uses: robinraju/release-downloader@v1.7
  36 + with:
  37 + repository: PerryWerneck/libhllapi
  38 + latest: true
  39 + fileName: mingw-w64-x86_64-libhllapi-5.5-0-x86_64.pkg.tar.zst
  40 + - uses: robinraju/release-downloader@v1.7
  41 + with:
  42 + repository: PerryWerneck/pw3270-plugin-ipc
  43 + latest: true
  44 + fileName: mingw-w64-x86_64-pw3270-plugin-ipc-5.5-0-x86_64.pkg.tar.zst
  45 + - name: MakePackage
  46 + run: |
  47 + pacman -U --noconfirm *.pkg.tar.zst
  48 + dos2unix PKGBUILD.mingw
  49 + makepkg BUILDDIR=/tmp/pkg -p PKGBUILD.mingw
  50 + - uses: oprypin/find-latest-tag@v1
  51 + id: gettag
  52 + with:
  53 + repository: PerryWerneck/pw3270
  54 + sort-tags: true
  55 + releases-only: true
  56 + - uses: ncipollo/release-action@v1
  57 + with:
  58 + tag: ${{ steps.gettag.outputs.tag }}
  59 + artifacts: "*-pw3270-5*.pkg.tar.zst"
  60 + allowUpdates: true
  61 + draft: true
  62 + makeLatest: true
  63 + omitBody: true
  64 + omitPrereleaseDuringUpdate: true
  65 + replacesArtifacts: true
  66 + - name: Make bundle
  67 + run: |
  68 + ./autogen.sh
  69 + ./win/bundle.msys --nsi --zip
  70 + find . -iname '*.exe'
  71 + find . -iname '*.zip'
  72 + - uses: ncipollo/release-action@v1
  73 + with:
  74 + tag: ${{ steps.gettag.outputs.tag }}
  75 + artifacts: "*.zip"
  76 + allowUpdates: true
  77 + draft: true
  78 + makeLatest: true
  79 + omitBody: true
  80 + omitPrereleaseDuringUpdate: true
  81 + replacesArtifacts: true
  82 + - uses: ncipollo/release-action@v1
  83 + with:
  84 + tag: ${{ steps.gettag.outputs.tag }}
  85 + artifacts: "pw3270-5*.exe"
  86 + allowUpdates: true
  87 + draft: true
  88 + makeLatest: true
  89 + omitBody: true
  90 + omitPrereleaseDuringUpdate: true
  91 + replacesArtifacts: true
  92 + macos-publish:
  93 + runs-on: macos-latest
  94 + steps:
  95 + - name: Checkout
  96 + uses: actions/checkout@v3
  97 + - name: Install Pre reqs
  98 + run: |
  99 + brew remove azure-cli
  100 + find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
  101 + find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
  102 + rm -rf /usr/local/bin/2to3*
  103 + rm -rf /usr/local/bin/idle3*
  104 + rm -rf /usr/local/bin/pydoc3*
  105 + rm -rf /usr/local/bin/python3
  106 + rm -rf /usr/local/bin/python3-config
  107 + rm -rf /usr/local/bin/python3*
  108 + rm -rf /usr/local/bin/python3*-config
  109 + find /usr/local/lib/node_modules/npm -delete
  110 + brew update
  111 + brew install xz automake libtool binutils coreutils curl gettext libtool openssl pkgconfig gtk+3
  112 + - uses: robinraju/release-downloader@v1.7
  113 + with:
  114 + repository: "PerryWerneck/lib3270"
  115 + latest: true
  116 + fileName: "macos-lib3270.tar.xz"
  117 + - uses: robinraju/release-downloader@v1.7
  118 + with:
  119 + repository: "PerryWerneck/libv3270"
  120 + latest: true
  121 + fileName: "macos-libv3270.tar.xz"
  122 + - name: build
  123 + run: ./mac/ci-build.sh
  124 + - uses: oprypin/find-latest-tag@v1
  125 + id: gettag
  126 + with:
  127 + repository: PerryWerneck/pw3270
  128 + sort-tags: true
  129 + releases-only: true
  130 + - uses: ncipollo/release-action@v1
  131 + with:
  132 + tag: ${{ steps.gettag.outputs.tag }}
  133 + artifacts: "macos-pw3270.tar.xz"
  134 + allowUpdates: true
  135 + draft: false
  136 + makeLatest: true
  137 + omitBody: true
  138 + omitPrereleaseDuringUpdate: true
  139 + replacesArtifacts: true
  140 +
.github/workflows/winpkg.yml
@@ -1,84 +0,0 @@ @@ -1,84 +0,0 @@
1 ----  
2 -name: WinPKG  
3 -on:  
4 - pull_request:  
5 - branches:  
6 - - master  
7 - push:  
8 - branches:  
9 - - winpkg  
10 -jobs:  
11 - msys2-mingw64:  
12 - name: Publish for Windows 64  
13 - runs-on: windows-latest  
14 - defaults:  
15 - run:  
16 - shell: msys2 {0}  
17 - steps:  
18 - - uses: actions/checkout@v3  
19 - - uses: oprypin/find-latest-tag@v1  
20 - id: gettag  
21 - with:  
22 - repository: PerryWerneck/pw3270  
23 - sort-tags: true  
24 - releases-only: true  
25 - - uses: msys2/setup-msys2@v2  
26 - with:  
27 - msystem: mingw64  
28 - update: true  
29 - install: xz dos2unix mingw-w64-x86_64-gcc automake autoconf make git pkgconf  
30 - mingw-w64-x86_64-gettext gettext-devel mingw-w64-x86_64-openssl  
31 - libtool mingw-w64-x86_64-gtk3 mingw-w64-x86_64-librsvg mingw-w64-x86_64-gdk-pixbuf2  
32 - mingw-w64-x86_64-optipng mingw-w64-x86_64-nsis  
33 - - uses: robinraju/release-downloader@v1.7  
34 - with:  
35 - repository: "PerryWerneck/lib3270"  
36 - latest: true  
37 - fileName: "mingw-w64-x86_64-lib3270-5.4-0-x86_64.pkg.tar.zst"  
38 - - uses: robinraju/release-downloader@v1.7  
39 - with:  
40 - repository: "PerryWerneck/libv3270"  
41 - latest: true  
42 - fileName: "mingw-w64-x86_64-libv3270-5.4-0-x86_64.pkg.tar.zst"  
43 - - name: BuildApp  
44 - run: ./win/ci-build.sh  
45 - - uses: ncipollo/release-action@v1  
46 - with:  
47 - tag: ${{ steps.gettag.outputs.tag }}  
48 - artifacts: "*-pw3270-*.pkg.tar.zst"  
49 - allowUpdates: true  
50 - draft: true  
51 - makeLatest: true  
52 - omitBody: true  
53 - omitPrereleaseDuringUpdate: true  
54 - replacesArtifacts: true  
55 - - uses: robinraju/release-downloader@v1.7  
56 - with:  
57 - repository: PerryWerneck/libipc3270  
58 - latest: true  
59 - fileName: mingw-w64-x86_64-libipc3270-5.5-0-x86_64.pkg.tar.zst  
60 - - uses: robinraju/release-downloader@v1.7  
61 - with:  
62 - repository: PerryWerneck/libhllapi  
63 - latest: true  
64 - fileName: mingw-w64-x86_64-libhllapi-5.5-0-x86_64.pkg.tar.zst  
65 - - uses: robinraju/release-downloader@v1.7  
66 - with:  
67 - repository: PerryWerneck/pw3270-plugin-ipc  
68 - latest: true  
69 - fileName: mingw-w64-x86_64-pw3270-plugin-ipc-5.5-0-x86_64.pkg.tar.zst  
70 - - name: Make bundle  
71 - run: ./win/bundle.msys  
72 - - name: Make Package  
73 - run: tar -C ./.bin/bundle -Jcf mingw-w64-x86_64-pw3270-bundle-x86_64.tar.xz .  
74 - - uses: ncipollo/release-action@v1  
75 - with:  
76 - tag: ${{ steps.gettag.outputs.tag }}  
77 - artifacts: "*-pw3270-*.tar.xz"  
78 - allowUpdates: true  
79 - draft: true  
80 - makeLatest: true  
81 - omitBody: true  
82 - omitPrereleaseDuringUpdate: true  
83 - replacesArtifacts: true  
84 -  
PKGBUILD.mingw
@@ -25,7 +25,7 @@ source=() @@ -25,7 +25,7 @@ source=()
25 25
26 pkgver=$(grep AC_INIT "${startdir}/configure.ac" | cut -d[ -f3 | cut -d] -f1) 26 pkgver=$(grep AC_INIT "${startdir}/configure.ac" | cut -d[ -f3 | cut -d] -f1)
27 pkgrel=0 27 pkgrel=0
28 -pkgdesc="TN3270 Access library" 28 +pkgdesc="IBM 3270 Terminal emulator for GTK"
29 url="https://github.com/PerryWerneck/${_realname}" 29 url="https://github.com/PerryWerneck/${_realname}"
30 arch=(i686 x86_64) 30 arch=(i686 x86_64)
31 license=(LGPL-3.0-or-later) 31 license=(LGPL-3.0-or-later)
@@ -38,12 +38,12 @@ conflicts=($pkgname) @@ -38,12 +38,12 @@ conflicts=($pkgname)
38 38
39 prepare() { 39 prepare() {
40 rm -fr "$srcdir/$pkgname" 40 rm -fr "$srcdir/$pkgname"
41 - ln -snf "$startdir" "$srcdir/$pkgname" 41 + mkdir -p "$srcdir/$pkgname"
42 } 42 }
43 43
44 build() { 44 build() {
45 - cd $pkgname  
46 - ./autogen.sh \ 45 + cd "$srcdir/$pkgname"
  46 + ${startdir}/autogen.sh \
47 --prefix=${MINGW_PREFIX} \ 47 --prefix=${MINGW_PREFIX} \
48 --build=${MINGW_CHOST} \ 48 --build=${MINGW_CHOST} \
49 --host=${MINGW_CHOST} \ 49 --host=${MINGW_CHOST} \
@@ -53,10 +53,11 @@ build() { @@ -53,10 +53,11 @@ build() {
53 } 53 }
54 54
55 package() { 55 package() {
56 - cd $pkgname 56 + cd "$srcdir/$pkgname"
57 make DESTDIR="${pkgdir}" install 57 make DESTDIR="${pkgdir}" install
58 install \ 58 install \
59 -Dm644 \ 59 -Dm644 \
60 - "LICENSE" \ 60 + "${startdir}/LICENSE" \
61 "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE" 61 "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
62 } 62 }
  63 +
@@ -10,10 +10,19 @@ cd ${srcdir} @@ -10,10 +10,19 @@ cd ${srcdir}
10 mkdir -p ./scripts 10 mkdir -p ./scripts
11 mkdir -p m4 11 mkdir -p m4
12 12
13 -libtoolize --force 13 +LIBTOOLIZE=$(which libtoolize)
  14 +if [ -z ${LIBTOOLIZE} ]; then
  15 + LIBTOOLIZE=$(which glibtoolize)
  16 +fi
  17 +if [ -z ${LIBTOOLIZE} ]; then
  18 + echo "Can't find libtoolize"
  19 + exit -1
  20 +fi
  21 +
  22 +${LIBTOOLIZE} --force
14 if test $? != 0 ; then 23 if test $? != 0 ; then
15 - echo "libtoolize failed."  
16 - exit -1 24 + echo "libtoolize failed."
  25 + exit -1
17 fi 26 fi
18 27
19 aclocal 28 aclocal
@@ -40,7 +49,7 @@ autopoint @@ -40,7 +49,7 @@ autopoint
40 49
41 cd ${builddir} 50 cd ${builddir}
42 51
43 -test -n "$NOCONFIGURE" || "./configure" "$@" 52 +test -n "$NOCONFIGURE" || "$srcdir/configure" --srcdir=${srcdir} $@
44 53
45 54
46 55
mac/Info.plist 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleExecutable</key>
  6 + <string>launcher.sh</string>
  7 + <key>CFBundleName</key>
  8 + <string>pw3270</string>
  9 + <key>CFBundleDisplayName</key>
  10 + <string>pw3270</string>
  11 + <key>CFBundleIconFile</key>
  12 + <string>pw3270.icns</string>
  13 + <key>CFBundleIdentifier</key>
  14 + <string>br.app.pw3270</string>
  15 + <key>NSHighResolutionCapable</key>
  16 + <true/>
  17 + <key>LSMinimumSystemVersion</key>
  18 + <string>10.13.6</string>
  19 +</dict>
  20 +</plist>
mac/bundle 0 → 100755
@@ -0,0 +1,226 @@ @@ -0,0 +1,226 @@
  1 +#!/usr/bin/env bash
  2 +#@author André Breves <andre.breves@gmail.com>
  3 +set -Eeuo pipefail
  4 +
  5 +check_dependencies() {
  6 + local unavailable=()
  7 + for dependency in "${@:-$(</dev/stdin)}"; do
  8 + if [[ ! -x "$(command -v "${dependency}")" ]]; then unavailable+=("${dependency}"); fi
  9 + done
  10 + if [[ ${#unavailable[@]} == 1 ]]; then
  11 + echo "Dependency '${unavailable[*]}' not found."
  12 + exit 1
  13 + elif [[ ${#unavailable[@]} -gt 1 ]]; then
  14 + error "Dependencies '${unavailable[*]}' not found."
  15 + exit 1
  16 + fi
  17 +}
  18 +
  19 +find_lib() {
  20 + # https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html
  21 + local libs_path="${HOME}/lib $(brew --prefix)/lib /usr/lib"
  22 + for lib in "${@:-$(</dev/stdin)}"; do
  23 + local found=""
  24 + if [[ -f "${lib}" ]]; then
  25 + found="$(greadlink -m "${lib}")"
  26 + else
  27 + for path in ${libs_path}; do
  28 + if [[ -f "${path}/${lib}" ]]; then
  29 + found="$(greadlink -m "${path}/${lib}")"
  30 + break
  31 + fi
  32 + done
  33 + fi
  34 + if [[ "${found}" != "" ]]; then
  35 + echo "${found}"
  36 + else
  37 + echo >&2 "Lib ${lib} not found"
  38 + exit 1
  39 + fi
  40 + done
  41 +}
  42 +
  43 +bundle_cp() {
  44 + local system_libs='^(/System/.*|/usr/lib/.*)$'
  45 +
  46 + for source in "${@:-$(</dev/stdin)}"; do
  47 + source="$(greadlink -m "${source}")"
  48 +
  49 + if [[ "${source}" =~ ${system_libs} ]]; then continue; fi
  50 +
  51 + if [[ ! -f "${source}" ]]; then
  52 + echo >&2 "File \"${source}\" not found"
  53 + exit 1
  54 + fi
  55 +
  56 + local id=""
  57 + local target=""
  58 + local file_type
  59 + file_type="$(file -b "${source}")"
  60 + case "${file_type}" in
  61 + *executable*)
  62 + target="$(greadlink -m "${exe_path}/$(basename "${source}")")";;
  63 + *)
  64 + id="@rpath/$(basename "${source}")"
  65 + target="$(greadlink -m "${lib_path}/$(basename "${source}")")";;
  66 + esac
  67 +
  68 + if [[ "${id}" != "" ]]; then echo "${id}"; fi
  69 +
  70 + if [[ -f "${target}" ]]; then continue; fi
  71 +
  72 + mkdir -p "$(dirname "${target}")"
  73 + cp "${source}" "${target}"
  74 + chmod u+w "${target}"
  75 +
  76 + if [[ "${id}" != "" ]]; then install_name_tool -id "${id}" "${target}" 2> /dev/null; fi
  77 + install_name_tool -add_rpath "@executable_path/../Frameworks" "${target}" 2> /dev/null
  78 +
  79 + for old_install_name in $(otool -L "${target}" | grep '^\t' | cut -c 2- | sed -n "s/\(.*\) (.*)/\1/p"); do
  80 + if [[ "${old_install_name}" == "${id}" ]]; then continue; fi
  81 + if [[ "${old_install_name}" =~ ${system_libs} ]]; then continue; fi
  82 + local lib
  83 + if [[ "${old_install_name}" =~ ^@loader_path.* ]]; then
  84 + lib="$(find_lib "$(dirname "${source}")/${old_install_name//@loader_path/}")"
  85 + else
  86 + lib="$(find_lib "${old_install_name}")"
  87 + fi
  88 + local new_install_name="$(bundle_cp "${lib}")"
  89 + if [[ "${new_install_name}" != "" ]]; then
  90 + install_name_tool -change "${old_install_name}" "${new_install_name}" "${target}" 2> /dev/null
  91 + fi
  92 + done
  93 + # https://stackoverflow.com/a/71753248/6910609
  94 + codesign --force -s - "${target}" 2> /dev/null
  95 + echo >&2 "${target}"
  96 + done
  97 +}
  98 +
  99 +bundle_cache() {
  100 + local awaiting_file=1;
  101 + while IFS= read -r line; do
  102 + if (( awaiting_file )); then
  103 + if [[ ! "${line}" =~ ^"#" && "${line}" != "" ]]; then
  104 + line="${line##\ }"
  105 + line="${line#\"}"
  106 + line="${line%%\ }"
  107 + line="${line%\"}"
  108 + line="\"$(bundle_cp "${line}")\""
  109 + awaiting_file=0
  110 + fi
  111 + else
  112 + if [[ "${line}" == "" ]]; then
  113 + awaiting_file=1
  114 + fi
  115 + fi
  116 + printf '%s\n' "${line}"
  117 + done
  118 +}
  119 +
  120 +# Check dependencies
  121 +check_dependencies otool grep cut sed greadlink qlmanage sips iconutil
  122 +
  123 +# Creates temporary directory
  124 +echo "* Creating temporary directory"
  125 +tmp="$(mktemp -d)"
  126 +trap 'echo "* Removing temporary directory \"${tmp}\""; rm -rf "${tmp}"' EXIT
  127 +
  128 +bundle="pw3270.app"
  129 +bundle_path="${bundle}/Contents"
  130 +exe_path="${bundle_path}/MacOS"
  131 +lib_path="${bundle_path}/Frameworks"
  132 +res_path="${bundle_path}/Resources"
  133 +
  134 +rm -fr "${bundle}"
  135 +
  136 +mkdir -p "${bundle_path}"
  137 +cp "Info.plist" "${bundle_path}"
  138 +
  139 +mkdir -p "${res_path}"
  140 +cp -r "../ui/macos.ui.xml" "${res_path}/pw3270.ui.xml"
  141 +cp -r "$(brew --prefix)/share/pw3270/remap" "${res_path}"
  142 +cp "$(brew --prefix)/share/pw3270/colors.conf" "${res_path}"
  143 +
  144 +# Bundle GLib schemas
  145 +echo "* Bundling GLib schemas"
  146 +mkdir -p "${tmp}/schemas"
  147 +cp "../schemas/"*".gschema.xml" "${tmp}/schemas"
  148 +cp "$(pkg-config gtk+-3.0 --variable=prefix)/share/glib-2.0/schemas/org.gtk.Settings."*".gschema.xml" "${tmp}/schemas"
  149 +glib-compile-schemas --targetdir="${res_path}" "${tmp}/schemas"
  150 +
  151 +# Create the GTK settings file
  152 +# https://developer.gnome.org/gtk3/stable/GtkSettings.html
  153 +mkdir -p "${res_path}/gtk-3.0"
  154 +cat > "${res_path}/gtk-3.0/settings.ini" << EOF
  155 +[Settings]
  156 +gtk-theme-name=Adwaita
  157 +gtk-print-preview-command="open -b com.apple.Preview %f"
  158 +EOF
  159 +
  160 +# Make icon bundle
  161 +echo "* Creating app icon bundle"
  162 +iconset="${tmp}/pw3270.iconset"
  163 +rm -fr "${iconset}"
  164 +mkdir -p "${iconset}"
  165 +icon_sizes=("16" "32" "64" "128" "256" "512" "1024")
  166 +for ((i=1; i < ${#icon_sizes[*]}; i++)); do
  167 + size=${icon_sizes[$((i - 1))]}
  168 + convert -density "${size}" -resize "${size}x" -background transparent "../branding/pw3270.svg" "${iconset}/icon_${size}x${size}.png"
  169 +
  170 + size2x=${icon_sizes[${i}]}
  171 + convert -density "${size2x}" -resize "${size2x}x" -background transparent "../branding/pw3270.svg" "${iconset}/icon_${size}x${size}@2x.png"
  172 +done
  173 +iconutil -c icns -o "${res_path}/pw3270.icns" "${iconset}"
  174 +
  175 +
  176 +# Copy icons
  177 +echo "* Copying icons"
  178 +mkdir -p "${res_path}/icons"
  179 +cp -r "$(brew --prefix adwaita-icon-theme)/share/icons/" "${res_path}/icons"
  180 +cp -r "$(brew --prefix hicolor-icon-theme)/share/icons/" "${res_path}/icons"
  181 +mogrify -format png -path "${res_path}" -background transparent "../branding/*.svg"
  182 +
  183 +# Copy themes
  184 +echo "* Copying themes"
  185 +mkdir -p "${res_path}/themes"
  186 +cp -a "$(brew --prefix gtk+3)/share/themes/Mac" "${res_path}/themes"
  187 +
  188 +# Copy mime database
  189 +echo "* Copying mime database"
  190 +mkdir -p "${res_path}/mime"
  191 +cp "$(pkg-config shared-mime-info --variable=prefix)/share/mime/mime.cache" "${res_path}/mime"
  192 +
  193 +# Copy executables
  194 +echo "* Copying executables"
  195 +mkdir -p "${exe_path}"
  196 +bundle_cp "../.bin/Release/pw3270"
  197 +cp "launcher.sh" "${exe_path}"
  198 +
  199 +# Bundle GdkPixbuf Image Loader Modules
  200 +echo "* Bundling GdkPixbuf Image Loader Modules"
  201 +gdk-pixbuf-query-loaders | bundle_cache > "${res_path}/gdk-loaders.cache"
  202 +
  203 +# Bundle GTK+ Input Method Modules
  204 +echo "* Bundling GTK+ Input Method Modules"
  205 +gtk_prefix="$(pkg-config gtk+-3.0 --variable prefix)"
  206 +gtk-query-immodules-3.0 | bundle_cache \
  207 + | sed "s|${gtk_prefix}/share/locale|@executable_path/../Resources/locale|g" \
  208 + > "${res_path}/gtk.immodules"
  209 +
  210 +# Bundle print backends
  211 +echo "* Bundling print backends"
  212 +mkdir -p "${lib_path}/printbackends"
  213 +for backend in "$(pkg-config gtk+-3.0 --variable=prefix)/lib/gtk-3.0/$(pkg-config gtk+-3.0 --variable=gtk_binary_version)/printbackends/"*.so; do
  214 + bundle_cp "${backend}"
  215 + # TODO: update bundle_cp to inform destiny dir
  216 + mv "${lib_path}/$(basename "${backend}")" "${lib_path}/printbackends"
  217 +done
  218 +
  219 +# TODO: gerar o Info.plist com a versão do macOS $(sw_vers -productVersion)
  220 +
  221 +# Bundle locale
  222 +echo "* Bundling locale"
  223 +mkdir -p "${res_path}/locale"
  224 +cp -r "../.bin/locale/" "${res_path}/locale"
  225 +cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/lib3270"*".mo" "${res_path}/locale/pt_BR/LC_MESSAGES"
  226 +cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/libv3270"*".mo" "${res_path}/locale/pt_BR/LC_MESSAGES"
mac/ci-build.sh 0 → 100755
@@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
  1 +#!/bin/bash
  2 +
  3 +PROJECT_NAME=$(grep AC_INIT configure.ac | cut -d[ -f2 | cut -d] -f1)
  4 +VERSION=$(grep AC_INIT configure.ac | cut -d[ -f3 | cut -d] -f1)
  5 +
  6 +unpack() {
  7 +
  8 + echo "Unpacking ${1}"
  9 +
  10 + tar -C $(brew --cellar) -Jxf macos-${1}.tar.xz
  11 + if [ "$?" != "0" ]; then
  12 + exit -1
  13 + fi
  14 +
  15 + brew link ${1}
  16 + if [ "$?" != "0" ]; then
  17 + exit -1
  18 + fi
  19 +
  20 + rm -f macos-${1}.tar.xz
  21 +
  22 +}
  23 +
  24 +unpack lib3270
  25 +unpack libv3270
  26 +
  27 +./autogen.sh --prefix="/${PROJECT_NAME}/${VERSION}"
  28 +if [ "$?" != "0" ]; then
  29 + exit -1
  30 +fi
  31 +
  32 +make all
  33 +if [ "$?" != "0" ]; then
  34 + exit -1
  35 +fi
  36 +
  37 +make DESTDIR=.bin/package install
  38 +tar --create --xz --file=macos-${PROJECT_NAME}.tar.xz --directory=.bin/package --verbose .
  39 +
  40 +find . -iname *.tar.xz
  41 +
  42 +
mac/launcher.sh 0 → 100755
@@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
  1 +#!/usr/bin/env sh
  2 +#@author André Breves <andre.breves@gmail.com>
  3 +set -euo
  4 +
  5 +cd "${0%/*}"
  6 +executable_path="${PWD}"
  7 +cd ..
  8 +contents_path="${PWD}"
  9 +cd Resources
  10 +resource_path="${PWD}"
  11 +
  12 +info_plist="${contents_path}/Info.plist"
  13 +bundle_identifier=$(plutil -extract "CFBundleIdentifier" xml1 -o - "${info_plist}" | sed -n "s/.*<string>\(.*\)<\/string>.*/\1/p")
  14 +
  15 +# XDG Base Directory Specification
  16 +# https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html
  17 +
  18 +# Defines the base directory relative to which user specific configuration files should be stored
  19 +export XDG_CONFIG_HOME="${HOME}/Library/Application Support/${bundle_identifier}"
  20 +
  21 +# Defines the base directory relative to which user specific data files should be stored
  22 +export XDG_DATA_HOME="${HOME}/Library/Application Support/${bundle_identifier}"
  23 +
  24 +# Defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory
  25 +export XDG_DATA_DIRS="${resource_path}"
  26 +
  27 +# Defines the preference-ordered set of base directories to search for configuration files in addition to the $XDG_CONFIG_HOME base directory
  28 +export XDG_CONFIG_DIRS="${resource_path}"
  29 +
  30 +# Defines the base directory relative to which user specific non-essential data files should be stored
  31 +export XDG_CACHE_HOME="${HOME}/Library/Caches/${bundle_identifier}"
  32 +
  33 +
  34 +# Running GTK+ Applications
  35 +# https://developer.gnome.org/gtk3/stable/gtk-running.html
  36 +
  37 +# If set, makes GTK+ use $GTK_DATA_PREFIX instead of the prefix configured when GTK+ was compiled
  38 +export GTK_DATA_PREFIX="${resource_path}"
  39 +
  40 +# Specifies the file listing the Input Method modules to load
  41 +export GTK_IM_MODULE_FILE="${resource_path}/gtk.immodules"
  42 +
  43 +# Specifies the file listing the GdkPixbuf loader modules to load
  44 +export GDK_PIXBUF_MODULE_FILE="${resource_path}/gdk-loaders.cache"
  45 +
  46 +# Specifies a list of directories to search when GTK+ is looking for dynamically loaded objects such as the modules
  47 +# specified by GTK_MODULES, theme engines, input method modules, file system backends and print backends.
  48 +export GTK_PATH="${contents_path}/Frameworks"
  49 +
  50 +# Running GIO applications
  51 +# https://developer.gnome.org/gio/stable/running-gio-apps.html
  52 +
  53 +# This variable can be set to the names of directories to consider when looking for compiled schemas for GSettings
  54 +export GSETTINGS_SCHEMA_DIR="${resource_path}"
  55 +
  56 +# export LANG="pt_BR"
  57 +# export LC_MESSAGES="pt_BR"
  58 +# export LC_ALL="pt_BR"
  59 +
  60 +mkdir -p "${XDG_CONFIG_HOME}"
  61 +mkdir -p "${XDG_DATA_HOME}"
  62 +mkdir -p "${XDG_CACHE_HOME}"
  63 +
  64 +cd "${resource_path}"
  65 +exec "${executable_path}/pw3270"
macos/Info.plist
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
3 -<plist version="1.0">  
4 -<dict>  
5 - <key>CFBundleExecutable</key>  
6 - <string>launcher.sh</string>  
7 - <key>CFBundleName</key>  
8 - <string>pw3270</string>  
9 - <key>CFBundleDisplayName</key>  
10 - <string>pw3270</string>  
11 - <key>CFBundleIconFile</key>  
12 - <string>pw3270.icns</string>  
13 - <key>CFBundleIdentifier</key>  
14 - <string>br.app.pw3270</string>  
15 - <key>NSHighResolutionCapable</key>  
16 - <true/>  
17 - <key>LSMinimumSystemVersion</key>  
18 - <string>10.13.6</string>  
19 -</dict>  
20 -</plist>  
macos/bundle
@@ -1,226 +0,0 @@ @@ -1,226 +0,0 @@
1 -#!/usr/bin/env bash  
2 -#@author André Breves <andre.breves@gmail.com>  
3 -set -Eeuo pipefail  
4 -  
5 -check_dependencies() {  
6 - local unavailable=()  
7 - for dependency in "${@:-$(</dev/stdin)}"; do  
8 - if [[ ! -x "$(command -v "${dependency}")" ]]; then unavailable+=("${dependency}"); fi  
9 - done  
10 - if [[ ${#unavailable[@]} == 1 ]]; then  
11 - echo "Dependency '${unavailable[*]}' not found."  
12 - exit 1  
13 - elif [[ ${#unavailable[@]} -gt 1 ]]; then  
14 - error "Dependencies '${unavailable[*]}' not found."  
15 - exit 1  
16 - fi  
17 -}  
18 -  
19 -find_lib() {  
20 - # https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html  
21 - local libs_path="${HOME}/lib $(brew --prefix)/lib /usr/lib"  
22 - for lib in "${@:-$(</dev/stdin)}"; do  
23 - local found=""  
24 - if [[ -f "${lib}" ]]; then  
25 - found="$(greadlink -m "${lib}")"  
26 - else  
27 - for path in ${libs_path}; do  
28 - if [[ -f "${path}/${lib}" ]]; then  
29 - found="$(greadlink -m "${path}/${lib}")"  
30 - break  
31 - fi  
32 - done  
33 - fi  
34 - if [[ "${found}" != "" ]]; then  
35 - echo "${found}"  
36 - else  
37 - echo >&2 "Lib ${lib} not found"  
38 - exit 1  
39 - fi  
40 - done  
41 -}  
42 -  
43 -bundle_cp() {  
44 - local system_libs='^(/System/.*|/usr/lib/.*)$'  
45 -  
46 - for source in "${@:-$(</dev/stdin)}"; do  
47 - source="$(greadlink -m "${source}")"  
48 -  
49 - if [[ "${source}" =~ ${system_libs} ]]; then continue; fi  
50 -  
51 - if [[ ! -f "${source}" ]]; then  
52 - echo >&2 "File \"${source}\" not found"  
53 - exit 1  
54 - fi  
55 -  
56 - local id=""  
57 - local target=""  
58 - local file_type  
59 - file_type="$(file -b "${source}")"  
60 - case "${file_type}" in  
61 - *executable*)  
62 - target="$(greadlink -m "${exe_path}/$(basename "${source}")")";;  
63 - *)  
64 - id="@rpath/$(basename "${source}")"  
65 - target="$(greadlink -m "${lib_path}/$(basename "${source}")")";;  
66 - esac  
67 -  
68 - if [[ "${id}" != "" ]]; then echo "${id}"; fi  
69 -  
70 - if [[ -f "${target}" ]]; then continue; fi  
71 -  
72 - mkdir -p "$(dirname "${target}")"  
73 - cp "${source}" "${target}"  
74 - chmod u+w "${target}"  
75 -  
76 - if [[ "${id}" != "" ]]; then install_name_tool -id "${id}" "${target}" 2> /dev/null; fi  
77 - install_name_tool -add_rpath "@executable_path/../Frameworks" "${target}" 2> /dev/null  
78 -  
79 - for old_install_name in $(otool -L "${target}" | grep '^\t' | cut -c 2- | sed -n "s/\(.*\) (.*)/\1/p"); do  
80 - if [[ "${old_install_name}" == "${id}" ]]; then continue; fi  
81 - if [[ "${old_install_name}" =~ ${system_libs} ]]; then continue; fi  
82 - local lib  
83 - if [[ "${old_install_name}" =~ ^@loader_path.* ]]; then  
84 - lib="$(find_lib "$(dirname "${source}")/${old_install_name//@loader_path/}")"  
85 - else  
86 - lib="$(find_lib "${old_install_name}")"  
87 - fi  
88 - local new_install_name="$(bundle_cp "${lib}")"  
89 - if [[ "${new_install_name}" != "" ]]; then  
90 - install_name_tool -change "${old_install_name}" "${new_install_name}" "${target}" 2> /dev/null  
91 - fi  
92 - done  
93 - # https://stackoverflow.com/a/71753248/6910609  
94 - codesign --force -s - "${target}" 2> /dev/null  
95 - echo >&2 "${target}"  
96 - done  
97 -}  
98 -  
99 -bundle_cache() {  
100 - local awaiting_file=1;  
101 - while IFS= read -r line; do  
102 - if (( awaiting_file )); then  
103 - if [[ ! "${line}" =~ ^"#" && "${line}" != "" ]]; then  
104 - line="${line##\ }"  
105 - line="${line#\"}"  
106 - line="${line%%\ }"  
107 - line="${line%\"}"  
108 - line="\"$(bundle_cp "${line}")\""  
109 - awaiting_file=0  
110 - fi  
111 - else  
112 - if [[ "${line}" == "" ]]; then  
113 - awaiting_file=1  
114 - fi  
115 - fi  
116 - printf '%s\n' "${line}"  
117 - done  
118 -}  
119 -  
120 -# Check dependencies  
121 -check_dependencies otool grep cut sed greadlink qlmanage sips iconutil  
122 -  
123 -# Creates temporary directory  
124 -echo "* Creating temporary directory"  
125 -tmp="$(mktemp -d)"  
126 -trap 'echo "* Removing temporary directory \"${tmp}\""; rm -rf "${tmp}"' EXIT  
127 -  
128 -bundle="pw3270.app"  
129 -bundle_path="${bundle}/Contents"  
130 -exe_path="${bundle_path}/MacOS"  
131 -lib_path="${bundle_path}/Frameworks"  
132 -res_path="${bundle_path}/Resources"  
133 -  
134 -rm -fr "${bundle}"  
135 -  
136 -mkdir -p "${bundle_path}"  
137 -cp "Info.plist" "${bundle_path}"  
138 -  
139 -mkdir -p "${res_path}"  
140 -cp -r "../ui/macos.ui.xml" "${res_path}/pw3270.ui.xml"  
141 -cp -r "$(brew --prefix)/share/pw3270/remap" "${res_path}"  
142 -cp "$(brew --prefix)/share/pw3270/colors.conf" "${res_path}"  
143 -  
144 -# Bundle GLib schemas  
145 -echo "* Bundling GLib schemas"  
146 -mkdir -p "${tmp}/schemas"  
147 -cp "../schemas/"*".gschema.xml" "${tmp}/schemas"  
148 -cp "$(pkg-config gtk+-3.0 --variable=prefix)/share/glib-2.0/schemas/org.gtk.Settings."*".gschema.xml" "${tmp}/schemas"  
149 -glib-compile-schemas --targetdir="${res_path}" "${tmp}/schemas"  
150 -  
151 -# Create the GTK settings file  
152 -# https://developer.gnome.org/gtk3/stable/GtkSettings.html  
153 -mkdir -p "${res_path}/gtk-3.0"  
154 -cat > "${res_path}/gtk-3.0/settings.ini" << EOF  
155 -[Settings]  
156 -gtk-theme-name=Adwaita  
157 -gtk-print-preview-command="open -b com.apple.Preview %f"  
158 -EOF  
159 -  
160 -# Make icon bundle  
161 -echo "* Creating app icon bundle"  
162 -iconset="${tmp}/pw3270.iconset"  
163 -rm -fr "${iconset}"  
164 -mkdir -p "${iconset}"  
165 -icon_sizes=("16" "32" "64" "128" "256" "512" "1024")  
166 -for ((i=1; i < ${#icon_sizes[*]}; i++)); do  
167 - size=${icon_sizes[$((i - 1))]}  
168 - convert -density "${size}" -resize "${size}x" -background transparent "../branding/pw3270.svg" "${iconset}/icon_${size}x${size}.png"  
169 -  
170 - size2x=${icon_sizes[${i}]}  
171 - convert -density "${size2x}" -resize "${size2x}x" -background transparent "../branding/pw3270.svg" "${iconset}/icon_${size}x${size}@2x.png"  
172 -done  
173 -iconutil -c icns -o "${res_path}/pw3270.icns" "${iconset}"  
174 -  
175 -  
176 -# Copy icons  
177 -echo "* Copying icons"  
178 -mkdir -p "${res_path}/icons"  
179 -cp -r "$(brew --prefix adwaita-icon-theme)/share/icons/" "${res_path}/icons"  
180 -cp -r "$(brew --prefix hicolor-icon-theme)/share/icons/" "${res_path}/icons"  
181 -mogrify -format png -path "${res_path}" -background transparent "../branding/*.svg"  
182 -  
183 -# Copy themes  
184 -echo "* Copying themes"  
185 -mkdir -p "${res_path}/themes"  
186 -cp -a "$(brew --prefix gtk+3)/share/themes/Mac" "${res_path}/themes"  
187 -  
188 -# Copy mime database  
189 -echo "* Copying mime database"  
190 -mkdir -p "${res_path}/mime"  
191 -cp "$(pkg-config shared-mime-info --variable=prefix)/share/mime/mime.cache" "${res_path}/mime"  
192 -  
193 -# Copy executables  
194 -echo "* Copying executables"  
195 -mkdir -p "${exe_path}"  
196 -bundle_cp "../.bin/Release/pw3270"  
197 -cp "launcher.sh" "${exe_path}"  
198 -  
199 -# Bundle GdkPixbuf Image Loader Modules  
200 -echo "* Bundling GdkPixbuf Image Loader Modules"  
201 -gdk-pixbuf-query-loaders | bundle_cache > "${res_path}/gdk-loaders.cache"  
202 -  
203 -# Bundle GTK+ Input Method Modules  
204 -echo "* Bundling GTK+ Input Method Modules"  
205 -gtk_prefix="$(pkg-config gtk+-3.0 --variable prefix)"  
206 -gtk-query-immodules-3.0 | bundle_cache \  
207 - | sed "s|${gtk_prefix}/share/locale|@executable_path/../Resources/locale|g" \  
208 - > "${res_path}/gtk.immodules"  
209 -  
210 -# Bundle print backends  
211 -echo "* Bundling print backends"  
212 -mkdir -p "${lib_path}/printbackends"  
213 -for backend in "$(pkg-config gtk+-3.0 --variable=prefix)/lib/gtk-3.0/$(pkg-config gtk+-3.0 --variable=gtk_binary_version)/printbackends/"*.so; do  
214 - bundle_cp "${backend}"  
215 - # TODO: update bundle_cp to inform destiny dir  
216 - mv "${lib_path}/$(basename "${backend}")" "${lib_path}/printbackends"  
217 -done  
218 -  
219 -# TODO: gerar o Info.plist com a versão do macOS $(sw_vers -productVersion)  
220 -  
221 -# Bundle locale  
222 -echo "* Bundling locale"  
223 -mkdir -p "${res_path}/locale"  
224 -cp -r "../.bin/locale/" "${res_path}/locale"  
225 -cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/lib3270"*".mo" "${res_path}/locale/pt_BR/LC_MESSAGES"  
226 -cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/libv3270"*".mo" "${res_path}/locale/pt_BR/LC_MESSAGES"  
macos/launcher.sh
@@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
1 -#!/usr/bin/env sh  
2 -#@author André Breves <andre.breves@gmail.com>  
3 -set -euo  
4 -  
5 -cd "${0%/*}"  
6 -executable_path="${PWD}"  
7 -cd ..  
8 -contents_path="${PWD}"  
9 -cd Resources  
10 -resource_path="${PWD}"  
11 -  
12 -info_plist="${contents_path}/Info.plist"  
13 -bundle_identifier=$(plutil -extract "CFBundleIdentifier" xml1 -o - "${info_plist}" | sed -n "s/.*<string>\(.*\)<\/string>.*/\1/p")  
14 -  
15 -# XDG Base Directory Specification  
16 -# https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html  
17 -  
18 -# Defines the base directory relative to which user specific configuration files should be stored  
19 -export XDG_CONFIG_HOME="${HOME}/Library/Application Support/${bundle_identifier}"  
20 -  
21 -# Defines the base directory relative to which user specific data files should be stored  
22 -export XDG_DATA_HOME="${HOME}/Library/Application Support/${bundle_identifier}"  
23 -  
24 -# Defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory  
25 -export XDG_DATA_DIRS="${resource_path}"  
26 -  
27 -# Defines the preference-ordered set of base directories to search for configuration files in addition to the $XDG_CONFIG_HOME base directory  
28 -export XDG_CONFIG_DIRS="${resource_path}"  
29 -  
30 -# Defines the base directory relative to which user specific non-essential data files should be stored  
31 -export XDG_CACHE_HOME="${HOME}/Library/Caches/${bundle_identifier}"  
32 -  
33 -  
34 -# Running GTK+ Applications  
35 -# https://developer.gnome.org/gtk3/stable/gtk-running.html  
36 -  
37 -# If set, makes GTK+ use $GTK_DATA_PREFIX instead of the prefix configured when GTK+ was compiled  
38 -export GTK_DATA_PREFIX="${resource_path}"  
39 -  
40 -# Specifies the file listing the Input Method modules to load  
41 -export GTK_IM_MODULE_FILE="${resource_path}/gtk.immodules"  
42 -  
43 -# Specifies the file listing the GdkPixbuf loader modules to load  
44 -export GDK_PIXBUF_MODULE_FILE="${resource_path}/gdk-loaders.cache"  
45 -  
46 -# Specifies a list of directories to search when GTK+ is looking for dynamically loaded objects such as the modules  
47 -# specified by GTK_MODULES, theme engines, input method modules, file system backends and print backends.  
48 -export GTK_PATH="${contents_path}/Frameworks"  
49 -  
50 -# Running GIO applications  
51 -# https://developer.gnome.org/gio/stable/running-gio-apps.html  
52 -  
53 -# This variable can be set to the names of directories to consider when looking for compiled schemas for GSettings  
54 -export GSETTINGS_SCHEMA_DIR="${resource_path}"  
55 -  
56 -# export LANG="pt_BR"  
57 -# export LC_MESSAGES="pt_BR"  
58 -# export LC_ALL="pt_BR"  
59 -  
60 -mkdir -p "${XDG_CONFIG_HOME}"  
61 -mkdir -p "${XDG_DATA_HOME}"  
62 -mkdir -p "${XDG_CACHE_HOME}"  
63 -  
64 -cd "${resource_path}"  
65 -exec "${executable_path}/pw3270"  
@@ -61,6 +61,9 @@ @@ -61,6 +61,9 @@
61 <Unit filename="src/main/linux/tools.c"> 61 <Unit filename="src/main/linux/tools.c">
62 <Option compilerVar="CC" /> 62 <Option compilerVar="CC" />
63 </Unit> 63 </Unit>
  64 + <Unit filename="src/main/macos/tools.c">
  65 + <Option compilerVar="CC" />
  66 + </Unit>
64 <Unit filename="src/main/main.c"> 67 <Unit filename="src/main/main.c">
65 <Option compilerVar="CC" /> 68 <Option compilerVar="CC" />
66 </Unit> 69 </Unit>
src/include/config.h.in
@@ -24,12 +24,12 @@ @@ -24,12 +24,12 @@
24 /* do we have malloc.h? */ 24 /* do we have malloc.h? */
25 #undef HAVE_MALLOC_H 25 #undef HAVE_MALLOC_H
26 26
  27 +/* Define to 1 if you have the <memory.h> header file. */
  28 +#undef HAVE_MEMORY_H
  29 +
27 /* Define to 1 if you have the <stdint.h> header file. */ 30 /* Define to 1 if you have the <stdint.h> header file. */
28 #undef HAVE_STDINT_H 31 #undef HAVE_STDINT_H
29 32
30 -/* Define to 1 if you have the <stdio.h> header file. */  
31 -#undef HAVE_STDIO_H  
32 -  
33 /* Define to 1 if you have the <stdlib.h> header file. */ 33 /* Define to 1 if you have the <stdlib.h> header file. */
34 #undef HAVE_STDLIB_H 34 #undef HAVE_STDLIB_H
35 35
@@ -105,9 +105,7 @@ @@ -105,9 +105,7 @@
105 /* The schema path */ 105 /* The schema path */
106 #undef PRODUCT_PATH 106 #undef PRODUCT_PATH
107 107
108 -/* Define to 1 if all of the C90 standard headers exist (not just the ones  
109 - required in a freestanding environment). This macro is provided for  
110 - backward compatibility; new code need not use it. */ 108 +/* Define to 1 if you have the ANSI C header files. */
111 #undef STDC_HEADERS 109 #undef STDC_HEADERS
112 110
113 /* Version number of package */ 111 /* Version number of package */
src/main/macos/tools.c 0 → 100644
@@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
  1 +/* SPDX-License-Identifier: LGPL-3.0-or-later */
  2 +
  3 +/*
  4 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  5 + *
  6 + * This program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published
  8 + * by the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License
  17 + * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18 + */
  19 +
  20 + #include <config.h>
  21 + #include <pw3270.h>
  22 + #include <sys/syslimits.h>
  23 + #include <CoreFoundation/CFBundle.h>
  24 + #include <CoreFoundation/CFURL.h>
  25 +
  26 + static gchar * get_path_from_bundle(const char *name, GFileTest test) {
  27 +
  28 + size_t szBuffer = PATH_MAX;
  29 + char buffer[PATH_MAX+1];
  30 + memset(buffer,0,PATH_MAX+1);
  31 +
  32 + CFBundleRef mainBundle = CFBundleGetMainBundle();
  33 +
  34 + if (mainBundle) {
  35 +
  36 + CFURLRef url = CFBundleCopyBundleURL(mainBundle);
  37 +
  38 + if (url) {
  39 +
  40 + CFURLGetFileSystemRepresentation(url, true, (UInt8 *) buffer, szBuffer);
  41 + CFRelease(url);
  42 +
  43 + gchar * path = g_build_filename(buffer,name,NULL);
  44 +
  45 + if(g_file_test(path,test)) {
  46 + return path;
  47 + }
  48 +
  49 + g_free(path);
  50 +
  51 + }
  52 +
  53 + }
  54 +
  55 + return NULL;
  56 +
  57 + }
  58 +
  59 + gchar * pw3270_build_data_path(const char *name) {
  60 +
  61 + gchar * path = get_path_from_bundle(name,G_FILE_TEST_IS_DIR);
  62 +
  63 + if(path) {
  64 + return path;
  65 + }
  66 +
  67 + g_message("Cant find path for '%s'",path);
  68 + return NULL;
  69 +
  70 + }
  71 +
  72 + gchar * pw3270_build_data_filename(const char *filename) {
  73 +
  74 + gchar * path = get_path_from_bundle(filename,G_FILE_TEST_IS_REGULAR);
  75 +
  76 + if(path) {
  77 + return path;
  78 + }
  79 +
  80 + g_error("Cant find '%s'",filename);
  81 + return NULL;
  82 + }
  83 +
win/bundle.common
@@ -389,24 +389,48 @@ build_package() { @@ -389,24 +389,48 @@ build_package() {
389 389
390 make_packages() { 390 make_packages() {
391 391
  392 + echo "----------------------------------"
  393 + find . -iname *.nsi
  394 + echo "----------------------------------"
  395 + find ${srcdir} -iname *.nsi
  396 + echo "----------------------------------"
  397 + find ${buildroot} -iname *.nsi
  398 + echo "----------------------------------"
  399 +
392 if [ -e "${srcdir}/win/${PACKAGE_NAME}.nsi" ]; then 400 if [ -e "${srcdir}/win/${PACKAGE_NAME}.nsi" ]; then
393 mkdir -p "${buildroot}${MINGW_PREFIX}/nsi" 401 mkdir -p "${buildroot}${MINGW_PREFIX}/nsi"
394 cp "${srcdir}/win/${PACKAGE_NAME}.nsi" "${buildroot}${MINGW_PREFIX}/${PACKAGE_NAME}.nsi" 402 cp "${srcdir}/win/${PACKAGE_NAME}.nsi" "${buildroot}${MINGW_PREFIX}/${PACKAGE_NAME}.nsi"
395 - if [ "$?" != "0" ]; then  
396 - echo "Cant copy nsis script" 403 + if [ "$?" == "0" ]; then
  404 + echo "Nsis script installed"
  405 + else
  406 + echo "Error installing nsis"
397 fi 407 fi
  408 + else
  409 + echo "Cant find ${srcdir}/win/${PACKAGE_NAME}.nsi"
398 fi 410 fi
399 411
400 - argument "zip" > /dev/null  
401 - if [ "$?" == "0" ]; then  
402 - make_zip  
403 - fi 412 + if [ -e "${srcdir}/LICENSE" ]; then
  413 + mkdir -p "${buildroot}${MINGW_PREFIX}/share/pw3270"
  414 + cp "${srcdir}/LICENSE" "${buildroot}${MINGW_PREFIX}/share/pw3270"
  415 + if [ "$?" == "0" ]; then
  416 + echo "License installed"
  417 + else
  418 + echo "Error installing license"
  419 + fi
  420 + else
  421 + echo "Cant find ${srcdir}/LICENSE"
  422 + fi
404 423
405 argument "nsi" > /dev/null 424 argument "nsi" > /dev/null
406 if [ "$?" == "0" ]; then 425 if [ "$?" == "0" ]; then
407 make_nsis 426 make_nsis
408 fi 427 fi
409 428
  429 + argument "zip" > /dev/null
  430 + if [ "$?" == "0" ]; then
  431 + make_zip
  432 + fi
  433 +
410 } 434 }
411 435
412 436
win/bundle.msys
@@ -33,6 +33,31 @@ do @@ -33,6 +33,31 @@ do
33 fi 33 fi
34 done 34 done
35 35
  36 +argument "build" > /dev/null
  37 +if [ "$?" == "0" ]; then
  38 +
  39 + NOCONFIGURE=1 ./autogen.sh
  40 + if [ "$?" != "0" ]; then
  41 + echo "Configure failed"
  42 + exit -1
  43 + fi
  44 +
  45 + ./configure
  46 + if [ "$?" != "0" ]; then
  47 + echo "Configure failed"
  48 + exit -1
  49 + fi
  50 +
  51 + build_package
  52 +
  53 +else
  54 +
  55 + packages="${packages} pw3270"
  56 +
  57 +fi
  58 +
  59 +
36 install_gtk3_runtime 60 install_gtk3_runtime
  61 +make_packages
37 62
38 63
win/ci-build.sh
@@ -1,53 +0,0 @@ @@ -1,53 +0,0 @@
1 -#!/bin/bash  
2 -#  
3 -# SPDX-License-Identifier: LGPL-3.0-or-later  
4 -#  
5 -# Copyright (C) 2008 Banco do Brasil S.A.  
6 -#  
7 -# This program is free software: you can redistribute it and/or modify  
8 -# it under the terms of the GNU Lesser General Public License as published  
9 -# by the Free Software Foundation, either version 3 of the License, or  
10 -# (at your option) any later version.  
11 -#  
12 -# This program is distributed in the hope that it will be useful,  
13 -# but WITHOUT ANY WARRANTY; without even the implied warranty of  
14 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
15 -# GNU General Public License for more details.  
16 -#  
17 -# You should have received a copy of the GNU Lesser General Public License  
18 -# along with this program. If not, see <https://www.gnu.org/licenses/>.  
19 -  
20 -#  
21 -# References:  
22 -#  
23 -# * https://www.msys2.org/docs/ci/  
24 -#  
25 -  
26 -echo "Running ${0}"  
27 -  
28 -LOGFILE=build.log  
29 -rm -f ${LOGFILE}  
30 -  
31 -die ( ) {  
32 - [ -s $LOGFILE ] && tail $LOGFILE  
33 - [ "$1" ] && echo "$*"  
34 - exit -1  
35 -}  
36 -  
37 -cd $(dirname $(dirname $(readlink -f ${0})))  
38 -  
39 -#  
40 -# Install pre-reqs  
41 -#  
42 -echo "Installing pre-reqs..."  
43 -pacman -U --noconfirm *.pkg.tar.zst || die "pre-reqs failure"  
44 -  
45 -#  
46 -# Build  
47 -#  
48 -echo "Building package..."  
49 -dos2unix PKGBUILD.mingw || die "dos2unix failure"  
50 -makepkg BUILDDIR=/tmp/pkg -p PKGBUILD.mingw || die "makepkg failure"  
51 -  
52 -echo "Build complete"  
53 -