diff --git a/.github/workflows/build_win.yml b/.github/workflows/build_win.yml new file mode 100644 index 0000000..e2586d4 --- /dev/null +++ b/.github/workflows/build_win.yml @@ -0,0 +1,66 @@ +name: win-embedr-build + +on: + workflow_dispatch: + push: + branches: [master] + pull_request: + branches: [master] + types: [opened, synchronize, reopened] + release: + types: [created] + +jobs: + build-windows: + name: Windows 64-bit + runs-on: windows-latest + + env: + BITS: 64 + R_ARCH: x64 + Q_ARCH: w64 + R_HOME: C:\R + + steps: + - name: Check out repository + uses: actions/checkout@v5 + + - name: Set up R + uses: r-lib/actions/setup-r@v2 + with: + r-version: "4.4.2" + + - name: Check + shell: cmd + run: | + dir C:\R + dir C:\R\bin + dir C:\R\bin\x64 + + - name: Build embedr.dll + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path w64 | Out-Null + & C:\R\bin\x64\R.exe CMD SHLIB -o "w64/embedr.dll" embedr.c src/w64/q.lib -lws2_32 -liphlpapi + if ($LASTEXITCODE -ne 0) { exit 1 } + + - name: Package distribution + shell: pwsh + run: | + $version = "${{ github.ref_name }}" -replace '[\\/:*?"<>|]', '-' + + New-Item -ItemType Directory -Force -Path embedr | Out-Null + Copy-Item "w64" -Destination ".\embedr\w64" -Recurse + Copy-Item rinit.q -Destination .\embedr + Copy-Item rtest.q -Destination .\embedr + Copy-Item LICENSE -Destination .\embedr\LICENSE.embedr + Copy-Item README.md -Destination .\embedr\README.embedr + + 7z a "embedr_win64-$version.zip" ".\embedr\*" + + - name: Upload workflow artifact + uses: actions/upload-artifact@v4 + with: + name: embedr_win64 + path: embedr_win*.zip + if-no-files-found: error diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index c9bce7a..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,46 +0,0 @@ -image: Visual Studio 2017 -# Download script file from GitHub -init: - ps: | - $ErrorActionPreference = "Stop" - Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1" - Import-Module '..\appveyor-tool.ps1' - -install: - ps: Bootstrap - -environment: - global: - GCC_PATH: mingw_64 - matrix: - - BITS: 64 - R_ARCH: x64 - - - BITS: 32 - R_ARCH: i386 - -build_script: -- cmd: mkdir w%BITS% -- cmd: R.exe CMD SHLIB -o w%BITS%/embedr.dll embedr.c src/w%BITS%/q.a -lws2_32 - -after_build: -- cmd: mkdir embedr -- ps: Copy-Item w$env:BITS -Destination .\embedr\w$env:BITS -Recurse -- ps: Copy-Item rinit.q -Destination .\embedr -- ps: Copy-Item rtest.q -Destination .\embedr -- ps: Copy-Item LICENSE -Destination .\embedr\LICENSE.embedr -- ps: Copy-Item README.md -Destination .\embedr\README.embedr -- IF /I "%APPVEYOR_REPO_TAG%" == "false" set APPVEYOR_REPO_TAG_NAME=%APPVEYOR_REPO_BRANCH% -- cmd: 7z a embedr_win%BITS%-%APPVEYOR_REPO_TAG_NAME%.zip %APPVEYOR_BUILD_FOLDER%\embedr -artifacts: -- path: 'embedr_win*.zip' - -deploy: - provider: GitHub - draft: true - auth_token: - secure: P2U9jL8L7es2Iv/SSthmQ+a9qSZ41OSiGHjSdOMve7eKwWoo3zh/8DvJqkkMfhS7 - prerelease: true - on: - branch: master # release from master branch only - appveyor_repo_tag: true # deploy on tag push only diff --git a/embedr.c b/embedr.c index 90a69b1..45c2f5d 100644 --- a/embedr.c +++ b/embedr.c @@ -15,6 +15,7 @@ #include //#include #else +#include #include #include #endif diff --git a/src/rserver.c b/src/rserver.c index 8824c57..02bf02c 100644 --- a/src/rserver.c +++ b/src/rserver.c @@ -720,17 +720,17 @@ K ropen(K x) s=Rf_initEmbeddedR(argc, argv); if (s<0) return krr("open failed"); if(dumb_socketpair(spair, 1) == -1){ - return krr("Init failed for socketpair"); - } + return krr("Init failed for socketpair"); + } sd1(-spair[0], &processR); #ifndef WIN32 pthread_t t; - if(pthread_create(&t, NULL, pingmain, NULL)) - R krr("poller_thread"); - pingthread= &t; + if(pthread_create(&t, NULL, pingmain, NULL)) + R krr("poller_thread"); + pingthread= &t; #else - if(_beginthreadex(0,0,pingmain,NULL,0,0)==-1) - R krr("poller_thread"); + if(_beginthreadex(0,0,pingmain,NULL,0,0)==-1) + R krr("poller_thread"); #endif ROPEN=mode; return ki(ROPEN); diff --git a/src/socketpair.c b/src/socketpair.c index 715ee2c..e606a16 100644 --- a/src/socketpair.c +++ b/src/socketpair.c @@ -26,9 +26,7 @@ #include #ifdef WIN32 -# include # include -# include # include #else # include