Commit 94210aa2df62b7652d2b3f5f591fc970fcaab9c8
Committed by
GitHub
Exists in
develop
Merge pull request #64 from PerryWerneck/macos
Merging macos fixes into develop branch.
Showing
5 changed files
with
188 additions
and
5 deletions
Show diff stats
@@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
1 | +name: Publish | ||
2 | +on: | ||
3 | + push: | ||
4 | + branches: | ||
5 | + - macos | ||
6 | + pull_request: | ||
7 | + branches: | ||
8 | + - master | ||
9 | + - develop | ||
10 | +jobs: | ||
11 | + macos: | ||
12 | + name: Publish macos | ||
13 | + runs-on: macos-latest | ||
14 | + steps: | ||
15 | + - name: Checkout | ||
16 | + uses: actions/checkout@v3 | ||
17 | + - uses: oprypin/find-latest-tag@v1 | ||
18 | + id: gettag | ||
19 | + with: | ||
20 | + repository: PerryWerneck/pw3270 | ||
21 | + sort-tags: true | ||
22 | + releases-only: true | ||
23 | + - name: Install Pre reqs | ||
24 | + run: | | ||
25 | + brew update | ||
26 | + brew install xz automake libtool binutils coreutils curl gettext libtool openssl pkgconfig gtk+3 | ||
27 | + brew upgrade | ||
28 | + - uses: robinraju/release-downloader@v1.7 | ||
29 | + with: | ||
30 | + repository: "PerryWerneck/lib3270" | ||
31 | + latest: true | ||
32 | + fileName: "macos-lib3270.tar.xz" | ||
33 | + - uses: robinraju/release-downloader@v1.7 | ||
34 | + with: | ||
35 | + repository: "PerryWerneck/libv3270" | ||
36 | + latest: true | ||
37 | + fileName: "macos-libv3270.tar.xz" | ||
38 | + - name: build | ||
39 | + run: ./mac/ci-build.sh | ||
40 | + - uses: ncipollo/release-action@v1 | ||
41 | + with: | ||
42 | + tag: ${{ steps.gettag.outputs.tag }} | ||
43 | + artifacts: "macos-pw3270.tar.xz" | ||
44 | + allowUpdates: true | ||
45 | + draft: true | ||
46 | + makeLatest: true | ||
47 | + omitBody: true | ||
48 | + omitPrereleaseDuringUpdate: true | ||
49 | + replacesArtifacts: true | ||
50 | + |
autogen.sh
@@ -10,11 +10,21 @@ cd ${srcdir} | @@ -10,11 +10,21 @@ cd ${srcdir} | ||
10 | mkdir -p ./scripts | 10 | mkdir -p ./scripts |
11 | mkdir -p m4 | 11 | mkdir -p m4 |
12 | 12 | ||
13 | -libtoolize --force | ||
14 | -if test $? != 0 ; then | ||
15 | - echo "libtoolize failed." | ||
16 | - exit -1 | ||
17 | -fi | 13 | +case `uname` in |
14 | +Darwin*) | ||
15 | + glibtoolize --force | ||
16 | + if test $? != 0 ; then | ||
17 | + echo "glibtoolize failed." | ||
18 | + exit -1 | ||
19 | + fi | ||
20 | + ;; | ||
21 | +*) | ||
22 | + libtoolize --force | ||
23 | + if test $? != 0 ; then | ||
24 | + echo "libtoolize failed." | ||
25 | + exit -1 | ||
26 | + fi | ||
27 | +esac | ||
18 | 28 | ||
19 | aclocal | 29 | aclocal |
20 | if test $? != 0 ; then | 30 | if test $? != 0 ; then |
@@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
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) -Jxvf 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 | +} | ||
21 | + | ||
22 | +unpack lib3270 | ||
23 | +unpack libv3270 | ||
24 | + | ||
25 | +./autogen.sh --prefix="/${PROJECT_NAME}/${VERSION}" | ||
26 | +if [ "$?" != "0" ]; then | ||
27 | + exit -1 | ||
28 | +fi | ||
29 | + | ||
30 | +make all | ||
31 | +if [ "$?" != "0" ]; then | ||
32 | + exit -1 | ||
33 | +fi | ||
34 | + | ||
35 | +make DESTDIR=.bin/package install | ||
36 | +tar --create --xz --file=macos-${PROJECT_NAME}.tar.xz --directory=.bin/package --verbose . | ||
37 | + |
pw3270.cbp
@@ -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> |
@@ -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 | + |