Skip to content

Commit

Permalink
Fix Switch toolchain (ICU)
Browse files Browse the repository at this point in the history
  • Loading branch information
carstene1ns committed Apr 14, 2019
1 parent a527555 commit 0a00a2b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 141 deletions.
1 change: 0 additions & 1 deletion switch/1_download_library.sh
Expand Up @@ -86,4 +86,3 @@ download_and_extract $ICU_URL
# icudata
rm -f $ICUDATA_FILES
download_and_extract $ICUDATA_URL

12 changes: 6 additions & 6 deletions switch/2_build_toolchain.sh
Expand Up @@ -69,16 +69,16 @@ function set_build_flags {
export CC="ccache $CC"
export CXX="ccache $CXX"
fi
export CFLAGS="-g0 -O2 -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec -ffunction-sections"
export CXXFLAGS=$CFLAGS
export CPPFLAGS="-I$PLATFORM_PREFIX/include -I$DEVKITPRO/libnx/include -D__SWITCH__"
export LDFLAGS="-L$PLATFORM_PREFIX/lib"
ARCH_FLAGS="-march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec"
export CFLAGS="-g0 -O2 $ARCH_FLAGS -ffunction-sections"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="-D__SWITCH__ -I$PLATFORM_PREFIX/include -I$DEVKITPRO/libnx/include"
export LDFLAGS="$ARCH_FLAGS -L$PLATFORM_PREFIX/lib -L$DEVKITPRO/libnx/lib"
export LIBS="-lnx"
}

# Build native icu59
install_lib_icu_native

# Install libraries
set_build_flags

install_lib_zlib
Expand Down
3 changes: 1 addition & 2 deletions switch/README.md
Expand Up @@ -4,10 +4,9 @@

### Prequisites:

- Install devkitA64. This includes libnx and switch-tools.
- Install devkitA64, libnx and switch-tools.
(Environment variables `DEVKITPRO` needs to be set)

### Local build process:

- Run `0_build_everything.sh` in a terminal

132 changes: 0 additions & 132 deletions switch/icu59-switch.patch
Expand Up @@ -17,138 +17,6 @@ diff -Naur icu-native/source/common/putilimp.h icu/source/common/putilimp.h

#ifdef U_HAVE_MMAP
/* Use the predefined value. */
diff -Naur icu-native/source/common/umutex.cpp icu/source/common/umutex.cpp
--- icu-native/source/common/umutex.cpp 2018-02-22 16:51:51.169401000 +0000
+++ icu/source/common/umutex.cpp 2018-02-22 16:51:53.853401000 +0000
@@ -183,7 +183,7 @@
//
//-------------------------------------------------------------------------------------------

-# include <pthread.h>
+//# include <pthread.h>

// Each UMutex consists of a pthread_mutex_t.
// All are statically initialized and ready for use.
@@ -194,7 +194,7 @@
if (mutex == NULL) {
mutex = &globalMutex;
}
- int sysErr = pthread_mutex_lock(&mutex->fMutex);
+ int sysErr = 0;//pthread_mutex_lock(&mutex->fMutex);
(void)sysErr; // Suppress unused variable warnings.
U_ASSERT(sysErr == 0);
}
@@ -206,7 +206,7 @@
if (mutex == NULL) {
mutex = &globalMutex;
}
- int sysErr = pthread_mutex_unlock(&mutex->fMutex);
+ int sysErr = 0;//pthread_mutex_unlock(&mutex->fMutex);
(void)sysErr; // Suppress unused variable warnings.
U_ASSERT(sysErr == 0);
}
@@ -217,21 +217,21 @@
if (mutex == NULL) {
mutex = &globalMutex;
}
- int sysErr = pthread_cond_wait(&cond->fCondition, &mutex->fMutex);
+ int sysErr = 0;//pthread_cond_wait(&cond->fCondition, &mutex->fMutex);
(void)sysErr;
U_ASSERT(sysErr == 0);
}

U_CAPI void U_EXPORT2
umtx_condBroadcast(UConditionVar *cond) {
- int sysErr = pthread_cond_broadcast(&cond->fCondition);
+ int sysErr = 0;//pthread_cond_broadcast(&cond->fCondition);
(void)sysErr;
U_ASSERT(sysErr == 0);
}

U_CAPI void U_EXPORT2
umtx_condSignal(UConditionVar *cond) {
- int sysErr = pthread_cond_signal(&cond->fCondition);
+ int sysErr = 0;//pthread_cond_signal(&cond->fCondition);
(void)sysErr;
U_ASSERT(sysErr == 0);
}
@@ -240,8 +240,8 @@

U_NAMESPACE_BEGIN

-static pthread_mutex_t initMutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t initCondition = PTHREAD_COND_INITIALIZER;
+//static pthread_mutex_t initMutex = PTHREAD_MUTEX_INITIALIZER;
+//static pthread_cond_t initCondition = PTHREAD_COND_INITIALIZER;


// This function is called when a test of a UInitOnce::fState reveals that
@@ -254,19 +254,19 @@
//
U_COMMON_API UBool U_EXPORT2
umtx_initImplPreInit(UInitOnce &uio) {
- pthread_mutex_lock(&initMutex);
+ //pthread_mutex_lock(&initMutex);
int32_t state = uio.fState;
if (state == 0) {
umtx_storeRelease(uio.fState, 1);
- pthread_mutex_unlock(&initMutex);
+ //pthread_mutex_unlock(&initMutex);
return TRUE; // Caller will next call the init function.
} else {
while (uio.fState == 1) {
// Another thread is currently running the initialization.
// Wait until it completes.
- pthread_cond_wait(&initCondition, &initMutex);
+ //pthread_cond_wait(&initCondition, &initMutex);
}
- pthread_mutex_unlock(&initMutex);
+ //pthread_mutex_unlock(&initMutex);
U_ASSERT(uio.fState == 2);
return FALSE;
}
@@ -282,10 +282,10 @@

U_COMMON_API void U_EXPORT2
umtx_initImplPostInit(UInitOnce &uio) {
- pthread_mutex_lock(&initMutex);
+ //pthread_mutex_lock(&initMutex);
umtx_storeRelease(uio.fState, 2);
- pthread_cond_broadcast(&initCondition);
- pthread_mutex_unlock(&initMutex);
+ //pthread_cond_broadcast(&initCondition);
+ //pthread_mutex_unlock(&initMutex);
}

U_NAMESPACE_END
diff -Naur icu-native/source/common/umutex.h icu/source/common/umutex.h
--- icu-native/source/common/umutex.h 2018-02-22 16:51:51.137401000 +0000
+++ icu/source/common/umutex.h 2018-02-22 16:51:57.028401000 +0000
@@ -373,16 +373,21 @@
* POSIX platform
*/

-#include <pthread.h>
+//#include <pthread.h>
+
+#define PTHREAD_MUTEX_INITIALIZER 0
+#define PTHREAD_COND_INITIALIZER 0
+//typedef int pthread_mutex_t;
+//typedef int pthread_cond_t;

struct UMutex {
- pthread_mutex_t fMutex;
+ uint32_t fMutex;
};
typedef struct UMutex UMutex;
#define U_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER}

struct UConditionVar {
- pthread_cond_t fCondition;
+ uint32_t fCondition;
};
#define U_CONDITION_INITIALIZER {PTHREAD_COND_INITIALIZER}

diff -Naur icu-native/source/i18n/digitlst.cpp icu/source/i18n/digitlst.cpp
--- icu-native/source/i18n/digitlst.cpp 2018-02-22 16:51:51.102401000 +0000
+++ icu/source/i18n/digitlst.cpp 2018-02-22 16:51:53.855401000 +0000
Expand Down

0 comments on commit 0a00a2b

Please sign in to comment.