This is an automated email from the ASF dual-hosted git repository.

neilcsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new c525351b43 Native Execution Binaries workflow and changes for macOS 
Arm.
     new eb9e96d797 Merge pull request #6513 from 
neilcsmith-net/nativeexec-workflow
c525351b43 is described below

commit c525351b43b9f0daba42a9e3c28c73ba7047ce7f
Author: Neil C Smith <[email protected]>
AuthorDate: Mon Oct 2 10:54:12 2023 +0100

    Native Execution Binaries workflow and changes for macOS Arm.
---
 .../native-binary-build-dlight.nativeexecution.yml | 268 +++++++++++++++++++++
 ide/dlight.nativeexecution/.gitignore              |   4 +
 .../release/bin/nativeexecution/hostinfo.sh        |   4 +
 .../support/hostinfo/impl/HostInfoFactory.java     |   2 +-
 ide/dlight.nativeexecution/tools/Makefile          |   4 +-
 ide/dlight.nativeexecution/tools/build.sh          |   2 +-
 ide/dlight.nativeexecution/tools/buildjob.sh       |  55 +++++
 ide/dlight.nativeexecution/tools/killall/Makefile  |   4 +-
 ide/dlight.nativeexecution/tools/process_start.c   |   4 +
 ide/dlight.nativeexecution/tools/pty/Makefile      |   4 +-
 ide/dlight.nativeexecution/tools/unbuffer/Makefile |   6 +-
 11 files changed, 346 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/native-binary-build-dlight.nativeexecution.yml 
b/.github/workflows/native-binary-build-dlight.nativeexecution.yml
new file mode 100644
index 0000000000..65dc8a334a
--- /dev/null
+++ b/.github/workflows/native-binary-build-dlight.nativeexecution.yml
@@ -0,0 +1,268 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# ----------------------
+#
+#  This workflow builds the native binaries for dlight.nativeexecution.
+#
+#  The following builds are made:
+#    - On a Linux X64 host :
+#          - Linux X64 binary
+#    - On a MacOS X64 host :
+#          - MacOS X64 binary
+#          - MacOS ARM64 binary
+#    - On a Windows Server X64 host (TODO) :
+#          - Windows X64 binary
+#
+#  ..meaning we build 32-bit binaries on 64-bit hosts.
+#
+#  The result of the build are files 'nativeexecution-external-sources.zip'
+#  and 'nativeexecution-external-binaries.zip' which can be downloaded from
+#  the GitHub Actions UI and prepared for release to be used by the Ant build
+#  scripts for the NetBeans distribution.
+#
+# ----------------------
+
+
+name: NetBeans Native Execution Libraries
+
+
+on:
+  # Triggers the workflow on push or pull request events but only for
+  # relevant paths
+  push:
+    paths:
+      - .github/workflows/native-binary-build-dlight.nativeexecution.y*
+      - ide/dlight.nativeexecution/**
+
+  pull_request:
+    paths:
+      - .github/workflows/native-binary-build-dlight.nativeexecution.y*
+      - ide/dlight.nativeexecution/**
+
+  # Allows you to run this workflow manually from the Actions tab in GitHub UI
+  workflow_dispatch:
+
+# cancel other PR workflow run in the same head-base group if it exists (e.g. 
during PR syncs)
+# if this is not a PR run (no github.head_ref and github.base_ref defined), 
use an UID as group
+concurrency:
+  group: dlight-${{ github.head_ref || github.run_id }}-${{ github.base_ref }}
+  cancel-in-progress: true
+
+jobs:
+
+  source:
+
+    name: Build Source Zip
+    runs-on: ubuntu-latest
+
+    steps:
+
+      - name: Checkout
+        uses: actions/checkout@v4
+        with:
+          persist-credentials: false
+          submodules: false
+          show-progress: false
+
+      - name: Generate source bundle
+        run: |
+          SOURCES="ide/dlight.nativeexecution/build/sources"
+          mkdir -p ${SOURCES}/ide/dlight.nativeexecution
+          cp -r ide/dlight.nativeexecution/tools/ 
${SOURCES}/ide/dlight.nativeexecution/
+          cp -r ide/dlight.nativeexecution/release/ 
${SOURCES}/ide/dlight.nativeexecution/
+          cp LICENSE ${SOURCES}/LICENSE
+          cp NOTICE ${SOURCES}/NOTICE
+          ls -l -R ${SOURCES}
+
+      - name: Upload native sources
+        uses: actions/upload-artifact@v3
+        with:
+          name: nativeexecution-external-sources
+          path: ide/dlight.nativeexecution/build/sources/
+          if-no-files-found: error
+
+
+  build-linux:
+
+    name: Build on Linux
+    runs-on: ubuntu-latest
+    needs: source
+
+    steps:
+
+      - name: Download sources
+        uses: actions/download-artifact@v3
+        with:
+          name: nativeexecution-external-sources
+
+      - name: Build native lib (64-bit)
+        run: |
+          echo "Building 64-bit binary"
+          rm -rf ../release/bin/nativeexecution/Linux-x86_64/*
+          rm -rf buildall/*
+          chmod +x buildjob.sh
+          ./buildjob.sh Linux x86_64
+          ls -l -R buildall/
+          echo "done"
+        working-directory: ide/dlight.nativeexecution/tools
+
+      - name: Upload artifact Linux 64 bit
+        uses: actions/upload-artifact@v3
+        with:
+          name: Linux-x86_64
+          path: ide/dlight.nativeexecution/tools/buildall/
+          if-no-files-found: error
+
+
+
+# TODO : configure cygwin
+#  build-windows:
+#
+#    name: Build on Windows
+#    runs-on: windows-latest
+#    needs: source
+#
+#    steps:
+#
+#      - name: Download sources
+#        uses: actions/download-artifact@v3
+#        with:
+#          name: nativeexecution-external-sources
+#
+#      - name: Build native lib (64-bit)
+#        run: |
+#           echo "Building 64-bit binary"
+#           rm -f ../release/bin/nativeexecution/Windows-x86_64/*
+#           sh ./buildall.sh
+#           ls -l -R ../release/bin/nativeexecution/Windows-x86_64
+#           echo "done"
+#        shell: bash
+#        working-directory: ide/dlight.nativeexecution/tools
+#      - name: Upload artifact Windows 64 bit
+#        uses: actions/upload-artifact@v3
+#        with:
+#          name: Windows-x86_64
+#          path: ide/dlight.nativeexecution/tools/buildall/
+#          if-no-files-found: error
+#
+
+  build-macos-x64:
+
+    name: Build on MacOS x86_64
+    runs-on: macos-latest
+    needs: source
+
+    steps:
+
+      - name: Download sources
+        uses: actions/download-artifact@v3
+        with:
+          name: nativeexecution-external-sources
+
+      - name: Build native lib (x86_64)
+        run: |
+          rm -rf ../release/bin/nativeexecution/Linux-MacOSX*/*
+          rm -rf buildall/*
+          chmod +x buildjob.sh
+          ./buildjob.sh MacOSX x86_64
+          ls -l -R buildall/
+        working-directory: ide/dlight.nativeexecution/tools
+
+      - name: Upload artifact macOS x86_64
+        uses: actions/upload-artifact@v3
+        with:
+          name: MacOSX-x86_64
+          path: ide/dlight.nativeexecution/tools/buildall/
+          if-no-files-found: error
+
+  build-macos-arm:
+
+    name: Build on MacOS arm64
+    runs-on: macos-latest
+    needs: source
+
+    steps:
+
+      - name: Download sources
+        uses: actions/download-artifact@v3
+        with:
+          name: nativeexecution-external-sources
+
+      - name: Build native lib (arm64)
+        run: |
+          rm -rf ../release/bin/nativeexecution/Linux-MacOSX*/*
+          rm -rf buildall/*
+          chmod +x buildjob.sh
+          ./buildjob.sh MacOSX arm
+          ls -l -R buildall/
+        working-directory: ide/dlight.nativeexecution/tools
+
+      - name: Upload artifact macOS arm64
+        uses: actions/upload-artifact@v3
+        with:
+          name: MacOSX-arm_64
+          path: ide/dlight.nativeexecution/tools/buildall/
+          if-no-files-found: error
+
+
+  build-zip-with-build-artifacts:
+
+    name: Package Native Execution Libraries
+    runs-on: ubuntu-latest
+
+    # Only run when the platform specific builds are finished
+    needs: [build-linux, build-macos-x64, build-macos-arm]
+
+    steps:
+
+    - name: Create dir structure
+      run: mkdir -p myfiles/
+
+    - name: Download artifacts from predecessor jobs
+      uses: actions/download-artifact@v3
+      with:
+        path: myfiles/
+
+    - name: Tidy up and display artifacts
+      run: |
+        rm -rf myfiles/*sources*
+        ls -l -R
+
+    - name: Create BUILDINFO
+      run: |
+         BUILDINFO="myfiles/BUILDINFO.txt"
+         touch "$BUILDINFO"
+         echo "Apache NetBeans"                                                
>> "$BUILDINFO"
+         echo ""                                                               
>> "$BUILDINFO"
+         echo "Binaries in this ZIP are..."                                    
>> "$BUILDINFO"
+         echo "Build by GitHub Actions Workflow: ${GITHUB_WORKFLOW}"           
>> "$BUILDINFO"
+         echo ""                                                               
>> "$BUILDINFO"
+         echo "Build from:"                                                    
>> "$BUILDINFO"
+         echo "   Git repo       : ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"  
>> "$BUILDINFO"
+         echo "   Git commit SHA : ${GITHUB_SHA}"                              
>> "$BUILDINFO"
+         echo "   Git ref        : ${GITHUB_REF}"                              
>> "$BUILDINFO"
+         echo ""                                                               
>> "$BUILDINFO"
+         echo "Build time UTC : $(date --rfc-3339=seconds --utc)"              
>> "$BUILDINFO"
+         echo ""                                                               
>> "$BUILDINFO"
+
+    - name: Upload bundle
+      uses: actions/upload-artifact@v3
+      with:
+        name: nativeexecution-external-binaries
+        path: myfiles/
+        if-no-files-found: error
diff --git a/ide/dlight.nativeexecution/.gitignore 
b/ide/dlight.nativeexecution/.gitignore
new file mode 100644
index 0000000000..f9e768ac59
--- /dev/null
+++ b/ide/dlight.nativeexecution/.gitignore
@@ -0,0 +1,4 @@
+buildall/
+build/
+dist/
+release/bin/nativeexecution/*/*
diff --git a/ide/dlight.nativeexecution/release/bin/nativeexecution/hostinfo.sh 
b/ide/dlight.nativeexecution/release/bin/nativeexecution/hostinfo.sh
index 100cb3e8bd..0ad84ec62d 100755
--- a/ide/dlight.nativeexecution/release/bin/nativeexecution/hostinfo.sh
+++ b/ide/dlight.nativeexecution/release/bin/nativeexecution/hostinfo.sh
@@ -76,6 +76,10 @@ CPUFAMILY=`(echo ${CPUTYPE} | egrep "^i|x86_64|athlon|Intel" 
>/dev/null && echo
 if [ "${CPUFAMILY}" = "sparc64" ]; then
    CPUFAMILY="sparc"
 fi
+# New check if ARM64 then return ARM so Java code will stop returning “UNKNOWN”
+if [ "${CPUFAMILY}" = "arm64" ]; then
+   CPUFAMILY="arm"
+fi
 
 USERDIRBASE=${HOME}
 
diff --git 
a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/HostInfoFactory.java
 
b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/HostInfoFactory.java
index 677ef74460..5ed83a0122 100644
--- 
a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/HostInfoFactory.java
+++ 
b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/HostInfoFactory.java
@@ -89,7 +89,7 @@ public final class HostInfoFactory {
         try {
             return CpuFamily.valueOf(cpuFamilyStr.toUpperCase()); // NOI18N
         } catch (IllegalArgumentException ex) {
-            if (cpuFamilyStr.startsWith("armv")) { //NOI18N
+            if (cpuFamilyStr.startsWith("arm")) { //NOI18N
                 return CpuFamily.ARM;
             }
             return CpuFamily.UNKNOWN;
diff --git a/ide/dlight.nativeexecution/tools/Makefile 
b/ide/dlight.nativeexecution/tools/Makefile
index 4eab98e186..a7f62cfe75 100644
--- a/ide/dlight.nativeexecution/tools/Makefile
+++ b/ide/dlight.nativeexecution/tools/Makefile
@@ -32,8 +32,8 @@ CF_Linux-x86_64           = -DLINUX   -D_GNU_SOURCE 
-D_XOPEN_SOURCE=700 -m64
 CF_Linux-sparc_64   = -DLINUX   -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -m64
 CF_Linux-arm       = -DLINUX   -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -std=c99
 CF_Linux-aarch64    = -DLINUX   -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -std=c99
-CF_MacOSX-x86      = -DMAXOSX  -D_DARWIN_C_SOURCE -m32
-CF_MacOSX-x86_64    = -DMAXOSX  -D_DARWIN_C_SOURCE -m64
+CF_MacOSX-arm      = -DMAXOSX  -D_DARWIN_C_SOURCE -target arm64-apple-macos
+CF_MacOSX-x86_64    = -DMAXOSX  -D_DARWIN_C_SOURCE -target x86_64-apple-macos
 CF_SunOS-sparc_64   = -DSOLARIS -D__EXTENSIONS__ -m64
 CF_SunOS-x86       = -DSOLARIS -m32
 CF_SunOS-x86_64            = -DSOLARIS -m64
diff --git a/ide/dlight.nativeexecution/tools/build.sh 
b/ide/dlight.nativeexecution/tools/build.sh
index 490bb619cb..acdc67afc3 100755
--- a/ide/dlight.nativeexecution/tools/build.sh
+++ b/ide/dlight.nativeexecution/tools/build.sh
@@ -67,7 +67,7 @@ OSFAMILY=\${OSFAMILY:-\`test "\$OS" = "Linux" && echo Linux\`}
 OSFAMILY=\${OSFAMILY:-\${OS}}
 
 CPUFAMILY=\`echo \${CPUTYPE} | egrep "^i|x86_64|athlon|Intel" >/dev/null && 
echo x86\`
-CPUFAMILY=\${CPUFAMILY:-\`echo \${CPUTYPE} | egrep "armv" > /dev/null && echo 
arm\`}
+CPUFAMILY=\${CPUFAMILY:-\`echo \${CPUTYPE} | egrep "arm" > /dev/null && echo 
arm\`}
 CPUFAMILY=\${CPUFAMILY:-\`echo \${CPUTYPE} | egrep "sparc" > /dev/null && echo 
sparc\`} # sparc or sparc64
 CPUFAMILY=\${CPUFAMILY:-\${CPUTYPE}}
 
diff --git a/ide/dlight.nativeexecution/tools/buildjob.sh 
b/ide/dlight.nativeexecution/tools/buildjob.sh
new file mode 100755
index 0000000000..643ae80ff7
--- /dev/null
+++ b/ide/dlight.nativeexecution/tools/buildjob.sh
@@ -0,0 +1,55 @@
+#! /bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+if [ -z $1 ]; then
+  echo "No platform specified"
+  exit 1
+fi
+
+if [ -z $2 ]; then
+  echo "No CPU specified"
+  exit 2
+fi
+
+OSFAMILY=$1
+CPUFAMILY=$2
+PLATFORM=${OSFAMILY}-${CPUFAMILY}
+
+echo "Platform : ${PLATFORM}"
+
+SOURCES=". pty killall unbuffer"
+
+MAKE=`which gmake || which make`
+
+for dir in $SOURCES; do
+    (
+        cd $dir
+        $MAKE CONF=${PLATFORM} OSFAMILY=${OSFAMILY}
+        cd -
+    )
+done
+
+build_all_dir="buildall"
+
+mkdir -p "$build_all_dir"
+
+find "../release/bin/nativeexecution/" "unbuffer/dist/" "pty/dist" 
"killall/dist" -not -name "*.sh" -type f -exec cp {} $build_all_dir \;
+
+echo "================================================"
+find "$build_all_dir" -exec file {} + 
+
diff --git a/ide/dlight.nativeexecution/tools/killall/Makefile 
b/ide/dlight.nativeexecution/tools/killall/Makefile
index dd2c1811b3..7ca65c9365 100644
--- a/ide/dlight.nativeexecution/tools/killall/Makefile
+++ b/ide/dlight.nativeexecution/tools/killall/Makefile
@@ -80,14 +80,14 @@ EXEC=$(DIST_DIR)/$(PNAME)
 
 CF_Linux-x86      = $(CF_COMMON) -DLINUX -m32
 CF_Linux-arm      = $(CF_COMMON) -DLINUX   -D_GNU_SOURCE -D_XOPEN_SOURCE=700 
-std=c99
-CF_MacOSX-x86     = $(CF_COMMON) -DMACOSX  -D_DARWIN_C_SOURCE -m32
 CF_SunOS-x86      = $(CF_COMMON) -DSOLARIS -D__EXTENSIONS__ -m32
 CF_Windows-x86    = $(CF_COMMON) -DWINDOWS -m32
 
 CF_Linux-x86_64   = $(CF_COMMON) -DLINUX -m64
 CF_Linux-aarch64  = $(CF_COMMON) -DLINUX   -D_GNU_SOURCE -D_XOPEN_SOURCE=700 
-std=c99
 CF_Linux-sparc_64 = $(CF_COMMON) -DLINUX   -D_GNU_SOURCE -D_XOPEN_SOURCE=700 
-m64
-CF_MacOSX-x86_64  = $(CF_COMMON) -DMACOSX  -m64
+CF_MacOSX-arm     = $(CF_COMMON) -DMACOSX  -target arm64-apple-macos
+CF_MacOSX-x86_64  = $(CF_COMMON) -DMACOSX  -target x86_64-apple-macos
 CF_SunOS-sparc_64 = $(CF_COMMON) -DSOLARIS -D__EXTENSIONS__ -m64
 CF_SunOS-x86_64   = $(CF_COMMON) -DSOLARIS -D__EXTENSIONS__ -m64
 CF_Windows-x86_64 = $(CF_COMMON) -DWINDOWS -m32
diff --git a/ide/dlight.nativeexecution/tools/process_start.c 
b/ide/dlight.nativeexecution/tools/process_start.c
index 32c353f31d..46f1dba3e7 100644
--- a/ide/dlight.nativeexecution/tools/process_start.c
+++ b/ide/dlight.nativeexecution/tools/process_start.c
@@ -25,6 +25,10 @@
 #include <stropts.h>
 #endif
 
+#if defined(TIOCSCTTY)
+#include <sys/ioctl.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/ide/dlight.nativeexecution/tools/pty/Makefile 
b/ide/dlight.nativeexecution/tools/pty/Makefile
index a40b0c01af..34d4bcad3d 100644
--- a/ide/dlight.nativeexecution/tools/pty/Makefile
+++ b/ide/dlight.nativeexecution/tools/pty/Makefile
@@ -52,8 +52,8 @@ CF_Linux-x86_64   = $(CF_COMMON) -DLINUX   -D_GNU_SOURCE 
-D_XOPEN_SOURCE=700 -m6
 CF_Linux-sparc_64 = $(CF_COMMON) -DLINUX   -D_GNU_SOURCE -D_XOPEN_SOURCE=700 
-m64
 CF_Linux-arm      = $(CF_COMMON) -DLINUX   -D_GNU_SOURCE -D_XOPEN_SOURCE=700 
-std=c99
 CF_Linux-aarch64  = $(CF_COMMON) -DLINUX   -D_GNU_SOURCE -D_XOPEN_SOURCE=700 
-std=c99
-CF_MacOSX-x86     = $(CF_COMMON) -DMAXOSX  -D_DARWIN_C_SOURCE -m32
-CF_MacOSX-x86_64  = $(CF_COMMON) -DMAXOSX  -D_DARWIN_C_SOURCE -m64
+CF_MacOSX-arm     = $(CF_COMMON) -DMACOSX  -target arm64-apple-macos
+CF_MacOSX-x86_64  = $(CF_COMMON) -DMACOSX  -target x86_64-apple-macos
 CF_SunOS-sparc_64 = $(CF_COMMON) -DSOLARIS -D__EXTENSIONS__ -m64
 CF_SunOS-x86      = $(CF_COMMON) -DSOLARIS -D__EXTENSIONS__ -m32
 CF_SunOS-x86_64   = $(CF_COMMON) -DSOLARIS -D__EXTENSIONS__ -m64
diff --git a/ide/dlight.nativeexecution/tools/unbuffer/Makefile 
b/ide/dlight.nativeexecution/tools/unbuffer/Makefile
index f3b17acd10..b802e5e1a2 100644
--- a/ide/dlight.nativeexecution/tools/unbuffer/Makefile
+++ b/ide/dlight.nativeexecution/tools/unbuffer/Makefile
@@ -44,9 +44,9 @@ CF_Linux-x86_64   = $(CF_COMMON) -DLINUX -shared -fPIC -m64
 EX_Linux-x86_64   = unbuffer.so
 CF_Linux-sparc_64 = $(CF_COMMON) -DLINUX -shared -fPIC -m64
 EX_Linux-sparc_64 = unbuffer.so
-CF_MacOSX-x86     = $(CF_COMMON) -DMAXOSX  -shared -m32
-EX_MacOSX-x86     = unbuffer.dylib
-CF_MacOSX-x86_64  = $(CF_COMMON) -DMAXOSX  -shared -m64
+CF_MacOSX-arm     = $(CF_COMMON) -DMAXOSX  -shared -target arm64-apple-macos
+EX_MacOSX-arm     = unbuffer.dylib
+CF_MacOSX-x86_64  = $(CF_COMMON) -DMAXOSX  -shared -target x86_64-apple-macos
 EX_MacOSX-x86_64  = unbuffer.dylib
 CF_SunOS-sparc_64 = $(CF_COMMON) -DSOLARIS -G -fPIC -m64
 EX_SunOS-sparc_64 = unbuffer.so


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to