Przeglądaj źródła

chage to compile

잉여개발기 (SPDV) 3 lat temu
rodzic
commit
f502753e6b

+ 16 - 4
app.py

@@ -6,6 +6,10 @@ import ctypes
 from route.tool.func import *
 from route import *
 
+if platform.system() == 'Linux':
+    for for_a in os.listdir("route_go"):
+        os.system('chmod -x ./route_go/' + for_a)
+
 # Init-Version
 with open('version.json', encoding = 'utf8') as file_data:
     version_list = json.loads(file_data.read())
@@ -641,18 +645,26 @@ app.route('/easter_egg')(main_func_easter_egg)
 
 def main_easter_egg_go():
     with get_db_connect() as conn:
-        lib = ctypes.cdll.LoadLibrary('./route_go/main_easter_egg.so')
-        lib.Do.restype = ctypes.c_char_p
+        print(platform.machine())
+        if platform.system() == 'Linux':
+            if platform.machine() == 'AMD64':
+                data = os.popen(os.path.join(".", "route_go", "main_easter_egg.amd64.bin")).read()
+            else:
+                data = os.popen(os.path.join(".", "route_go", "main_easter_egg.arm64.bin")).read()
+        else:
+            if platform.machine() == 'AMD64':
+                data = os.popen(os.path.join(".", "route_go", "main_easter_egg.amd64.exe")).read()
+            else:
+                data = os.popen(os.path.join(".", "route_go", "main_easter_egg.arm64.exe")).read()
 
         return easy_minify(flask.render_template(skin_check(),
             imp = ['Easter Egg', wiki_set(), wiki_custom(), wiki_css([0, 0])],
-            data = str(lib.Do(), 'utf-8'),
+            data = data,
             menu = 0
         ))
 
 app.route('/easter_egg_go')(main_easter_egg_go)
 
-
 # views -> view
 app.route('/view/<path:name>')(main_view)
 app.route('/views/<path:name>')(main_view)

BIN
main_easter_egg


+ 22 - 0
route_go/linux_amd64.sh

@@ -0,0 +1,22 @@
+echo "file_name : "
+read file_name
+
+export GOOS=linux
+export GOARCH=amd64
+go build $file_name.go
+mv $file_name $file_name.amd64.bin
+
+export GOOS=linux
+export GOARCH=arm64
+go build $file_name.go
+mv $file_name $file_name.arm64.bin
+
+export GOOS=windows
+export GOARCH=amd64
+go build $file_name.go
+mv $file_name.exe $file_name.amd64.exe
+
+export GOOS=windows
+export GOARCH=arm64
+go build $file_name.go
+mv $file_name.exe $file_name.arm64.exe

BIN
route_go/main_easter_egg.amd64.bin


BIN
route_go/main_easter_egg.amd64.exe


BIN
route_go/main_easter_egg.arm64.bin


BIN
route_go/main_easter_egg.arm64.exe


+ 3 - 8
route_go/main_easter_egg.go

@@ -1,12 +1,11 @@
 package main
 
 import (
-	"C"
+	"fmt"
 	"math/rand"
 )
 
-//export Do
-func Do() *C.char {
+func main() {
 	select_list := []string{
 		"PWD0ZbR7AOY",
 		"HoU29ljOmTE",
@@ -24,9 +23,5 @@ func Do() *C.char {
 	}
 	select_str := select_list[rand.Intn(len(select_list)-1)]
 
-	return C.CString("<iframe width=\"640\" height=\"360\" src=\"https://www.youtube.com/embed/" + select_str + "\" frameborder=\"0\" allowfullscreen></iframe>")
-}
-
-func main() {
-
+	fmt.Println("<iframe width=\"640\" height=\"360\" src=\"https://www.youtube.com/embed/" + select_str + "\" frameborder=\"0\" allowfullscreen></iframe>")
 }

+ 0 - 75
route_go/main_easter_egg.h

@@ -1,75 +0,0 @@
-/* Code generated by cmd/cgo; DO NOT EDIT. */
-
-/* package command-line-arguments */
-
-
-#line 1 "cgo-builtin-export-prolog"
-
-#include <stddef.h> /* for ptrdiff_t below */
-
-#ifndef GO_CGO_EXPORT_PROLOGUE_H
-#define GO_CGO_EXPORT_PROLOGUE_H
-
-#ifndef GO_CGO_GOSTRING_TYPEDEF
-typedef struct { const char *p; ptrdiff_t n; } _GoString_;
-#endif
-
-#endif
-
-/* Start of preamble from import "C" comments.  */
-
-
-
-
-/* End of preamble from import "C" comments.  */
-
-
-/* Start of boilerplate cgo prologue.  */
-#line 1 "cgo-gcc-export-header-prolog"
-
-#ifndef GO_CGO_PROLOGUE_H
-#define GO_CGO_PROLOGUE_H
-
-typedef signed char GoInt8;
-typedef unsigned char GoUint8;
-typedef short GoInt16;
-typedef unsigned short GoUint16;
-typedef int GoInt32;
-typedef unsigned int GoUint32;
-typedef long long GoInt64;
-typedef unsigned long long GoUint64;
-typedef GoInt64 GoInt;
-typedef GoUint64 GoUint;
-typedef __SIZE_TYPE__ GoUintptr;
-typedef float GoFloat32;
-typedef double GoFloat64;
-typedef float _Complex GoComplex64;
-typedef double _Complex GoComplex128;
-
-/*
-  static assertion to make sure the file is being used on architecture
-  at least with matching size of GoInt.
-*/
-typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
-
-#ifndef GO_CGO_GOSTRING_TYPEDEF
-typedef _GoString_ GoString;
-#endif
-typedef void *GoMap;
-typedef void *GoChan;
-typedef struct { void *t; void *v; } GoInterface;
-typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
-
-#endif
-
-/* End of boilerplate cgo prologue.  */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char* Do();
-
-#ifdef __cplusplus
-}
-#endif

BIN
route_go/main_easter_egg.so