clibgen 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/asset/libde265.sh +12 -10
- data/lib/asset/libheif.sh +10 -8
- data/lib/asset/libpng.sh +19 -59
- data/lib/asset/x265.sh +49 -0
- data/lib/libgen/gen.rb +14 -6
- data/lib/libgen/version.rb +1 -1
- metadata +2 -3
- data/lib/asset/Android.mk +0 -49
- data/lib/asset/x256.sh +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12cc7a23cdc26805500a59bce5d8c199a298712730731be16f3e1a6051d3d1af
|
4
|
+
data.tar.gz: c63c426c9212952fbed5b513368093054b98cbaaee1a8ae9acc18d6311714caf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb049118649a4c02ebd3c5dd5a7ee3d0a8d38706bdac202dca97f7ef82e16942478d8851b2a2015717bf8a924508d31a8d89cad3e367c2a081946736c93a0591
|
7
|
+
data.tar.gz: 35a03fa67e0b84d3ad67866cdd04bb9d368faa29335e7a09ba1769fab3006debd849bc0a89f635fe1d964975b65bf7dcee40427a705e3c95ea32ac372084cd6c
|
data/lib/asset/libde265.sh
CHANGED
@@ -3,17 +3,18 @@ ndk_path=$2
|
|
3
3
|
asset_path=$3
|
4
4
|
tmp_path=$root_path/tmp
|
5
5
|
to_ndk_path=$tmp_path/android-ndk
|
6
|
+
toolchain_path=$tmp_path/ndk
|
6
7
|
|
7
|
-
if [ ! -e $tmp_path ]
|
8
|
+
if [ ! -e $tmp_path ]
|
8
9
|
then
|
9
|
-
|
10
|
+
mkdir $tmp_path
|
10
11
|
fi
|
11
12
|
cp -r -n $ndk_path $tmp_path
|
12
13
|
|
13
14
|
if [ ! -e $tmp_path/ndk ]
|
14
|
-
then
|
15
|
-
|
16
|
-
|
15
|
+
then
|
16
|
+
cd $to_ndk_path/build/tools
|
17
|
+
./make_standalone_toolchain.py --arch arm --api 21 --stl libc++ --install-dir $toolchain_path
|
17
18
|
fi
|
18
19
|
|
19
20
|
echo "---------build libde265---------"
|
@@ -27,11 +28,12 @@ fi
|
|
27
28
|
out_dir=$root_path/out/libde265
|
28
29
|
|
29
30
|
cd libde265
|
30
|
-
export CC=$
|
31
|
-
export CXX=$
|
32
|
-
export CFLAGS="-
|
33
|
-
export
|
34
|
-
export
|
31
|
+
export CC=$toolchain_path/bin/arm-linux-androideabi-clang
|
32
|
+
export CXX=$toolchain_path/bin/arm-linux-androideabi-clang++
|
33
|
+
export CFLAGS="-fPIC"
|
34
|
+
export CXXFLAGS="-fPIC"
|
35
|
+
export LDFLAGS="-fPIC"
|
36
|
+
export PATH=$PATH:$toolchain_path/bin
|
35
37
|
sh ./autogen.sh
|
36
38
|
./configure --prefix=$out_dir --enable-shared=no --host=arm-linux-androideabi --disable-arm --disable-sse --disable-sherlock265
|
37
39
|
make -j8 && make install
|
data/lib/asset/libheif.sh
CHANGED
@@ -3,17 +3,18 @@ ndk_path=$2
|
|
3
3
|
asset_path=$3
|
4
4
|
tmp_path=$root_path/tmp
|
5
5
|
to_ndk_path=$tmp_path/android-ndk
|
6
|
+
toolchain_path=$tmp_path/ndk
|
6
7
|
|
7
|
-
if [ ! -e $tmp_path ]
|
8
|
+
if [ ! -e $tmp_path ]
|
8
9
|
then
|
9
|
-
|
10
|
+
mkdir $tmp_path
|
10
11
|
fi
|
11
12
|
cp -r -n $ndk_path $tmp_path
|
12
13
|
|
13
14
|
if [ ! -e $tmp_path/ndk ]
|
14
|
-
then
|
15
|
-
|
16
|
-
|
15
|
+
then
|
16
|
+
cd $to_ndk_path/build/tools
|
17
|
+
./make_standalone_toolchain.py --arch arm --api 21 --stl libc++ --install-dir $toolchain_path
|
17
18
|
fi
|
18
19
|
|
19
20
|
echo "---------build libheif---------"
|
@@ -27,8 +28,8 @@ fi
|
|
27
28
|
cd libheif
|
28
29
|
sh ./autogen.sh
|
29
30
|
|
30
|
-
export CC=$
|
31
|
-
export CXX=$
|
31
|
+
export CC=$toolchain_path/bin/arm-linux-androideabi-clang
|
32
|
+
export CXX=$toolchain_path/bin/arm-linux-androideabi-clang++
|
32
33
|
export CFLAGS="-fPIE -Wno-tautological-constant-compare"
|
33
34
|
export CXXFLAGS="-fPIE -Wno-tautological-constant-compare"
|
34
35
|
export LDFLAGS="-fPIE -pie"
|
@@ -36,4 +37,5 @@ export PKG_CONFIG_PATH=$root_path/out/x265/lib/pkgconfig:$root_path/out/libde265
|
|
36
37
|
export PATH=$PATH:$tmp_path/ndk/bin
|
37
38
|
|
38
39
|
out_dir=$root_path/out/libheif
|
39
|
-
./configure --prefix=$out_dir --host=arm-linux-androideabi
|
40
|
+
./configure --prefix=$out_dir --host=arm-linux-androideabi --disable-go
|
41
|
+
make -j8 && make install
|
data/lib/asset/libpng.sh
CHANGED
@@ -2,13 +2,22 @@ root_path=$1
|
|
2
2
|
ndk_path=$2
|
3
3
|
asset_path=$3
|
4
4
|
tmp_path=$root_path/tmp
|
5
|
+
to_ndk_path=$tmp_path/android-ndk
|
6
|
+
toolchain_path=$tmp_path/ndk
|
5
7
|
|
6
|
-
if [ ! -e $tmp_path ]
|
8
|
+
if [ ! -e $tmp_path ]
|
7
9
|
then
|
8
|
-
|
10
|
+
mkdir $tmp_path
|
9
11
|
fi
|
12
|
+
cp -r -n $ndk_path $tmp_path
|
10
13
|
|
11
|
-
|
14
|
+
if [ ! -e $tmp_path/ndk ]
|
15
|
+
then
|
16
|
+
cd $to_ndk_path/build/tools
|
17
|
+
./make_standalone_toolchain.py --arch arm --api 21 --stl libc++ --install-dir $toolchain_path
|
18
|
+
fi
|
19
|
+
|
20
|
+
echo "---------build libpng---------"
|
12
21
|
|
13
22
|
cd $tmp_path
|
14
23
|
if [ ! -e ./libpng ]
|
@@ -16,61 +25,12 @@ then
|
|
16
25
|
git clone https://github.com/glennrp/libpng.git -q
|
17
26
|
fi
|
18
27
|
|
19
|
-
|
20
|
-
then
|
21
|
-
git clone https://github.com/julienr/libpng-android.git -q
|
22
|
-
fi
|
23
|
-
|
24
|
-
if [ ! -e ./zlib ]
|
25
|
-
then
|
26
|
-
git clone https://github.com/madler/zlib.git -q
|
27
|
-
fi
|
28
|
-
|
29
|
-
cd $tmp_path/libpng-android/jni
|
30
|
-
|
31
|
-
|
28
|
+
out_dir=$root_path/out/libpng
|
32
29
|
cd $tmp_path/libpng
|
33
30
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
cp -f -r $tmp_path/libpng/$filename $tmp_path/libpng-android/jni/
|
41
|
-
else
|
42
|
-
cp -f $tmp_path/libpng/$filename $tmp_path/libpng-android/jni/$filename
|
43
|
-
fi
|
44
|
-
|
45
|
-
fi
|
46
|
-
done
|
47
|
-
|
48
|
-
cd $tmp_path/zlib
|
49
|
-
|
50
|
-
for filename in * ;
|
51
|
-
do
|
52
|
-
if [[ $filename = *.h ]] || [[ $filename = *.c ]];
|
53
|
-
then
|
54
|
-
cp -f $tmp_path/zlib/$filename $tmp_path/libpng-android/jni/$filename
|
55
|
-
fi
|
56
|
-
done
|
57
|
-
|
58
|
-
cd $tmp_path/libpng-android/jni
|
59
|
-
|
60
|
-
android_content=`cat Application.mk`
|
61
|
-
if [[ ! $android_content == *"APP_PLATFORM"* ]]
|
62
|
-
then
|
63
|
-
echo 'APP_PLATFORM := android-16' >> Application.mk
|
64
|
-
fi
|
65
|
-
cp -r $asset_path/Android.mk $tmp_path/libpng-android/jni/Android.mk
|
66
|
-
|
67
|
-
|
68
|
-
cd $tmp_path/libpng-android
|
69
|
-
./build.sh
|
70
|
-
|
71
|
-
out_dir=$root_path/out/libpng
|
72
|
-
if [ ! -e $out_dir ]
|
73
|
-
then
|
74
|
-
mkdir -p $out_dir
|
75
|
-
fi
|
76
|
-
cp -f -r $tmp_path/libpng-android/obj $out_dir
|
31
|
+
export CC=$toolchain_path/bin/arm-linux-androideabi-clang
|
32
|
+
export CFLAGS='-fPIE -fno-integrated-as'
|
33
|
+
export LDFLAGS='-fPIE -pie'
|
34
|
+
export PATH=$PATH:$toolchain_path/bin
|
35
|
+
./configure --prefix=$out_dir --host=arm-linux-androideabi --enable-shared=no --enable-arm-neon
|
36
|
+
make -j8 && make install
|
data/lib/asset/x265.sh
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
root_path=$1
|
2
|
+
ndk_path=$2
|
3
|
+
asset_path=$3
|
4
|
+
tmp_path=$root_path/tmp
|
5
|
+
to_ndk_path=$tmp_path/android-ndk
|
6
|
+
toolchain_path=$tmp_path/ndk
|
7
|
+
|
8
|
+
if [ ! -e $tmp_path ]
|
9
|
+
then
|
10
|
+
mkdir $tmp_path
|
11
|
+
fi
|
12
|
+
cp -r -n $ndk_path $tmp_path
|
13
|
+
|
14
|
+
if [ ! -e $tmp_path/ndk ]
|
15
|
+
then
|
16
|
+
cd $to_ndk_path/build/tools
|
17
|
+
./make_standalone_toolchain.py --arch arm --api 21 --stl libc++ --install-dir $toolchain_path
|
18
|
+
fi
|
19
|
+
|
20
|
+
echo "---------build x265-----------"
|
21
|
+
cd $tmp_path
|
22
|
+
if [ ! -e ./x265 ]
|
23
|
+
then
|
24
|
+
git clone https://github.com/videolan/x265 -q
|
25
|
+
fi
|
26
|
+
|
27
|
+
cd $tmp_path/x265/source/common/
|
28
|
+
cpu_content=`cat cpu.cpp`
|
29
|
+
replace_str1="void PFX(cpu_neon_test)(void) {}"
|
30
|
+
replace_str2="int PFX(cpu_fast_neon_mrc_test)(void) { return 0; }"
|
31
|
+
if [[ "$cpu_content" != *$replace_str1* ]]
|
32
|
+
then
|
33
|
+
sed -i '' 's/void PFX(cpu_neon_test)(void);/void PFX(cpu_neon_test)(void) {}/g' "cpu.cpp"
|
34
|
+
fi
|
35
|
+
if [[ "$cpu_content" != *$replace_str2* ]]
|
36
|
+
then
|
37
|
+
sed -i '' 's/int PFX(cpu_fast_neon_mrc_test)(void);/int PFX(cpu_fast_neon_mrc_test)(void) { return 0; }/g' 'cpu.cpp'
|
38
|
+
fi
|
39
|
+
|
40
|
+
out_dir=$root_path/out/x265
|
41
|
+
|
42
|
+
cd $tmp_path/x265/build
|
43
|
+
mkdir -p arm-android && cd arm-android
|
44
|
+
cmake -DCROSS_COMPILE_ARM=1 -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=armv7l \
|
45
|
+
-DCMAKE_C_COMPILER=$toolchain_path/bin/arm-linux-androideabi-clang -DCMAKE_CXX_COMPILER=$toolchain_path/bin/arm-linux-androideabi-clang++ \
|
46
|
+
-DCMAKE_FIND_ROOT_PATH=$toolchain_path/sysroot -DENABLE_ASSEMBLY=OFF -DENABLE_CLI=OFF \
|
47
|
+
-DENABLE_PIC=ON -DENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=$out_dir -DCMAKE_C_FLAGS="" \
|
48
|
+
-G "Unix Makefiles" ../../source
|
49
|
+
make -j8 && make install
|
data/lib/libgen/gen.rb
CHANGED
@@ -9,7 +9,7 @@ module Gen
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.tmp_dir
|
12
|
-
"/tmp/libgen"
|
12
|
+
"/tmp/com.app.libgen.747528f1"
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.asset_path
|
@@ -23,7 +23,7 @@ module Gen
|
|
23
23
|
def self.run
|
24
24
|
options = {}
|
25
25
|
OptionParser.new do |opts|
|
26
|
-
opts.banner = "Usage: 编译C/C++库为提供安卓/ios
|
26
|
+
opts.banner = "Usage: 编译C/C++库为提供安卓/ios所用, 请自行下载NDK工具包"
|
27
27
|
|
28
28
|
opts.on("-o", "--out folder", "输入目录") do |v|
|
29
29
|
options[:out] = v
|
@@ -33,10 +33,9 @@ module Gen
|
|
33
33
|
options[:ndk] = v
|
34
34
|
end
|
35
35
|
|
36
|
-
opts.on("-l", "--lib lib",Array,"库名称,例如:libpng、
|
36
|
+
opts.on("-l", "--lib lib",Array,"库名称,例如:libpng、x265、libde265、libheif ...") do |v|
|
37
37
|
options[:lib] = v
|
38
38
|
end
|
39
|
-
|
40
39
|
end.parse!
|
41
40
|
|
42
41
|
out_dir = options[:out]
|
@@ -45,8 +44,8 @@ module Gen
|
|
45
44
|
|
46
45
|
if file_exist? tmp_dir
|
47
46
|
`rm -rf #{tmp_dir}`
|
48
|
-
`mkdir #{tmp_dir}`
|
49
47
|
end
|
48
|
+
`mkdir -p #{tmp_dir}`
|
50
49
|
|
51
50
|
if !(file_exist?(out_dir) && file_exist?(ndk_dir))
|
52
51
|
puts "指定的目录不存在".colorize(:red)
|
@@ -54,16 +53,25 @@ module Gen
|
|
54
53
|
end
|
55
54
|
|
56
55
|
lib_type.each do |lib|
|
56
|
+
if lib == "libheif"
|
57
|
+
["x265", "libde265" , "libpng"].each do |dlib|
|
58
|
+
buildlib out_dir, ndk_dir, dlib
|
59
|
+
end
|
60
|
+
end
|
57
61
|
buildlib out_dir, ndk_dir, lib
|
58
62
|
end
|
59
63
|
|
60
64
|
if lib_type.length == 0
|
61
|
-
puts "请指定 -t,可选为 [libpng、
|
65
|
+
puts "请指定 -t,可选为 [libpng、x265、libde265、libheif]"
|
62
66
|
end
|
63
67
|
|
64
68
|
`cp -r -f "#{tmp_dir}/out" "#{out_dir}"`
|
65
69
|
puts "任务完成,请查看目标目录".colorize(:green)
|
66
70
|
`open #{out_dir}`
|
71
|
+
|
72
|
+
if file_exist? tmp_dir
|
73
|
+
`rm -rf #{tmp_dir}`
|
74
|
+
end
|
67
75
|
end
|
68
76
|
|
69
77
|
def self.buildlib(out_dir, ndk_dir, lib)
|
data/lib/libgen/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clibgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaich
|
@@ -84,11 +84,10 @@ files:
|
|
84
84
|
- Rakefile
|
85
85
|
- bin/.DS_Store
|
86
86
|
- bin/clibgen
|
87
|
-
- lib/asset/Android.mk
|
88
87
|
- lib/asset/libde265.sh
|
89
88
|
- lib/asset/libheif.sh
|
90
89
|
- lib/asset/libpng.sh
|
91
|
-
- lib/asset/
|
90
|
+
- lib/asset/x265.sh
|
92
91
|
- lib/libgen.rb
|
93
92
|
- lib/libgen/gen.rb
|
94
93
|
- lib/libgen/version.rb
|
data/lib/asset/Android.mk
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
LOCAL_PATH := $(call my-dir)
|
2
|
-
include $(CLEAR_VARS)
|
3
|
-
|
4
|
-
LOCAL_CFLAGS :=
|
5
|
-
|
6
|
-
LOCAL_MODULE := libpng
|
7
|
-
LOCAL_SRC_FILES :=\
|
8
|
-
adler32.c \
|
9
|
-
compress.c \
|
10
|
-
crc32.c \
|
11
|
-
deflate.c \
|
12
|
-
example.c \
|
13
|
-
gzclose.c \
|
14
|
-
gzlib.c \
|
15
|
-
gzread.c \
|
16
|
-
gzwrite.c \
|
17
|
-
infback.c \
|
18
|
-
inffast.c \
|
19
|
-
inflate.c \
|
20
|
-
inftrees.c \
|
21
|
-
png.c \
|
22
|
-
pngerror.c \
|
23
|
-
pngget.c \
|
24
|
-
pngmem.c \
|
25
|
-
pngpread.c \
|
26
|
-
pngread.c \
|
27
|
-
pngrio.c \
|
28
|
-
pngrtran.c \
|
29
|
-
pngrutil.c \
|
30
|
-
pngset.c \
|
31
|
-
pngtest.c \
|
32
|
-
pngtrans.c \
|
33
|
-
pngwio.c \
|
34
|
-
pngwrite.c \
|
35
|
-
pngwtran.c \
|
36
|
-
pngwutil.c \
|
37
|
-
trees.c \
|
38
|
-
uncompr.c \
|
39
|
-
zutil.c \
|
40
|
-
arm/filter_neon_intrinsics.c \
|
41
|
-
arm/palette_neon_intrinsics.c \
|
42
|
-
arm/arm_init.c
|
43
|
-
|
44
|
-
#LOCAL_SHARED_LIBRARIES := -lz
|
45
|
-
LOCAL_EXPORT_LDLIBS := -lz
|
46
|
-
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.
|
47
|
-
|
48
|
-
# include $(BUILD_SHARED_LIBRARY)
|
49
|
-
include $(BUILD_STATIC_LIBRARY)
|
data/lib/asset/x256.sh
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
root_path=$1
|
2
|
-
ndk_path=$2
|
3
|
-
asset_path=$3
|
4
|
-
tmp_path=$root_path/tmp
|
5
|
-
to_ndk_path=$tmp_path/android-ndk
|
6
|
-
|
7
|
-
if [ ! -e $tmp_path ]
|
8
|
-
then
|
9
|
-
mkdir $tmp_path
|
10
|
-
fi
|
11
|
-
cp -r -n $ndk_path $tmp_path
|
12
|
-
|
13
|
-
if [ ! -e $tmp_path/ndk ]
|
14
|
-
then
|
15
|
-
cd $to_ndk_path/build/tools
|
16
|
-
./make_standalone_toolchain.py --arch arm --api 21 --stl libc++ --install-dir $tmp_path/ndk
|
17
|
-
fi
|
18
|
-
|
19
|
-
echo "---------build x265-----------"
|
20
|
-
cd $tmp_path
|
21
|
-
git clone https://github.com/videolan/x265 -q
|
22
|
-
|
23
|
-
out_dir=$root_path/out/x256
|
24
|
-
|
25
|
-
cd $tmp_path/x265/build
|
26
|
-
mkdir -p arm-android && cd arm-android
|
27
|
-
cmake -DCROSS_COMPILE_ARM=1 -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=armv7l \
|
28
|
-
-DCMAKE_C_COMPILER=/tmp/ndk/bin/arm-linux-androideabi-clang -DCMAKE_CXX_COMPILER=/tmp/ndk/bin/arm-linux-androideabi-clang++ \
|
29
|
-
-DCMAKE_FIND_ROOT_PATH=/tmp/ndk/sysroot -DENABLE_ASSEMBLY=OFF -DENABLE_CLI=OFF \
|
30
|
-
-DENABLE_PIC=ON -DENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=$out_dir -DCMAKE_C_FLAGS="" \
|
31
|
-
-G "Unix Makefiles" ../../source
|
32
|
-
make -j8 && make install
|