-
Notifications
You must be signed in to change notification settings - Fork 6
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 #31 from PsyCommando/dev
Merging change for Statsutil 0.23 to master
- Loading branch information
Showing
199 changed files
with
29,430 additions
and
6,793 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
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,25 @@ | ||
-------------------------------------------------------------------------------- | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2004 | ||
|
||
Copyright (C) 2004 Sam Hocevar <[email protected]> | ||
|
||
Everyone is permitted to copy and distribute verbatim or modified | ||
copies of this license document, and changing it is allowed as long | ||
as the name is changed. | ||
|
||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
|
||
0. You just DO WHAT THE FUCK YOU WANT TO. | ||
1. Bla bla bla | ||
2. Montesqieu et camembert, vive la France, zut alors! | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
WTFPLv2 is very permissive, see http://www.wtfpl.net/faq/ | ||
|
||
However, if this WTFPLV2 is REALLY a blocker and is the reason you can't use | ||
this project, contact me and I'll dual license it. | ||
|
||
-------------------------------------------------------------------------------- |
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,118 @@ | ||
# Where Am I? | ||
|
||
A drop-in two files library to locate the current executable and the current | ||
module on the file system. | ||
|
||
Supported platforms: | ||
|
||
- Windows | ||
- Linux | ||
- Mac | ||
- iOS | ||
- Android | ||
- QNX Neutrino | ||
- FreeBSD | ||
|
||
Just drop `whereami.h` and `whereami.c` into your build and get started. (see | ||
also [customizing compilation]) | ||
|
||
[customizing compilation]: #customizing-compilation | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
## Usage | ||
|
||
- `wai_getExecutablePath()` returns the path of the enclosing executable | ||
- `wai_getModulePath()` returns the path of the enclosing module | ||
|
||
Example usage: | ||
|
||
- first call `int length = wai_getExecutablePath(NULL, 0, NULL);` to retrieve | ||
the length of the path | ||
- allocate the destination buffer with `path = (char*)malloc(length + 1);` | ||
- call `wai_getExecutablePath(path, length, &dirname_length)` again to retrieve | ||
the path | ||
- add a terminal `NUL` character with `path[length] = '\0';` | ||
|
||
Here is the output of the example: | ||
|
||
$ make -C _gnu-make | ||
$ cp ./bin/mac-x86_64/library.dylib /tmp/ | ||
$ ./bin/mac-x86_64/executable --load-library=/tmp/library.dylib | ||
|
||
executable path: /Users/gregory/Projects/whereami/bin/mac-x86_64/executable | ||
dirname: /Users/gregory/Projects/whereami/bin/mac-x86_64 | ||
basename: executable | ||
module path: /Users/gregory/Projects/whereami/bin/mac-x86_64/executable | ||
dirname: /Users/gregory/Projects/whereami/bin/mac-x86_64 | ||
basename: executable | ||
|
||
library loaded | ||
executable path: /Users/gregory/Projects/whereami/bin/mac-x86_64/executable | ||
dirname: /Users/gregory/Projects/whereami/bin/mac-x86_64 | ||
basename: executable | ||
module path: /private/tmp/library.dylib | ||
dirname: /private/tmp | ||
basename: library.dylib | ||
library unloaded | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
## Customizing compilation | ||
|
||
You can customize the library's behavior by defining the following macros: | ||
|
||
- `WAI_FUNCSPEC` | ||
- `WAI_PREFIX` | ||
- `WAI_MALLOC` | ||
- `WAI_REALLOC` | ||
- `WAI_FREE` | ||
|
||
## Compiling for Windows | ||
|
||
There is a Visual Studio 2015 solution in the `_win-vs14/` folder. | ||
|
||
## Compiling for Linux or Mac | ||
|
||
There is a GNU Make 3.81 `MakeFile` in the `_gnu-make/` folder: | ||
|
||
$ make -C _gnu-make/ | ||
|
||
## Compiling for Mac | ||
|
||
See above if you want to compile from command line. Otherwise there is an Xcode | ||
project located in the `_mac-xcode/` folder. | ||
|
||
## Compiling for iOS | ||
|
||
There is an Xcode project located in the `_ios-xcode/` folder. | ||
|
||
If you prefer compiling from command line and deploying to a jailbroken device | ||
through SSH, use: | ||
|
||
$ make -C _gnu-make/ binsubdir=ios CC="$(xcrun --sdk iphoneos --find clang) -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch armv7 -arch armv7s -arch arm64" postbuild="codesign -s 'iPhone Developer'" | ||
|
||
## Compiling for Android | ||
|
||
You will have to install the Android NDK, and point the `$NDK_ROOT` environment | ||
variable to the NDK path: e.g. `export NDK_ROOT=/opt/android-ndk` (without a | ||
trailing `/` character). | ||
|
||
Next, the easy way is to make a standalone Android toolchain with the following | ||
command: | ||
|
||
$ $NDK_ROOT/build/tools/make-standalone-toolchain.sh --system=$(uname -s | tr [A-Z] [a-z])-$(uname -m) --platform=android-3 --arch=arm --install-dir=/tmp/android | ||
|
||
Now you can compile the self test and self benchmark programs by running: | ||
|
||
$ make -C _gnu-make/ libsuffix=.so binsubdir=android CC=/tmp/android/bin/arm-linux-androideabi-gcc CFLAGS='-march=armv7-a -mfloat-abi=softfp -O2' | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
If you find this library useful and decide to use it in your own projects please | ||
drop me a line [@gpakosz]. | ||
|
||
If you use it in a commercial project, consider using [Gittip]. | ||
|
||
[@gpakosz]: https://twitter.com/gpakosz | ||
[Gittip]: https://www.gittip.com/gpakosz/ |
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,103 @@ | ||
.PHONY: build clean | ||
|
||
# directories | ||
ifeq ($(realpath .),) | ||
$(error your version of Make doesn't support $$(realpath names...) - please use GNU Make 3.81 or later) | ||
endif | ||
|
||
ifeq ($(platform),) | ||
__uname_s := $(shell sh -c 'uname -s 2>/dev/null | tr [A-Z] [a-z] || echo unknown-platform') | ||
__uname_m := $(shell sh -c 'uname -m 2>/dev/null | tr [A-Z] [a-z] || echo unknown-architecture') | ||
|
||
ifeq ($(__uname_s),linux) | ||
override platform := linux | ||
override architecture := $(__uname_m) | ||
endif | ||
ifeq ($(__uname_s),darwin) | ||
override platform := mac | ||
override architecture := $(__uname_m) | ||
endif | ||
ifeq ($(findstring mingw,$(__uname_s)),mingw) | ||
override platform := windows | ||
override architecture := $(if $(findstring MINGW32,$(MSYSTEM)),i686,$(if $(findstring MINGW64,$(MSYSTEM)),x86_64,)) | ||
ifeq ($(CC),cc) | ||
override CC := gcc | ||
endif | ||
endif | ||
ifeq ($(__uname_s),freebsd) | ||
override platform := freebsd | ||
override architecture := $(__uname_m) | ||
endif | ||
endif | ||
ifeq ($(architecture),) | ||
override architecture := unknown-architecture | ||
endif | ||
|
||
prefix := $(realpath ..) | ||
srcdir := $(realpath ../src) | ||
exampledir := $(realpath ../example) | ||
testdir := $(realpath ../test) | ||
buildir := $(realpath .)/build | ||
binsubdir := $(platform)-$(architecture) | ||
bindir := $(prefix)/bin/$(binsubdir) | ||
|
||
CFLAGS := -O2 -g -Wall -pedantic -Werror -std=c99 | ||
CXXFLAGS := -O2 -g -Wall -pedantic -Werror | ||
|
||
ifeq ($(platform),linux) | ||
LDFLAGS += -ldl | ||
CFLAGS += -D_XOPEN_SOURCE=500 -fpic | ||
CXXFLAGS += -fpic | ||
endif | ||
ifeq ($(platform),mac) | ||
CFLAGS += -D_DARWIN_C_SOURCE | ||
endif | ||
ifeq ($(platform),freebsd) | ||
CFLAGS += -fpic | ||
CXXFLAGS += -fpic | ||
endif | ||
|
||
ifeq ($(platform),mac) | ||
libsuffix := .dylib | ||
endif | ||
ifeq ($(platform),linux) | ||
libsuffix := .so | ||
endif | ||
ifeq ($(platform),windows) | ||
libsuffix := .dll | ||
endif | ||
ifeq ($(platform),freebsd) | ||
libsuffix := .so | ||
endif | ||
|
||
.PHONY: build-executable | ||
build: build-executable | ||
build-executable: $(bindir)/executable $(bindir)/executable-cpp | ||
|
||
$(bindir)/executable: $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/executable.c | ||
mkdir -p $(@D) | ||
$(CC) -o $@ -I $(srcdir) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(filter-out %.h,$^) | ||
$(if $(postbuild),$(postbuild) $@) | ||
|
||
$(bindir)/executable-cpp: $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/executable.c | ||
mkdir -p $(@D) | ||
$(CXX) -x c++ -o $@ -I $(srcdir) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(filter-out %.h,$^) | ||
$(if $(postbuild),$(postbuild) $@) | ||
|
||
.PHONY: build-library | ||
build: build-library | ||
build-library: $(bindir)/library$(libsuffix) $(bindir)/library-cpp$(libsuffix) | ||
|
||
$(bindir)/library$(libsuffix): $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/library.c | ||
mkdir -p $(@D) | ||
$(CC) -shared -o $@ -I $(srcdir) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(filter-out %.h,$^) | ||
$(if $(postbuild),$(postbuild) $@) | ||
|
||
$(bindir)/library-cpp$(libsuffix): $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/library.c | ||
mkdir -p $(@D) | ||
$(CXX) -x c++ -shared -o $@ -I $(srcdir) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(filter-out %.h,$^) | ||
$(if $(postbuild),$(postbuild) $@) | ||
|
||
clean: | ||
rm -rf $(buildir) | ||
rm -rf $(bindir) |
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,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>net.pempek.${PRODUCT_NAME:rfc1034identifier}</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>armv7</string> | ||
</array> | ||
<key>UIRequiresFullScreen</key> | ||
<true/> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
</dict> | ||
</plist> |
Oops, something went wrong.