-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from PerryWerneck/macos
Merging macos fixes into develop branch.
- Loading branch information
Showing
5 changed files
with
188 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Publish | ||
on: | ||
push: | ||
branches: | ||
- macos | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
jobs: | ||
macos: | ||
name: Publish macos | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: oprypin/find-latest-tag@v1 | ||
id: gettag | ||
with: | ||
repository: PerryWerneck/pw3270 | ||
sort-tags: true | ||
releases-only: true | ||
- name: Install Pre reqs | ||
run: | | ||
brew update | ||
brew install xz automake libtool binutils coreutils curl gettext libtool openssl pkgconfig gtk+3 | ||
brew upgrade | ||
- uses: robinraju/release-downloader@v1.7 | ||
with: | ||
repository: "PerryWerneck/lib3270" | ||
latest: true | ||
fileName: "macos-lib3270.tar.xz" | ||
- uses: robinraju/release-downloader@v1.7 | ||
with: | ||
repository: "PerryWerneck/libv3270" | ||
latest: true | ||
fileName: "macos-libv3270.tar.xz" | ||
- name: build | ||
run: ./mac/ci-build.sh | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.gettag.outputs.tag }} | ||
artifacts: "macos-pw3270.tar.xz" | ||
allowUpdates: true | ||
draft: true | ||
makeLatest: true | ||
omitBody: true | ||
omitPrereleaseDuringUpdate: true | ||
replacesArtifacts: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
PROJECT_NAME=$(grep AC_INIT configure.ac | cut -d[ -f2 | cut -d] -f1) | ||
VERSION=$(grep AC_INIT configure.ac | cut -d[ -f3 | cut -d] -f1) | ||
|
||
unpack() { | ||
|
||
echo "Unpacking ${1}" | ||
|
||
tar -C $(brew --cellar) -Jxvf macos-${1}.tar.xz | ||
if [ "$?" != "0" ]; then | ||
exit -1 | ||
fi | ||
|
||
brew link ${1} | ||
if [ "$?" != "0" ]; then | ||
exit -1 | ||
fi | ||
|
||
} | ||
|
||
unpack lib3270 | ||
unpack libv3270 | ||
|
||
./autogen.sh --prefix="/${PROJECT_NAME}/${VERSION}" | ||
if [ "$?" != "0" ]; then | ||
exit -1 | ||
fi | ||
|
||
make all | ||
if [ "$?" != "0" ]; then | ||
exit -1 | ||
fi | ||
|
||
make DESTDIR=.bin/package install | ||
tar --create --xz --file=macos-${PROJECT_NAME}.tar.xz --directory=.bin/package --verbose . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* SPDX-License-Identifier: LGPL-3.0-or-later */ | ||
|
||
/* | ||
* Copyright (C) <2008> <Banco do Brasil S.A.> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <config.h> | ||
#include <pw3270.h> | ||
#include <sys/syslimits.h> | ||
#include <CoreFoundation/CFBundle.h> | ||
#include <CoreFoundation/CFURL.h> | ||
|
||
static gchar * get_path_from_bundle(const char *name, GFileTest test) { | ||
|
||
size_t szBuffer = PATH_MAX; | ||
char buffer[PATH_MAX+1]; | ||
memset(buffer,0,PATH_MAX+1); | ||
|
||
CFBundleRef mainBundle = CFBundleGetMainBundle(); | ||
|
||
if (mainBundle) { | ||
|
||
CFURLRef url = CFBundleCopyBundleURL(mainBundle); | ||
|
||
if (url) { | ||
|
||
CFURLGetFileSystemRepresentation(url, true, (UInt8 *) buffer, szBuffer); | ||
CFRelease(url); | ||
|
||
gchar * path = g_build_filename(buffer,name,NULL); | ||
|
||
if(g_file_test(path,test)) { | ||
return path; | ||
} | ||
|
||
g_free(path); | ||
|
||
} | ||
|
||
} | ||
|
||
return NULL; | ||
|
||
} | ||
|
||
gchar * pw3270_build_data_path(const char *name) { | ||
|
||
gchar * path = get_path_from_bundle(name,G_FILE_TEST_IS_DIR); | ||
|
||
if(path) { | ||
return path; | ||
} | ||
|
||
g_message("Cant find path for '%s'",path); | ||
return NULL; | ||
|
||
} | ||
|
||
gchar * pw3270_build_data_filename(const char *filename) { | ||
|
||
gchar * path = get_path_from_bundle(filename,G_FILE_TEST_IS_REGULAR); | ||
|
||
if(path) { | ||
return path; | ||
} | ||
|
||
g_error("Cant find '%s'",filename); | ||
return NULL; | ||
} | ||
|