linux packaging almost ready

This commit is contained in:
Allen Webster 2016-03-07 14:37:48 -05:00
parent f39bbd880e
commit 369af51feb
3 changed files with 129 additions and 94 deletions

5
buildsuper.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
#!/bin/sh
g++ -Wno-write-strings -std=gnu++0x 4coder_custom.cpp -shared -o 4coder_custom.so -fPIC

View File

@ -1197,7 +1197,7 @@ static void gl_log(
GLsizei length, GLsizei length,
const GLchar* message, const GLchar* message,
const void* userParam const void* userParam
){ ){
printf("GL DEBUG: %s\n", message); printf("GL DEBUG: %s\n", message);
} }
#endif #endif
@ -1227,15 +1227,15 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
else else
{ {
int context_attribs[] = int context_attribs[] =
{ {
GLX_CONTEXT_MAJOR_VERSION_ARB, 4, GLX_CONTEXT_MAJOR_VERSION_ARB, 4,
GLX_CONTEXT_MINOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 3,
GLX_CONTEXT_PROFILE_MASK_ARB , GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, GLX_CONTEXT_PROFILE_MASK_ARB , GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
#if FRED_INTERNAL #if FRED_INTERNAL
GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_DEBUG_BIT_ARB, GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_DEBUG_BIT_ARB,
#endif #endif
None None
}; };
printf("Attribs: %d %d %d %d %d\n", printf("Attribs: %d %d %d %d %d\n",
context_attribs[0], context_attribs[0],
@ -1324,7 +1324,7 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
//TODO(inso): enable vsync if available. this should probably be optional //TODO(inso): enable vsync if available. this should probably be optional
if(strstr(glxExts, "GLX_EXT_swap_control ")){ if(strstr(glxExts, "GLX_EXT_swap_control ")){
PFNGLXSWAPINTERVALEXTPROC glx_swap_interval_ext = PFNGLXSWAPINTERVALEXTPROC glx_swap_interval_ext =
(PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT"); (PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT");
if(glx_swap_interval_ext){ if(glx_swap_interval_ext){
glx_swap_interval_ext(XDisplay, XWindow, 1); glx_swap_interval_ext(XDisplay, XWindow, 1);
@ -1336,10 +1336,10 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
} }
} else if(strstr(glxExts, "GLX_MESA_swap_control ")){ } else if(strstr(glxExts, "GLX_MESA_swap_control ")){
PFNGLXSWAPINTERVALMESAPROC glx_swap_interval_mesa = PFNGLXSWAPINTERVALMESAPROC glx_swap_interval_mesa =
(PFNGLXSWAPINTERVALMESAPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA"); (PFNGLXSWAPINTERVALMESAPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA");
PFNGLXGETSWAPINTERVALMESAPROC glx_get_swap_interval_mesa = PFNGLXGETSWAPINTERVALMESAPROC glx_get_swap_interval_mesa =
(PFNGLXGETSWAPINTERVALMESAPROC) glXGetProcAddressARB((const GLubyte*)"glXGetSwapIntervalMESA"); (PFNGLXGETSWAPINTERVALMESAPROC) glXGetProcAddressARB((const GLubyte*)"glXGetSwapIntervalMESA");
if(glx_swap_interval_mesa){ if(glx_swap_interval_mesa){
glx_swap_interval_mesa(1); glx_swap_interval_mesa(1);
@ -1354,7 +1354,7 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
} }
} else if(strstr(glxExts, "GLX_SGI_swap_control ")){ } else if(strstr(glxExts, "GLX_SGI_swap_control ")){
PFNGLXSWAPINTERVALSGIPROC glx_swap_interval_sgi = PFNGLXSWAPINTERVALSGIPROC glx_swap_interval_sgi =
(PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI"); (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI");
if(glx_swap_interval_sgi){ if(glx_swap_interval_sgi){
glx_swap_interval_sgi(1); glx_swap_interval_sgi(1);
@ -1417,22 +1417,22 @@ ChooseGLXConfig(Display *XDisplay, int XScreenIndex)
glx_config_result Result = {0}; glx_config_result Result = {0};
int DesiredAttributes[] = int DesiredAttributes[] =
{ {
GLX_X_RENDERABLE , True, GLX_X_RENDERABLE , True,
GLX_DRAWABLE_TYPE , GLX_WINDOW_BIT, GLX_DRAWABLE_TYPE , GLX_WINDOW_BIT,
GLX_RENDER_TYPE , GLX_RGBA_BIT, GLX_RENDER_TYPE , GLX_RGBA_BIT,
GLX_X_VISUAL_TYPE , GLX_TRUE_COLOR, GLX_X_VISUAL_TYPE , GLX_TRUE_COLOR,
GLX_RED_SIZE , 8, GLX_RED_SIZE , 8,
GLX_GREEN_SIZE , 8, GLX_GREEN_SIZE , 8,
GLX_BLUE_SIZE , 8, GLX_BLUE_SIZE , 8,
GLX_ALPHA_SIZE , 8, GLX_ALPHA_SIZE , 8,
GLX_DEPTH_SIZE , 24, GLX_DEPTH_SIZE , 24,
GLX_STENCIL_SIZE , 8, GLX_STENCIL_SIZE , 8,
GLX_DOUBLEBUFFER , True, GLX_DOUBLEBUFFER , True,
//GLX_SAMPLE_BUFFERS , 1, //GLX_SAMPLE_BUFFERS , 1,
//GLX_SAMPLES , 4, //GLX_SAMPLES , 4,
None None
}; };
{ {
int ConfigCount; int ConfigCount;
@ -1447,47 +1447,47 @@ ChooseGLXConfig(Display *XDisplay, int XScreenIndex)
{for(int ConfigIndex = 0; {for(int ConfigIndex = 0;
ConfigIndex < ConfigCount; ConfigIndex < ConfigCount;
++ConfigIndex) ++ConfigIndex)
{ {
GLXFBConfig &Config = Configs[ConfigIndex]; GLXFBConfig &Config = Configs[ConfigIndex];
XVisualInfo *VisualInfo = glXGetVisualFromFBConfig(XDisplay, Config); XVisualInfo *VisualInfo = glXGetVisualFromFBConfig(XDisplay, Config);
#if 0 #if 0
printf(" Option %d:\n", ConfigIndex); printf(" Option %d:\n", ConfigIndex);
printf(" Depth: %d\n", VisualInfo->depth); printf(" Depth: %d\n", VisualInfo->depth);
printf(" Bits per channel: %d\n", VisualInfo->bits_per_rgb); printf(" Bits per channel: %d\n", VisualInfo->bits_per_rgb);
printf(" Mask: R%06x G%06x B%06x\n", printf(" Mask: R%06x G%06x B%06x\n",
(uint32)VisualInfo->red_mask, (uint32)VisualInfo->red_mask,
(uint32)VisualInfo->green_mask, (uint32)VisualInfo->green_mask,
(uint32)VisualInfo->blue_mask); (uint32)VisualInfo->blue_mask);
printf(" Class: %d\n", VisualInfo->c_class); printf(" Class: %d\n", VisualInfo->c_class);
#endif #endif
#if 0 #if 0
{for(int ValueIndex = 0; {for(int ValueIndex = 0;
ValueIndex < GLXValueCount; ValueIndex < GLXValueCount;
++ValueIndex) ++ValueIndex)
{ {
glx_value_info &ValueInfo = GLXValues[ValueIndex]; glx_value_info &ValueInfo = GLXValues[ValueIndex];
int Value; int Value;
glXGetFBConfigAttrib(XDisplay, Config, ValueInfo.ID, &Value); glXGetFBConfigAttrib(XDisplay, Config, ValueInfo.ID, &Value);
if(DiffValues[ValueIndex] != Value) if(DiffValues[ValueIndex] != Value)
{ {
printf(" %s: %d\n", ValueInfo.Name, Value); printf(" %s: %d\n", ValueInfo.Name, Value);
DiffValues[ValueIndex] = Value; DiffValues[ValueIndex] = Value;
} }
}} }}
#endif #endif
// TODO(casey): How the hell are you supposed to pick a config here?? // TODO(casey): How the hell are you supposed to pick a config here??
if(ConfigIndex == 0) if(ConfigIndex == 0)
{ {
Result.Found = true; Result.Found = true;
Result.BestConfig = Config; Result.BestConfig = Config;
Result.BestInfo = *VisualInfo; Result.BestInfo = *VisualInfo;
} }
XFree(VisualInfo); XFree(VisualInfo);
}} }}
XFree(Configs); XFree(Configs);
} }
@ -1550,10 +1550,10 @@ InitializeXInput(Display *dpy, Window XWindow)
{for(int32x DeviceIndex = 0; {for(int32x DeviceIndex = 0;
DeviceIndex < DeviceCount; DeviceIndex < DeviceCount;
++DeviceIndex) ++DeviceIndex)
{ {
XIDeviceInfo *Device = DeviceInfo + DeviceIndex; XIDeviceInfo *Device = DeviceInfo + DeviceIndex;
printf("Device %d: %s\n", Device->deviceid, Device->name); printf("Device %d: %s\n", Device->deviceid, Device->name);
}} }}
XIFreeDeviceInfo(DeviceInfo); XIFreeDeviceInfo(DeviceInfo);
#endif #endif
@ -1615,7 +1615,7 @@ InitializeXInput(Display *dpy, Window XWindow)
MappingNotify | MappingNotify |
ExposureMask | ExposureMask |
VisibilityChangeMask VisibilityChangeMask
); );
result.input_method = XOpenIM(dpy, 0, 0, 0); result.input_method = XOpenIM(dpy, 0, 0, 0);
if (!result.input_method){ if (!result.input_method){
@ -1710,7 +1710,7 @@ LinuxMaximizeWindow(Display* d, Window w, b32 maximize){
0, 0,
SubstructureNotifyMask | SubstructureRedirectMask, SubstructureNotifyMask | SubstructureRedirectMask,
&e &e
); );
} }
int int
@ -1824,8 +1824,24 @@ main(int argc, char **argv)
} }
if (linuxvars.custom){ if (linuxvars.custom){
linuxvars.custom_api.get_bindings = (Get_Binding_Data_Function*) linuxvars.custom_api.get_alpha_4coder_version = (_Get_Version_Function*)
dlsym(linuxvars.custom, "get_bindings"); dlsym(linuxvars.custom, "get_alpha_4coder_version");
if (linuxvars.custom_api.get_alpha_4coder_version == 0 ||
linuxvars.custom_api.get_alpha_4coder_version(MAJOR, MINOR, PATCH) == 0){
printf("failed to use 4coder_custom.so: version mismatch\n");
}
else{
linuxvars.custom_api.get_bindings = (Get_Binding_Data_Function*)
dlsym(linuxvars.custom, "get_bindings");
if (linuxvars.custom_api.get_bindings == 0){
printf("failed to use 4coder_custom.so: get_bindings not exported\n");
}
else{
printf("successfully loaded 4coder_custom.so\n");
}
}
} }
#endif #endif

View File

@ -15,8 +15,10 @@
TEMPLATE_DIR="$HOME/Desktop/4coder/release_template/" TEMPLATE_DIR="$HOME/Desktop/4coder/release_template/"
CODE_DIR="$HOME/Desktop/4coder" CODE_DIR="$HOME/Desktop/4coder"
TMP_DIR="/tmp/4coder" TMP_DIR="/tmp/4coder"
OUT_ZIP="$HOME/Desktop/4coder-linux.zip" OUT_ZIP="$HOME/Desktop/4coder-linux-64.zip"
OUT_ZIP_SUPER="$HOME/Desktop/4coder-linux-super.zip" OUT_ZIP_32="$HOME/Desktop/4coder-linux-32.zip"
OUT_ZIP_SUPER="$HOME/Desktop/4coder-linux-super-64.zip"
OUT_ZIP_SUPER_32="$HOME/Desktop/4coder-linux-super-32.zip"
echo "template: $TEMPLATE_DIR" echo "template: $TEMPLATE_DIR"
echo "base: $CODE_DIR" echo "base: $CODE_DIR"
@ -25,40 +27,42 @@ echo "out: $OUT_ZIP"
rm -rf "$OUT_ZIP" rm -rf "$OUT_ZIP"
rm -rf "$OUT_ZIP_SUPER" rm -rf "$OUT_ZIP_SUPER"
rm -rf "$OUT_ZIP_32"
rm -rf "$OUT_ZIP_SUPER_32"
mkdir -p "$TMP_DIR" mkdir -p "$TMP_DIR"
mkdir -p "$TMP_DIR/alpha"
mkdir -p "$TMP_DIR/super"
cat << EOF > "$TMP_DIR/readme.txt"
This is a linux 4coder release.
Brought to you by Mr4thDimention and insofaras.
Enjoy!
EOF
pushd "$CODE_DIR" pushd "$CODE_DIR"
echo "Alpha User" echo "Alpha User"
# ALPHA-32
make clean make clean
make release32 make release32
cp -r "${TEMPLATE_DIR}" "$TMP_DIR/alpha/32" cp -r "${TEMPLATE_DIR}" "$TMP_DIR/alpha"
cp ./4ed ./4ed_app.so "$TMP_DIR/alpha/32/" cp ./4ed ./4ed_app.so "$TMP_DIR/alpha/"
echo " " echo " "
pushd "$TMP_DIR"
zip -r "$OUT_ZIP_32" "$(basename alpha)"
popd
rm -rf "$TMP_DIR/alpha"
echo " "
# ALPHA-64
make clean make clean
make release make release
cp -r "${TEMPLATE_DIR}" "$TMP_DIR/alpha/64" cp -r "${TEMPLATE_DIR}" "$TMP_DIR/alpha"
cp ./4ed ./4ed_app.so "$TMP_DIR/alpha/64/" cp ./4ed ./4ed_app.so "$TMP_DIR/alpha/"
echo " " echo " "
cp "$TMP_DIR/readme.txt" "$TMP_DIR/alpha/readme.txt"
pushd "$TMP_DIR" pushd "$TMP_DIR"
zip -r "$OUT_ZIP" "$(basename alpha)" zip -r "$OUT_ZIP" "$(basename alpha)"
popd popd
rm -rf "$TMP_DIR/alpha"
echo " " echo " "
@ -66,24 +70,34 @@ echo " "
echo "Super User" echo "Super User"
# SUPER-32
make clean make clean
make release32 make release32_super
cp -r "${TEMPLATE_DIR}" "$TMP_DIR/super/32" cp ./4ed ./4ed_app.so ./code/4coder_*.h ./code/4coder_*.cpp "$TMP_DIR/super/"
cp ./4ed ./4ed_app.so ./code/4coder_*.h ./code/4coder_*.cpp "$TMP_DIR/super/32/" cp ./code/buildsuper.sh "$TMP_DIR/super/"
echo " " echo " "
make clean pushd "$TMP_DIR"
make release zip -r "$OUT_ZIP_SUPER_32" "$(basename super)"
cp -r "${TEMPLATE_DIR}" "$TMP_DIR/super/64" popd
cp ./4ed ./4ed_app.so ./code/4coder_*.h ./code/4coder_*.cpp "$TMP_DIR/super/64/" rm -rf "$TMP_DIR/super"
echo " "
# SUPER-64
make clean
make release_super
cp -r "${TEMPLATE_DIR}" "$TMP_DIR/super/"
cp ./4ed ./4ed_app.so ./code/4coder_*.h ./code/4coder_*.cpp "$TMP_DIR/super/"
cp ./code/buildsuper.sh "$TMP_DIR/super/"
echo " " echo " "
cp "$TMP_DIR/readme.txt" "$TMP_DIR/super/readme.txt"
pushd "$TMP_DIR" pushd "$TMP_DIR"
zip -r "$OUT_ZIP_SUPER" "$(basename super)" zip -r "$OUT_ZIP_SUPER" "$(basename super)"
popd popd
rm -rf "$TMP_DIR/super"
echo " " echo " "
@ -95,7 +109,7 @@ rm -rf "$TMP_DIR"
popd popd
echo "Created linux 4coder package: $OUT_ZIP" echo "Created linux 4coder packages"
exit exit