]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
new files, not in this PR repo
authorc vw <dl1ycf@darc.de>
Fri, 14 Aug 2020 13:02:19 +0000 (15:02 +0200)
committerc vw <dl1ycf@darc.de>
Fri, 14 Aug 2020 13:02:19 +0000 (15:02 +0200)
MacOS.c [deleted file]
MacOS.h [deleted file]
MacOS/brew.init [deleted file]
MacOS/install.sh [deleted file]

diff --git a/MacOS.c b/MacOS.c
deleted file mode 100644 (file)
index 55e4176..0000000
--- a/MacOS.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * File MacOS.c
- *
- * This file need only be compiled on MacOS.
- * It contains some functions only needed there:
- *
- * MaOSstartup(char *path)      : create working dir in "$HOME/Library/Application Support" etc.
- *
- */
-
-#ifdef __APPLE__
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <uuid/uuid.h>
-
-void MacOSstartup(char *path) {
-//
-// We used to do this from a wrapper shell script.
-// However, this confuses MacOS when it comes to
-// granting access to the local microphone therefore
-// it is now built into the binary
-//
-// We have to distinguish two basic situations:
-//
-// a) piHPSDR is called from a command line
-// b) piHPSDR is within an app bundle
-//
-// In case a) nothing has to be done here (standard UNIX),
-// but in case b) we do the following:
-//
-// - if not yet existing, create the directory "$HOME/Library/Application Support/piHPSDR"
-// - copy the icon to that directory
-// - chdir to that directory
-//
-// Case b) is present if the current working directory is "/".
-//
-// If "$HOME/Library/Application Support" does not exist, fall back to case a)
-//
-    char *c;
-    char source[1024];
-    char workdir[1024];
-    char *homedir;
-    const char *AppSupport ="/Library/Application Support/piHPSDR";
-    const char *IconInApp  ="/../Resources/hpsdr.png";
-    struct stat st;
-    int fdin, fdout;
-    int rc;
-//
-//  If the current work dir is NOT "/", just do nothing
-//    
-    *workdir=0;
-    c=getcwd(workdir,sizeof(workdir));
-    if (strlen(workdir) != 1 || *workdir != '/') return;
-
-//
-//  Determine working directory,
-//  "$HOME/Library/Application Support/piHPSDR"
-//  and create it if it does not exist
-//  take care to enclose name with quotation marks
-//
-    if ((homedir = getenv("HOME")) == NULL) {
-      homedir = getpwuid(getuid())->pw_dir;
-    }
-    if (strlen(homedir) +strlen(AppSupport) > 1020) return;
-    strcpy(workdir,homedir);
-    strcat(workdir, AppSupport);
-
-//
-//  Check if working dir exists, otherwise try to create it
-//
-    if (stat(workdir, &st) < 0) {
-      mkdir(workdir, 0755);
-    }
-//
-//  Is it there? If not, give up
-//
-    if (stat(workdir, &st) < 0) {
-      return;
-    }
-//
-//  Is it a directory? If not, give up
-//
-    if ((st.st_mode & S_IFDIR) == 0) {
-      return;
-    }
-//
-//  chdir to the work dir
-//
-    chdir(workdir);
-    c=getcwd(workdir,sizeof(workdir));
-//
-//  Copy icon from app bundle to the work dir
-//
-    if (strlen(path) < 1024) {
-      //
-      // source = basename of the executable
-      //
-      strcpy(source, path);
-      c=rindex(source,'/');
-      if (c) {
-        *c=0;
-        if ((strlen(source) + strlen(IconInApp) < 1024)) {
-          strcat(source,  IconInApp);
-          //
-          // Now copy the file from "source" to "workdir"
-          //
-          fdin=open(source, O_RDONLY);
-          fdout=open("hpsdr.png", O_WRONLY | O_CREAT | O_TRUNC, (mode_t) 0400);
-          if (fdin >= 0 && fdout >= 0) {
-            //
-            // Now do the copy, use "source" as I/O buffer
-            //
-            while ((rc=read(fdin, source, 1024)) > 0) {
-              write (fdout, source, rc);
-            }
-            close(fdin);
-            close(fdout);
-          }
-        }
-      }
-    }
-}
-
-#endif
diff --git a/MacOS.h b/MacOS.h
deleted file mode 100644 (file)
index c636e93..0000000
--- a/MacOS.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *  Some functions are possibly missing on MacOS and in this case
- *  are replaced with "static inline" functions:
- *
- *  clock_gettime()
- *  clock_nanosleep()
- */
-
-#ifdef __APPLE__
-
-#include <time.h>
-
-#if !defined(CLOCK_REALTIME) && !defined(CLOCK_MONOTONIC)
-//
-// MacOS < 10.12 does not have clock_gettime
-//
-// Contribution from github user "ra1nb0w"
-//
-
-#define CLOCK_REALTIME  0
-#define CLOCK_MONOTONIC 6
-typedef int clockid_t;
-
-#include <sys/time.h>
-#include <mach/mach_time.h>
-
-// here to avoid problem on linking
-static inline int clock_gettime( clockid_t clk_id, struct timespec *ts )
-{
-  int ret = -1;
-  if ( ts )
-  {
-    if      ( CLOCK_REALTIME == clk_id )
-    {
-      struct timeval tv;
-      ret = gettimeofday(&tv, NULL);
-      ts->tv_sec  = tv.tv_sec;
-      ts->tv_nsec = tv.tv_usec * 1000;
-    }
-    else if ( CLOCK_MONOTONIC == clk_id )
-    {
-      const uint64_t t = mach_absolute_time();
-      mach_timebase_info_data_t timebase;
-      mach_timebase_info(&timebase);
-      const uint64_t tdiff = t * timebase.numer / timebase.denom;
-      ts->tv_sec  = tdiff / 1000000000;
-      ts->tv_nsec = tdiff % 1000000000;
-      ret = 0;
-    }
-  }
-  return ret;
-}
-
-#endif // CLOCK_REALTIME and CLOCK_MONOTONIC
-
-//
-// MacOS does not have clock_nanosleep but it does have nanosleep
-// We ignore clock_id (assuming CLOCK_MONOTONIC)
-// but for the flags we allow TIMER_ABSTIME (sleep until a specific poin
-// in time), for all other value we sleep for a speficic period.
-//
-
-#if !defined(TIMER_ABSTIME)
-#define TIMER_ABSTIME 12345
-
-static inline int clock_nanosleep(clockid_t clock_id, int flags,
-                              const struct timespec *request,
-                              struct timespec *remain) {
-  struct timespec now;
-  int rc;
-
-  if (flags == TIMER_ABSTIME) {
-    //
-    // sleep until point in the future
-    //
-    clock_gettime(CLOCK_MONOTONIC, &now);
-    now.tv_sec = request->tv_sec  - now.tv_sec;
-    now.tv_nsec= request->tv_nsec - now.tv_nsec;
-    while (now.tv_nsec < 0) {
-      now.tv_nsec += 1000000000;
-      now.tv_sec--;
-    }
-    rc=nanosleep(&now, remain);
-  } else {
-    //
-    // sleep for the given period
-    //
-    rc=nanosleep(request, remain);
-  }
-  return rc;
-}
-#endif  // !defined(TIMER_ABSTIME)
-
-#endif // __APPLE__
diff --git a/MacOS/brew.init b/MacOS/brew.init
deleted file mode 100755 (executable)
index 0699767..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-  
-#
-# This installs the "command line tools", these are necessary to install the
-# homebrew universe
-#
-xcode-select --install
-
-#
-# This installes the core of the homebrew universe
-#
-/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-
-#
-# All needed for pihpsdr
-#
-brew install gtk+3
-brew install pkg-config
-brew install portaudio
-brew install fftw
-
-#
-# This is for the SoapySDR universe
-# There are even more radios supported for which you need
-# additional modules, for a list, goto the web page
-# https://formulae.brew.sh
-# and insert the search string "pothosware". In the long
-# list produced, search for the same string using the
-# "search" facility of your internet browser
-#
-brew install libusb
-brew install cmake
-brew install pothosware/pothos/soapysdr
-brew install pothosware/pothos/soapyplutosdr
-brew install pothosware/pothos/limesuite
-brew install pothosware/pothos/soapyrtlsdr
-brew install pothosware/pothos/soapyairspy
-brew install pothosware/pothos/soapyairspyhf
-brew install pothosware/pothos/soapyhackrf
-brew install pothosware/pothos/soapyredpitaya
-brew install pothosware/pothos/soapyrtlsdr
-
-#
-# This is for PrivacyProtection
-#
-brew analytics off
-
diff --git a/MacOS/install.sh b/MacOS/install.sh
deleted file mode 100755 (executable)
index 87833a5..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-
-#
-# This installs the "command line tools", these are necessary to install the
-# homebrew universe
-#
-xcode-select --install
-
-#
-# This installes the core of the homebrew universe
-#
-/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-
-#
-# All needed for pihpsdr
-#
-brew install gtk+3
-brew install pkg-config
-brew install portaudio
-brew install fftw
-
-#
-# This is for the SoapySDR universe
-# There are even more radios supported for which you need
-# additional modules, for a list, goto the web page
-# https://formulae.brew.sh
-# and insert the search string "pothosware". In the long
-# list produced, search for the same string using the
-# "search" facility of your internet browser
-#
-brew install cmake
-brew install libusb
-brew install pothosware/pothos/soapysdr
-brew install pothosware/pothos/soapyplutosdr
-brew install pothosware/pothos/limesuite
-brew install pothosware/pothos/soapyrtlsdr
-brew install pothosware/pothos/soapyairspy
-brew install pothosware/pothos/soapyairspyhf
-brew install pothosware/pothos/soapyhackrf
-brew install pothosware/pothos/soapyredpitaya
-
-#
-# This is for PrivacyProtection
-#
-brew analytics off 
-#
-# Now go to the home directory and download WDSP and pihpsdr
-#
-cd $HOME
-yes | rm -rf pihpsdr
-yes | rm -rf wdsp
-git clone https://github.com/dl1ycf/wdsp.git
-git clone https://github.com/dl1ycf/pihpsdr.git
-#
-# compile and install WDSP
-#
-cd $HOME/wdsp
-make -f Makefile.mac -j 4
-make -f Makefile.mac install
-#
-# compile pihpsdr, and move app bundle to the Desktop
-#
-cd $HOME/pihpsdr
-make -f Makefile.mac -j 4 app
-mv pihpsdr.app $HOME/Desktop
-