avast / retdec

RetDec is a retargetable machine-code decompiler based on LLVM.
https://retdec.com/
MIT License
8.02k stars 945 forks source link

Connect RetDec to a continuous integration service supporting FreeBSD #493

Open s3rvac opened 5 years ago

s3rvac commented 5 years ago

At present, RetDec can be built on Windows, Linux, macOS, and (experimentally) on FreeBSD (#476). However, we have continuous integration only for Windows, Linux, and macOS. As suggested here, it would be a good idea to also connect RetDec to a continuous integration service supporting FreeBSD, such as https://cirrus-ci.com/.

As we have no experience with FreeBSD, we encourage the community to help. For inspiration, you can take a look at .appveyor.yml and .travis.yml.

gwquk commented 5 years ago

Great! Also the FreeBSD community have what is called a ports collection, with over 26,000 ports being maintained by individuals and teams. The ports collection is compiled into packages which rather than building the port yourself, you can download and install a pre-built package. There are many massive organisations that use FreeBSD as servers or in embeded systems and contribute including Apple (as the OSX & iOS are based on FreeBSD). Netflix, Cisco, Whatsapp ($1m donation every year), EMC, Sony, VMWare, Yahoo.. etc. If you want to know more about a particular company go to youtube.com and search for example "netflix freebsd". FreeBSD is exceptionally stable including all its ports and packages. Everything works first time every time! Updating to the latest FreeBSD operating system is as easy as freebsd-update -r <release>

I am sure there will be people interested to help. :)

gwquk commented 5 years ago

PCBSD is probably the best place to start. As it will give you a nice GUI Desktop, where as FreeBSD (out of the box) will give you a basic server and you have to install all the packages to get a GUI Desktop. (Another lifetime ago started on Linux/GNU but switched!)

lwhsu commented 5 years ago

Hey @gwquk , since you ported RetDec to FreeBSD, do you want to help connect this project to Cirrus CI? Here is a simple example and hope it helps: https://github.com/facebook/zstd/blob/dev/.cirrus.yml

If you would also like to create a port, it will be even better and I'll do anything I can help!

gwquk commented 5 years ago

I'll give it a go, more than happy to help with both. Not done it before but I am sure you and google can help. 👍

gwquk commented 5 years ago

OK, If I understand what is going on below.

  1. For FreeBSD 12-0 & 11-2 releases on the amd64 architecture.
  2. Change the (searched) text in /etc/pkg/FreeBSD.conf backing up the original to /etc/pkg/FreeBSD.conf.bak from "pkg+http://pkg.FreeBSD.org/${ABI}/latest" to "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
  3. Upgrade all currently installed "Packages" to the latest package.
  4. Install all the packages needed by "retdec". (if already installed FreeBSD will say they are up to date)
  5. And finally ... the script needed to build "retdec"... including any environment variables to set. Note: That is as far as it goes... i.e. "retdec" is not installed by the look of things (just built)! Also.. A freshly installed version of FreeBSD may require more packages installed.

Iwshu, Is this what you are looking for?

####################### env: CIRRUS_CLONE_DEPTH: 1 ARCH: amd64

task: freebsd_instance: matrix: image: freebsd-12-0-release-amd64 image: freebsd-11-2-release-amd64 install_script:

lwhsu commented 5 years ago

@gwquk yes this one looks nice to me, except that I think we need one more 'N' argument after make -j. Also, may I suggest you test this .cirrus.yml in your fork repository with cirrus-ci?

gwquk commented 5 years ago

OK! I'll give it a go.

I have not submitted a port before, I'll make a few files. I suspect "retdec" would go here "/usr/ports/devel/retdec" in the "ports tree" I suspect these standard files will be needed.. Makefile distinfo pkg-descr pkg-message

lwhsu commented 5 years ago

All of these sound reasonable to me. I would also recommend you reading the porter's handbook: https://www.freebsd.org/doc/en/books/porters-handbook/ and discuss on freebsd-ports list if you have further question: https://lists.freebsd.org/mailman/listinfo/freebsd-ports

gwquk commented 5 years ago

Great! As I did not introduce myself.. I have been using FreeBSD activitely since around version 2.2.7 .. I did have a version 1.0 CD not sure where that went! Although I changed careers back in 2007, I have always maintained a few FreeBSD boxes. What about yourself?

lwhsu commented 5 years ago

My FreeBSD history is shorter than you :) you can find my public information on my github page.

gwquk commented 5 years ago

👍

gwquk commented 5 years ago

@gwquk yes this one looks nice to me, except that I think we need one more 'N' argument after make -j. Also, may I suggest you test this .cirrus.yml in your fork repository with cirrus-ci?

Do I create a new file called ".cirrus.yml" in a "clone" of the retdec source code from github .. Where do I start with this https://github.com/marketplace/cirrus-ci .. I have never used it before?

Sorry stupid questions..

lwhsu commented 5 years ago

That's OK, you can create a new .cirrus.yml in a branch in your "forked" repository at https://github.com/gwquk/retdec , and please check cirrus-ci's doc at https://cirrus-ci.org/ for more information about how to enable that service in your repository.

gwquk commented 5 years ago

OK.. I have made the "free" purchase. Uploaded the ".cirrus.yml" to my "forked" repository at https://github.com/gwquk/retdec .. it is not obvious what happens next! Will Cirrus CI just find the file and use it on my repository?

lwhsu commented 5 years ago

Yes it will get triggered automatically, the result is at https://cirrus-ci.com/github/gwquk/retdec/ It looks you need check syntax and indentation of YAML.

gwquk commented 5 years ago

I have uploaded a new version but I am only guessing .. all I have done is indent some of the lines. Could you please take a look into the file ".cirrus.yml" at https://github.com/gwquk/retdec ? Thanks

lwhsu commented 5 years ago

Please check this one https://gist.github.com/27795df4dd4d33929c6444ec4368654c

gwquk commented 5 years ago

cheers... some silly mistakes on my part. Also ... looks like FreeBSD 12.0 may compile retdec successfully on the forth attempt. (still going) FreeBSD 11.2 failed!

lwhsu commented 5 years ago

That's great! Please also check the sed line in the above gist link, the line in your repository probably cannot do what we exactly want.

lwhsu commented 5 years ago

Hello @gwquk how's the status? I see the .cirrus.yml in https://github.com/gwquk/retdec is good, but there seems some tweaks in the retdec's c++ codes, right?