diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..7506766 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,47 @@ +name: ci +on: push +jobs: + # build-OSX: + # runs-on: macos-10.15 + # env: + # LDFLAGS: -L/usr/local/opt/qt@5/lib + # CPPFLAGS: -I/usr/local/opt/qt@5/include + # PKG_CONFIG_PATH: /usr/local/opt/qt@5/lib/pkgconfig + # HOMEBREW_CURLRC: 1 + # steps: + # - run: echo "/usr/local/opt/qt@5/bin" >> $GITHUB_PATH + # - uses: actions/checkout@v3 + # - run: brew install make + # - run: brew install ninja + # - run: echo insecure >> ~/.curlrc + # - run: make -f Makefile.darwin clean + # - run: make -f Makefile.darwin tools + # - run: make -f Makefile.darwin + # - run: tar -cf - PathOfBuilding.app | xz -c > PathOfBuilding.darwin.tar.xz + # # - uses: softprops/action-gh-release@v1 + # # if: startsWith(github.ref, 'refs/tags/') + # # with: + # # files: PathOfBuilding.darwin.tar.xz + # - uses: actions/upload-artifact@v3 + # with: + # name: PathOfBuilding + # path: PathOfBuilding.darwin.tar.xz + build-Linux: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - run: sudo apt-get install -y build-essential + - run: sudo apt-get install -y ninja-build + - run: make -f Makefile.linux clean + - run: make -f Makefile.linux tools + - run: make -f Makefile.linux + - run: tar -cf - PathOfBuilding | xz -c > PathOfBuilding.linux.tar.xz + - run: tar -cf - -C ${GITHUB_WORKSPACE}/PathOfBuilding/ $(ls -A ${GITHUB_WORKSPACE}"/PathOfBuilding/") | xz -c > PathOfBuilding.linux.tar.xz + # - uses: softprops/action-gh-release@v1 + # if: startsWith(github.ref, 'refs/tags/') + # with: + # files: PathOfBuilding.linux.tar.xz + - uses: actions/upload-artifact@v3 + with: + name: PathOfBuilding + path: PathOfBuilding.linux.tar.xz \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 35341bf..0000000 --- a/.travis.yml +++ /dev/null @@ -1,71 +0,0 @@ -branches: - except: - - PathOfBuilding - -jobs: - include: - - stage: build OSX - os: osx - language: objective-c - env: - - PATH=/usr/local/opt/qt/bin:$PATH - - LDFLAGS=-L/usr/local/opt/qt/lib - - CPPFLAGS=-I/usr/local/opt/qt/include - - PKG_CONFIG_PATH=/usr/local/opt/qt/lib/pkgconfig - - HOMEBREW_CURLRC=1 - addons: - homebrew: - packages: - - make - - ninja - script: - - echo insecure >> ~/.curlrc - - make -f Makefile.darwin clean - - make -f Makefile.darwin tools - - make -f Makefile.darwin - - tar -cf - PathOfBuilding.app | xz -c > PathOfBuilding.darwin.tar.xz - - - stage: build Linux - os: linux - dist: bionic - language: cpp - addons: - apt: - packages: - - build-essential - - ninja-build - script: - - make -f Makefile.linux clean - - make -f Makefile.linux tools - - make -f Makefile.linux - - tar -cf - PathOfBuilding | xz -c > PathOfBuilding.linux.tar.xz - - tar -cf - -C ${TRAVIS_BUILD_DIR}/PathOfBuilding/ $(ls -A ${TRAVIS_BUILD_DIR}"/PathOfBuilding/") | xz -c > PathOfBuilding.linux.tar.xz - -before_deploy: - - export TR_TAG="nightly-$(date +'%Y/%m/%d')" - - | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - git config --local user.name "Bernhard Fritz" - git config --local user.email "bernhard.e.fritz@gmail.com" - git tag -f PathOfBuilding - git remote add gh https://${TRAVIS_REPO_SLUG%/*}:${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git - git push -f gh PathOfBuilding - git remote remove gh - export ARCHIVE_NAME="PathOfBuilding.darwin.tar.xz" - fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - export ARCHIVE_NAME="PathOfBuilding.linux.tar.xz" - fi - -deploy: - provider: releases - api_key: $GITHUB_TOKEN - file: - - "${TRAVIS_BUILD_DIR}/${ARCHIVE_NAME}" - name: "PathOfBuilding" - overwrite: true - skip_cleanup: true - target_commitish: $TRAVIS_COMMIT - -after_deploy: - - bash github.sh diff --git a/Makefile.darwin b/Makefile.darwin index 20f0f5f..1d17ef4 100644 --- a/Makefile.darwin +++ b/Makefile.darwin @@ -31,12 +31,13 @@ load_pob: luacurl: git clone --depth 1 https://github.com/Lua-cURL/Lua-cURLv3.git; \ pushd Lua-cURLv3; \ - sed -i '' 's/\?= lua/\?= luajit/' Makefile; \ + sed -i '' 's/\?= lua$$/\?= luajit/' Makefile; \ + sed -i '' 's@shell .* --libs libcurl@shell PKG_CONFIG_PATH=\$$\$$(brew --prefix --installed curl)/lib/pkgconfig \$$(PKG_CONFIG) --libs libcurl@' Makefile; \ make; \ mv lcurl.so ../lcurl.so; \ popd -tools: qt lua zlib meson +tools: qt lua zlib meson curl dylibbundler qt: brew install qt5 @@ -50,5 +51,11 @@ zlib: meson: brew install meson +curl: + brew install curl + +dylibbundler: + brew install dylibbundler + clean: rm -rf PathOfBuilding PathOfBuilding.app Lua-cURLv3 lcurl.so build diff --git a/github.sh b/github.sh deleted file mode 100644 index dc652fa..0000000 --- a/github.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -curl -X PATCH -H 'Accept: application/vnd.github.v3+json' \ --H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/bernhardfritz/pobfrontend/releases/27766214 \ ---data @<(cat <<-EOF -{ "tag_name":"PathOfBuilding", -"target_commitish": "master", -"name": "PathOfBuilding", -"body": "build by Travis CI ${TR_TAG}", -"draft": false, "prerelease": false } -EOF -) diff --git a/main.cpp b/main.cpp index de38e23..97b4233 100644 --- a/main.cpp +++ b/main.cpp @@ -1760,6 +1760,12 @@ int main(int argc, char **argv) } lua_setglobal(L, "arg"); + std::string basePath = pobwindow->basePath.toStdString(); + std::string extraPathCommand = "package.path = package.path .. \";" + + basePath + + "/runtime/lua/?.lua\""; + luaL_dostring(L, extraPathCommand.c_str()); + int result = luaL_dofile(L, "Launch.lua"); if (result != 0) { lua_error(L); diff --git a/meson.build b/meson.build index 2d0fc87..5372ba0 100644 --- a/meson.build +++ b/meson.build @@ -6,6 +6,7 @@ lua_dep = dependency('luajit') # LDFLAGS="-pagezero_size 10000 -image_base 100000000" meson pobfrontend build if build_machine.system() == 'darwin' gl_dep = dependency('appleframeworks', modules: ['OpenGL']) + curl_dep = dependency('libcurl') else gl_dep = dependency('gl') endif @@ -16,11 +17,17 @@ zlib_dep = dependency('zlib') qt5 = import('qt5') prep = qt5.preprocess(moc_headers : ['subscript.hpp', 'pobwindow.hpp']) -executable('PathOfBuilding', - sources : ['main.cpp', prep], - dependencies : [qt5_dep, gl_dep, zlib_dep, lua_dep], - install : true) - +if build_machine.system() == 'darwin' + executable('PathOfBuilding', + sources : ['main.cpp', prep], + dependencies : [qt5_dep, gl_dep, zlib_dep, lua_dep, curl_dep], + install : true) +else + executable('PathOfBuilding', + sources : ['main.cpp', prep], + dependencies : [qt5_dep, gl_dep, zlib_dep, lua_dep], + install : true) +endif if build_machine.system() == 'darwin' install_data('pobLogo.icns', install_dir : 'Contents/Resources') diff --git a/mesonInstaller.sh b/mesonInstaller.sh index c14a894..e888668 100755 --- a/mesonInstaller.sh +++ b/mesonInstaller.sh @@ -4,9 +4,5 @@ cp -r ${MESON_SOURCE_ROOT}/PathOfBuilding/* ${MESON_INSTALL_PREFIX}/Contents/Mac mkdir -p ${MESON_INSTALL_PREFIX}/Contents/Frameworks -#cp -R /usr/local/opt/qt5/Frameworks/* \ -# ${MESON_INSTALL_PREFIX}/Contents/Frameworks - -#install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 \ -# @executable_path/../FrameWorks/SDL2.framework/Versions/A/SDL2 \ -# ${MESON_INSTALL_PREFIX}/Contents/MacOS/myapp +cd "${MESON_INSTALL_PREFIX}/Contents" +dylibbundler --overwrite-dir --create-dir --bundle-deps --fix-file MacOS/lcurl.so \ No newline at end of file