{"id":15608929,"url":"https://github.com/pcboy/alonexec","last_synced_at":"2025-04-06T09:29:38.268Z","repository":{"id":26063225,"uuid":"29506839","full_name":"pcboy/alonexec","owner":"pcboy","description":"Alonexec is a little tool for creating all-in-one executables","archived":false,"fork":false,"pushed_at":"2015-01-20T02:22:58.000Z","size":508,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T15:17:45.792Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pcboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-20T02:03:03.000Z","updated_at":"2015-01-20T02:23:38.000Z","dependencies_parsed_at":"2022-08-24T15:01:30.902Z","dependency_job_id":null,"html_url":"https://github.com/pcboy/alonexec","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcboy%2Falonexec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcboy%2Falonexec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcboy%2Falonexec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcboy%2Falonexec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcboy","download_url":"https://codeload.github.com/pcboy/alonexec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247463666,"owners_count":20942935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T05:40:30.818Z","updated_at":"2025-04-06T09:29:38.239Z","avatar_url":"https://github.com/pcboy.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Alonexec\r\n--------\r\n\r\nSo. What's Alonexec ? Sometimes, I work for non-geek people. So,\r\nsometimes I really need to deliver only one executable to the final\r\nend-user. I want the end-user to do just one click for starting the\r\napplication. It seems obvious for little applications, but for big ones,\r\nthere is not just one executable. That's the purpose of Alonexec. For\r\ninstance, my software needs an sqlite database, and some little others\r\nfiles to work. Alonexec will \"pack\" everything in only one binary. When\r\nstarted, everything will be extracted in a temporary directory, and the\r\nbinaries you want, will be executed directly after that. Don't worry,\r\nit's pretty fast.\r\n\r\n### Note that Alonexec is under active development and shouldn't be used in a production environment.\r\n\r\nHow to use it ?\r\n---------------\r\n\r\nAlonexec is not very complex to use. I will use an example, it will be\r\neasier.\r\n\r\n      ./alonexec\r\n        ./linux.alonexec\r\n        ./tcc\r\n        ../rsrc/spec.h\r\n\r\nThe linux.alonexec looks like that (it's just an example, it's for\r\nalonexecing alonexec on a Linux platform):\r\n\r\n      (alonexec\r\n         (sourcepath \"alonexec\")\r\n         (destpath \"alonexec\")\r\n         (mode \"rwxr-xr-x\")\r\n         (autostart true))\r\n\r\n        (linux.alonexec\r\n         (sourcepath \"linux.alonexec\")\r\n         (destpath \"linux.alonexec\")\r\n         (mode \"rwxr-xr-x\")\r\n         (autostart false))\r\n\r\n        (spec.h\r\n         (sourcepath \"../rsrc/spec.h\")\r\n         (destpath \"../rsrc/spec.h\")\r\n         (mode \"rwxr-xr-x\")\r\n         (autostart false))\r\n\r\n        (tcc\r\n         (sourcepath \"tcc\")\r\n         (destpath \"tcc\")\r\n         (mode \"rwxr-xr-x\")\r\n         (autostart false))\r\n\r\nSo, as you can see, the template file uses a s-expression syntax\r\n(yeah!). You must pass this type of template as first argument to\r\nalonexec. Sourcepath is the path (relative to alonexec binary or\r\nabsolute path) of the file you want to pack. Destpath will be used after\r\nextraction in the temporary directory. Most of time (it's a specific\r\ncase here) you DON'T want '..' paths there. Mode is the permissions\r\nwhich will be setted on the file before execution. Autostart, a boolean\r\nvalue, if you want to execute the file after extraction or not. Alonexec\r\nwill print the full list of generated .c in this manner:\r\n\r\n       pcboy@home build % alonexec test.alonexec\r\n        Packing test\r\n        /tmp/alonexectmp.223976034/alonexecgen.c\r\n        /tmp/alonexectmp.223976034/test.c\r\n\r\nNow you just have to compile these .c files with your favorite compiler.\r\nYou can also use alonexecc which call cc automatically on the files.\r\n\r\n       pcboy@home build % ./alonexec\r\n        pcboy@home build % alonexecc\r\n        /usr/local/bin/alonexecc file.alonexec destbinary\r\n        pcboy@home build % alonexecc test.alonexec tartine\r\n        /tmp/alonexectmp.642142850/alonexecgen.c\r\n        /tmp/alonexectmp.642142850/test.c\r\n        pcboy@home build % ls -l tartine\r\n        -rwxr-xr-x 1 pcboy pcboy 19125 Jul 22 04:03 tartine\r\n\r\n### Need any aguments ?\r\n\r\nBecause I wanted to keep that as KISS as possible, there is no direct\r\nway for adding arguments to executables for autostarting. But don't\r\nworry, you can do it easily. Look at this template:\r\n\r\n        (program1\r\n         (sourcepath \"program1\")\r\n         (destpath \"program1\")\r\n         (mode \"r-xr-xr-x)\r\n         (autostart false))\r\n\r\n        (launcher\r\n         (sourcepath \"launcher.sh\")\r\n         (destpath \"launcher.sh\")\r\n         (mode \"r-xr-xr-x\")\r\n         (autostart true))\r\n\r\nprogram1 is the program you want to run. But as you can see, I didn't\r\nset the autostart flag. I've included another script named launcher.sh\r\n**with** the autostart flag. In launcher.sh:\r\n\r\n        #!/usr/bin/env sh\r\n        program1 first_arg second_arg\r\n\r\nWhen the final binary generated by alonexec will be launched, the script\r\nlauncher.sh will starts the binary program1 with good arguments. Easy.\r\n\r\nExamples\r\n--------\r\n\r\nJust a little example showing the possibilities. You want to make a\r\nbinary which shows automatically a video after clicking on it ? In a way\r\nthat works everywhere (on the same OS of course) without dependencies ?\r\nTemplate:\r\n\r\n        (video\r\n         (sourcepath \"video.avi\")\r\n         (destpath \"video.avi\")\r\n         (mode \"r--r--r--\")\r\n         (autostart false))\r\n\r\n        (player\r\n         (sourcepath \"player\")\r\n         (destpath \"player\")\r\n         (mode \"r-xr-xr-x\")\r\n         (autostart false))\r\n\r\n        (launcher\r\n         (sourcepath \"launcher.sh\")\r\n         (destpath \"launcher.sh\")\r\n         (mode \"r-xr-xr-x\")\r\n         (autostart true))\r\n\r\nPlayer is a statically compiled mplayer (for instance). And here is the\r\nlauncher script:\r\n\r\n        #!/usr/bin/env sh\r\n        ./player video.avi\r\n\r\nJust a click, and BAM! self-executable video. (don't do that with too\r\nbig videos of course)\r\n\r\nAnother one. Here is a ldd on a library:\r\n\r\n        linux-gate.so.1 =\u003e  (0xffffe000)\r\n        libQtGui.so.4 =\u003e /usr/lib/qt4/libQtGui.so.4 (0xb6c62000)\r\n        libpng14.so.14 =\u003e /usr/lib/libpng14.so.14 (0xb6c3c000)\r\n        libSM.so.6 =\u003e /usr/lib/libSM.so.6 (0xb6c33000)\r\n        libICE.so.6 =\u003e /usr/lib/libICE.so.6 (0xb6c1a000)\r\n        libXrender.so.1 =\u003e /usr/lib/libXrender.so.1 (0xb6c0f000)\r\n        libXrandr.so.2 =\u003e /usr/lib/libXrandr.so.2 (0xb6c06000)\r\n        libXcursor.so.1 =\u003e /usr/lib/libXcursor.so.1 (0xb6bfb000)\r\n        libXfixes.so.3 =\u003e /usr/lib/libXfixes.so.3 (0xb6bf5000)\r\n        libfreetype.so.6 =\u003e /usr/lib/libfreetype.so.6 (0xb6b6f000)\r\n        libfontconfig.so.1 =\u003e /usr/lib/libfontconfig.so.1 (0xb6b3e000)\r\n        libXext.so.6 =\u003e /usr/lib/libXext.so.6 (0xb6b2e000)\r\n        libX11.so.6 =\u003e /usr/lib/libX11.so.6 (0xb6a11000)\r\n        libQtSql.so.4 =\u003e /usr/lib/qt4/libQtSql.so.4 (0xb69c5000)\r\n        libQtNetwork.so.4 =\u003e /usr/lib/qt4/libQtNetwork.so.4 (0xb6880000)\r\n        libssl.so.0.9.8 =\u003e /usr/lib/libssl.so.0.9.8 (0xb6837000)\r\n        libQtCore.so.4 =\u003e /usr/lib/qt4/libQtCore.so.4 (0xb657e000)\r\n        libz.so.1 =\u003e /lib/libz.so.1 (0xb656b000)\r\n        libgthread-2.0.so.0 =\u003e /usr/lib/libgthread-2.0.so.0 (0xb6565000)\r\n        libglib-2.0.so.0 =\u003e /usr/lib/libglib-2.0.so.0 (0xb647b000)\r\n        librt.so.1 =\u003e /lib/librt.so.1 (0xb6472000)\r\n        libpthread.so.0 =\u003e /lib/libpthread.so.0 (0xb6459000)\r\n        libdl.so.2 =\u003e /lib/libdl.so.2 (0xb6454000)\r\n        libstdc++.so.6 =\u003e /usr/local/lib/libstdc++.so.6 (0xb6358000)\r\n        libm.so.6 =\u003e /lib/libm.so.6 (0xb6332000)\r\n        libgcc_s.so.1 =\u003e /usr/local/lib/libgcc_s.so.1 (0xb6314000)\r\n        libc.so.6 =\u003e /lib/libc.so.6 (0xb61cb000)\r\n        libpng12.so.0 =\u003e /usr/lib/libpng12.so.0 (0xb61a5000)\r\n        libgobject-2.0.so.0 =\u003e /usr/lib/libgobject-2.0.so.0 (0xb6164000)\r\n        libXinerama.so.1 =\u003e /usr/lib/libXinerama.so.1 (0xb6160000)\r\n        libuuid.so.1 =\u003e /lib/libuuid.so.1 (0xb615b000)\r\n        libexpat.so.1 =\u003e /usr/lib/libexpat.so.1 (0xb6130000)\r\n        libxcb.so.1 =\u003e /usr/lib/libxcb.so.1 (0xb6114000)\r\n        libcrypto.so.0.9.8 =\u003e /usr/lib/libcrypto.so.0.9.8 (0xb5fc5000)\r\n        /lib/ld-linux.so.2 (0xb76e7000)\r\n        libXau.so.6 =\u003e /usr/lib/libXau.so.6 (0xb5fc1000)\r\n        libXdmcp.so.6 =\u003e /usr/lib/libXdmcp.so.6 (0xb5fbb000)\r\n\r\nGod. So many shared libraries. It will be a pain in the ass to run it\r\neverywhere. But you could alonexec it.\r\n\r\n        pcboy@home $\u003e IFS=$'\\n'; for i in `ldd ./my_binary | awk {'print $3'} | grep \\/`;do cp \"$i\" ./;done\r\n\r\nIt will copy every shared library to the actual dir. Next we need to\r\ncreate an alonexec template.\r\n\r\n        pcboy@home $\u003e IFS=$'\\n'; for i in `ldd ./my_binary | awk {'print $1'}`;do echo \\\r\n        \"($i (sourcepath $i) (destpath $i) (mode 'rwxr-xr-x')(autostart false))\"\\\r\n        \u003e\u003e static.alonexec;done\r\n\r\nNo we have a static.alonexec full of shared libraries.\r\n\r\n-   Warning: You \\_must\\_ remove some of them. Especially libdl.so.x,\r\n    linux-gate.so.1, and /lib/ld-linux.so.2. But some others could be\r\n    removed too (like libc). Otherwise it will not work properly on\r\n    other systems.\\* We need two more entries in our static.alonexec\r\n    template. One for my\\_binary and a script which will start it with a\r\n    LD\\_LIBRARY\\_PATH=\"\\`dirname \\$0\\`\".\r\n\r\n\u003c!-- --\u003e\r\n\r\n        (my_binary (sourcepath my_binary) (destpath my_binary) (mode 'rwxr-xr-x')(autostart false))\r\n        (starter.sh (sourcepath starter.sh) (destpath starter.sh) (mode 'rwxr-xr-x')(autostart true))\r\n\r\nstarter.sh:\r\n\r\n        #!/bin/sh\r\n        LD_LIBRARY_PATH=\"`dirname $0`\" ./my_binary\r\n\r\nHere we go. When you will start the binary made by alonexec, starter.sh\r\nwill be launched and my\\_binary will run with all the shared libs in its\r\nfolder.\r\n\r\nLicense\r\n-------\r\n\r\nAlonexec is under the Do What The Fuck You Want To Public License\r\n(WTFPL).\r\n\r\nPlatforms\r\n---------\r\n\r\nLinux \u0026 Win32.\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcboy%2Falonexec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcboy%2Falonexec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcboy%2Falonexec/lists"}