jni: move all compat code in compat folder